Skip to content

Commit

Permalink
Fix actualFee in Events
Browse files Browse the repository at this point in the history
  • Loading branch information
zjb0807 committed Oct 23, 2023
1 parent 8daa646 commit a52f4a1
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions contracts/StableAsset.sol
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,8 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable {
poolToken.setTotalSupply(feeAmount);
}

collectFeeOrYield(true);
emit FeeCollected(feeAmount, totalSupply);
emit Minted(msg.sender, mintAmount, _amounts, feeAmount);
uint256 actualFee = collectFeeOrYield(true);
emit Minted(msg.sender, mintAmount, _amounts, actualFee);
return mintAmount;
}

Expand Down Expand Up @@ -691,13 +690,13 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable {
amountPositive[_i] = false;
amountPositive[_j] = true;

uint256 feeAmountActual = collectFeeOrYield(true);
uint256 actualFee = collectFeeOrYield(true);
emit TokenSwapped(
msg.sender,
transferAmountJ,
amounts,
amountPositive,
feeAmountActual
actualFee
);
return transferAmountJ;
}
Expand Down Expand Up @@ -799,9 +798,8 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable {
totalSupply = D - _amount;
// After reducing the redeem fee, the remaining pool tokens are burned!
poolToken.burnSharesFrom(msg.sender, _amount);
collectFeeOrYield(true);
emit FeeCollected(feeAmount, totalSupply);
emit Redeemed(msg.sender, _amount, amounts, feeAmount);
uint256 actualFee = collectFeeOrYield(true);
emit Redeemed(msg.sender, _amount, amounts, actualFee);
return amounts;
}

Expand Down Expand Up @@ -899,9 +897,8 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable {
IERC20Upgradeable(tokens[_i]).safeTransfer(msg.sender, transferAmount);
totalSupply = D - _amount;
poolToken.burnSharesFrom(msg.sender, _amount);
collectFeeOrYield(true);
emit FeeCollected(feeAmount, totalSupply);
emit Redeemed(msg.sender, _amount, amounts, feeAmount);
uint256 actualFee = collectFeeOrYield(true);
emit Redeemed(msg.sender, _amount, amounts, actualFee);
return transferAmount;
}

Expand Down Expand Up @@ -1002,9 +999,8 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable {
IERC20Upgradeable(tokens[i]).safeTransfer(msg.sender, _amounts[i]);
}

collectFeeOrYield(true);
emit FeeCollected(feeAmount, totalSupply);
emit Redeemed(msg.sender, redeemAmount, amounts, feeAmount);
uint256 actualFee = collectFeeOrYield(true);
emit Redeemed(msg.sender, redeemAmount, amounts, actualFee);
return amounts;
}

Expand Down

0 comments on commit a52f4a1

Please sign in to comment.