diff --git a/contracts/StableAsset.sol b/contracts/StableAsset.sol index 5dcd87a..c0ad562 100644 --- a/contracts/StableAsset.sol +++ b/contracts/StableAsset.sol @@ -541,12 +541,11 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { } totalSupply = newD; poolToken.mintShares(msg.sender, mintAmount); - if (mintFee > 0) { + if (feeAmount > 0) { poolToken.setTotalSupply(feeAmount); } collectFeeOrYield(true); - emit FeeCollected(feeAmount, totalSupply); emit Minted(msg.sender, mintAmount, _amounts, feeAmount); return mintAmount; } @@ -799,8 +798,10 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { totalSupply = D - _amount; // After reducing the redeem fee, the remaining pool tokens are burned! poolToken.burnSharesFrom(msg.sender, _amount); + if (feeAmount > 0) { + poolToken.setTotalSupply(feeAmount); + } collectFeeOrYield(true); - emit FeeCollected(feeAmount, totalSupply); emit Redeemed(msg.sender, _amount, amounts, feeAmount); return amounts; } @@ -899,8 +900,11 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { IERC20Upgradeable(tokens[_i]).safeTransfer(msg.sender, transferAmount); totalSupply = D - _amount; poolToken.burnSharesFrom(msg.sender, _amount); + if (feeAmount > 0) { + poolToken.setTotalSupply(feeAmount); + } + collectFeeOrYield(true); - emit FeeCollected(feeAmount, totalSupply); emit Redeemed(msg.sender, _amount, amounts, feeAmount); return transferAmount; } @@ -996,6 +1000,10 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { balances = _balances; totalSupply = oldD - redeemAmount; poolToken.burnSharesFrom(msg.sender, redeemAmount); + if (feeAmount > 0) { + poolToken.setTotalSupply(feeAmount); + } + uint256[] memory amounts = _amounts; for (i = 0; i < _balances.length; i++) { if (_amounts[i] == 0) continue; @@ -1003,7 +1011,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { } collectFeeOrYield(true); - emit FeeCollected(feeAmount, totalSupply); emit Redeemed(msg.sender, redeemAmount, amounts, feeAmount); return amounts; } diff --git a/contracts/TapETH.sol b/contracts/TapETH.sol index 2026863..e5ab856 100644 --- a/contracts/TapETH.sol +++ b/contracts/TapETH.sol @@ -41,6 +41,12 @@ contract TapETH is Initializable, ITapETH { uint256 sharesValue ); + event SharesMinted( + address indexed account, + uint256 tokenAmount, + uint256 sharesAmount + ); + event SharesBurnt( address indexed account, uint256 tokenAmount, @@ -482,6 +488,8 @@ contract TapETH is Initializable, ITapETH { totalShares += _sharesAmount; newTotalShares = totalShares; _totalSupply += _tokenAmount; + + emit SharesMinted(_recipient, _tokenAmount, _sharesAmount); } /**