From 652bd3176b8bfb6303cc8f27f9429deaf17d2ad0 Mon Sep 17 00:00:00 2001 From: Frank Yin Date: Thu, 19 Oct 2023 13:11:06 -0700 Subject: [PATCH] remove fee/yield recipient --- contracts/StableAsset.sol | 66 ++++++--------------------------------- 1 file changed, 9 insertions(+), 57 deletions(-) diff --git a/contracts/StableAsset.sol b/contracts/StableAsset.sol index 09a8d64..5dcd87a 100644 --- a/contracts/StableAsset.sol +++ b/contracts/StableAsset.sol @@ -108,18 +108,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { */ event RedeemFeeModified(uint256 redeemFee); - /** - * @dev This event is emitted when the fee recipient is modified. - * @param recipient is the new value of the recipient. - */ - event FeeRecipientModified(address recipient); - - /** - * @dev This event is emitted when the yield recipient is modified. - * @param recipient is the new value of the recipient. - */ - event YieldRecipientModified(address recipient); - /** * @dev This event is emitted when the governance is modified. * @param governance is the new value of the governance. @@ -201,14 +189,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { * redeemFee = redeemFee * FEE_DENOMINATOR */ uint256 public redeemFee; - /** - * @dev This is the account which receives transaction fees collected by the StableAsset contract. - */ - address public feeRecipient; - /** - * @dev This is the account which receives yield generated by the StableAsset contract. - */ - address public yieldRecipient; /** * @dev This is the address of the ERC20 token contract that represents the StableAsset pool token. */ @@ -281,8 +261,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { * @param _tokens The tokens in the pool. * @param _precisions The precisions of each token (10 ** (18 - token decimals)). * @param _fees The fees for minting, swapping, and redeeming. - * @param _feeRecipient The address that collects the fees. - * @param _yieldRecipient The address that receives yield farming rewards. * @param _poolToken The address of the pool token. * @param _A The initial value of the amplification coefficient A for the pool. */ @@ -290,8 +268,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { address[] memory _tokens, uint256[] memory _precisions, uint256[] memory _fees, - address _feeRecipient, - address _yieldRecipient, ITapETH _poolToken, uint256 _A, IExchangeRateProvider _exchangeRateProvider, @@ -316,8 +292,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { require(_precisions[i] != 0, "precision not set"); balances.push(0); } - require(_feeRecipient != address(0x0), "fee recipient not set"); - require(_yieldRecipient != address(0x0), "yield recipient not set"); require(address(_poolToken) != address(0x0), "pool token not set"); require(_A > 0 && _A < MAX_A, "A not set"); require( @@ -331,8 +305,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { __ReentrancyGuard_init(); governance = msg.sender; - feeRecipient = _feeRecipient; - yieldRecipient = _yieldRecipient; tokens = _tokens; precisions = _precisions; mintFee = _fees[0]; @@ -574,6 +546,7 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { } collectFeeOrYield(true); + emit FeeCollected(feeAmount, totalSupply); emit Minted(msg.sender, mintAmount, _amounts, feeAmount); return mintAmount; } @@ -718,13 +691,13 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { amountPositive[_i] = false; amountPositive[_j] = true; - feeAmount = collectFeeOrYield(true); + uint256 feeAmountActual = collectFeeOrYield(true); emit TokenSwapped( msg.sender, transferAmountJ, amounts, amountPositive, - feeAmount + feeAmountActual ); return transferAmountJ; } @@ -826,7 +799,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); - feeAmount = collectFeeOrYield(true); + collectFeeOrYield(true); + emit FeeCollected(feeAmount, totalSupply); emit Redeemed(msg.sender, _amount, amounts, feeAmount); return amounts; } @@ -925,7 +899,8 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { IERC20Upgradeable(tokens[_i]).safeTransfer(msg.sender, transferAmount); totalSupply = D - _amount; poolToken.burnSharesFrom(msg.sender, _amount); - feeAmount = collectFeeOrYield(true); + collectFeeOrYield(true); + emit FeeCollected(feeAmount, totalSupply); emit Redeemed(msg.sender, _amount, amounts, feeAmount); return transferAmount; } @@ -1027,7 +1002,8 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { IERC20Upgradeable(tokens[i]).safeTransfer(msg.sender, _amounts[i]); } - feeAmount = collectFeeOrYield(true); + collectFeeOrYield(true); + emit FeeCollected(feeAmount, totalSupply); emit Redeemed(msg.sender, redeemAmount, amounts, feeAmount); return amounts; } @@ -1104,10 +1080,8 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { poolToken.setTotalSupply(feeAmount); if (isFee) { - //address recipient = feeRecipient; emit FeeCollected(feeAmount, totalSupply); } else { - //address recipient = yieldRecipient; uint256[] memory amounts = new uint256[](_balances.length); for (uint256 i = 0; i < _balances.length; i++) { amounts[i] = _balances[i] - oldBalances[i]; @@ -1170,28 +1144,6 @@ contract StableAsset is Initializable, ReentrancyGuardUpgradeable { emit RedeemFeeModified(_redeemFee); } - /** - * @dev Updates the recipient of mint/swap/redeem fees. - * @param _feeRecipient The new recipient of mint/swap/redeem fees. - */ - function setFeeRecipient(address _feeRecipient) external { - require(msg.sender == governance, "not governance"); - require(_feeRecipient != address(0x0), "fee recipient not set"); - feeRecipient = _feeRecipient; - emit FeeRecipientModified(_feeRecipient); - } - - /** - * @dev Updates the recipient of yield. - * @param _yieldRecipient The new recipient of yield. - */ - function setYieldRecipient(address _yieldRecipient) external { - require(msg.sender == governance, "not governance"); - require(_yieldRecipient != address(0x0), "fee recipient not set"); - yieldRecipient = _yieldRecipient; - emit YieldRecipientModified(_yieldRecipient); - } - /** * @dev Pause mint/swap/redeem actions. Can unpause later. */