diff --git a/script/Deploy.sol b/script/Deploy.sol index ef24a7e..dfe5c08 100644 --- a/script/Deploy.sol +++ b/script/Deploy.sol @@ -9,8 +9,6 @@ import {ERC20} from "solmate/tokens/ERC20.sol"; import {IPool, IRewardsController} from "yield-daddy/aave-v3/AaveV3ERC4626.sol"; contract Deploy is Script { - error UnsupportedChain(); - struct VaultDeploymentParams { address token; address aToken; @@ -24,6 +22,8 @@ contract Deploy is Script { VaultDeploymentParams[] vaults; } + error UnsupportedChain(); + function getDeploymentParams( uint256 chainId ) internal pure returns (DeploymentParams memory params) { diff --git a/src/contracts/Grateful.sol b/src/contracts/Grateful.sol index 2585e44..b94f74f 100644 --- a/src/contracts/Grateful.sol +++ b/src/contracts/Grateful.sol @@ -137,12 +137,14 @@ contract Grateful is IGrateful, Ownable2Step { ) external onlyOwner { tokensWhitelisted[_token] = true; IERC20(_token).safeIncreaseAllowance(address(aavePool), type(uint256).max); + emit TokenAdded(_token); } /// @inheritdoc IGrateful function addVault(address _token, address _vault) external onlyOwner onlyWhenTokenWhitelisted(_token) { vaults[_token] = AaveV3Vault(_vault); IERC20(_token).safeIncreaseAllowance(address(_vault), type(uint256).max); + emit VaultAdded(_token, _vault); } /// @inheritdoc IGrateful @@ -282,11 +284,13 @@ contract Grateful is IGrateful, Ownable2Step { uint256 _newFee ) external onlyOwner { fee = _newFee; + emit FeeUpdated(_newFee); } /// @inheritdoc IGrateful function setCustomFee(uint256 _newFee, address _merchant) external onlyOwner { customFees[_merchant] = CustomFee({isSet: true, fee: _newFee}); + emit CustomFeeUpdated(_merchant, _newFee); } /// @inheritdoc IGrateful @@ -294,6 +298,7 @@ contract Grateful is IGrateful, Ownable2Step { address _merchant ) external onlyOwner { delete customFees[_merchant]; + emit CustomFeeUnset(_merchant); } /*////////////////////////////////////////////////////////////// diff --git a/src/interfaces/IGrateful.sol b/src/interfaces/IGrateful.sol index 555d2b4..fbc1101 100644 --- a/src/interfaces/IGrateful.sol +++ b/src/interfaces/IGrateful.sol @@ -59,6 +59,38 @@ interface IGrateful { */ event Withdraw(address indexed user, address indexed token, uint256 amount); + /** + * @notice Emitted when the default fee is updated. + * @param newFee The new fee in basis points. + */ + event FeeUpdated(uint256 newFee); + + /** + * @notice Emitted when a custom fee is set for a merchant. + * @param merchant Address of the merchant. + * @param newFee The new custom fee in basis points. + */ + event CustomFeeUpdated(address indexed merchant, uint256 newFee); + + /** + * @notice Emitted when a custom fee is unset for a merchant. + * @param merchant Address of the merchant. + */ + event CustomFeeUnset(address indexed merchant); + + /** + * @notice Emitted when a new token is added to the whitelist. + * @param token Address of the token added. + */ + event TokenAdded(address indexed token); + + /** + * @notice Emitted when a new vault is added for a token. + * @param token Address of the token. + * @param vault Address of the vault added. + */ + event VaultAdded(address indexed token, address indexed vault); + /*/////////////////////////////////////////////////////////////// ERRORS //////////////////////////////////////////////////////////////*/