Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.5 deployment #35

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions contracts/StableAsset.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -996,14 +1000,17 @@ 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;
IERC20Upgradeable(tokens[i]).safeTransfer(msg.sender, _amounts[i]);
}

collectFeeOrYield(true);
emit FeeCollected(feeAmount, totalSupply);
emit Redeemed(msg.sender, redeemAmount, amounts, feeAmount);
return amounts;
}
Expand Down
8 changes: 8 additions & 0 deletions contracts/TapETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -482,6 +488,8 @@ contract TapETH is Initializable, ITapETH {
totalShares += _sharesAmount;
newTotalShares = totalShares;
_totalSupply += _tokenAmount;

emit SharesMinted(_recipient, _tokenAmount, _sharesAmount);
}

/**
Expand Down
Loading