From 41fb77d0f4a2f8ecb83b1e78a266a167f2d78e3f Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Thu, 15 Dec 2022 12:37:04 +0100 Subject: [PATCH 1/2] fix: Complete IGhoFacilitator with treasury functions --- .../facilitators/aave/tokens/GhoAToken.sol | 4 ++-- .../aave/tokens/interfaces/IGhoAToken.sol | 19 ---------------- .../flashMinter/GhoFlashMinter.sol | 4 ++-- .../interfaces/IGhoFlashMinter.sol | 19 ---------------- .../gho/interfaces/IGhoFacilitator.sol | 22 ++++++++++++++++++- 5 files changed, 25 insertions(+), 43 deletions(-) diff --git a/src/contracts/facilitators/aave/tokens/GhoAToken.sol b/src/contracts/facilitators/aave/tokens/GhoAToken.sol index 33e04659..3a5661c2 100644 --- a/src/contracts/facilitators/aave/tokens/GhoAToken.sol +++ b/src/contracts/facilitators/aave/tokens/GhoAToken.sol @@ -277,14 +277,14 @@ contract GhoAToken is VersionedInitializable, ScaledBalanceTokenBase, EIP712Base return address(_ghoVariableDebtToken); } - /// @inheritdoc IGhoAToken + /// @inheritdoc IGhoFacilitator function updateGhoTreasury(address newGhoTreasury) external override onlyPoolAdmin { address oldGhoTreasury = _ghoTreasury; _ghoTreasury = newGhoTreasury; emit GhoTreasuryUpdated(oldGhoTreasury, newGhoTreasury); } - /// @inheritdoc IGhoAToken + /// @inheritdoc IGhoFacilitator function getGhoTreasury() external view override returns (address) { return _ghoTreasury; } diff --git a/src/contracts/facilitators/aave/tokens/interfaces/IGhoAToken.sol b/src/contracts/facilitators/aave/tokens/interfaces/IGhoAToken.sol index f2163233..251d38c9 100644 --- a/src/contracts/facilitators/aave/tokens/interfaces/IGhoAToken.sol +++ b/src/contracts/facilitators/aave/tokens/interfaces/IGhoAToken.sol @@ -16,13 +16,6 @@ interface IGhoAToken is IAToken, IGhoFacilitator { */ event VariableDebtTokenSet(address indexed variableDebtToken); - /** - * @dev Emitted when GHO treasury address is updated - * @param oldGhoTreasury The address of the old GhoTreasury - * @param newGhoTreasury The address of the new GhoTreasury - */ - event GhoTreasuryUpdated(address indexed oldGhoTreasury, address indexed newGhoTreasury); - /** * @notice Sets a reference to the GHO variable debt token * @param ghoVariableDebtToken The address of the GhoVariableDebtToken contract @@ -34,16 +27,4 @@ interface IGhoAToken is IAToken, IGhoFacilitator { * @return The address of the GhoVariableDebtToken contract */ function getVariableDebtToken() external view returns (address); - - /** - * @notice Updates the address of the GHO treasury, where interest earned by the protocol is sent - * @param newGhoTreasury The address of the GhoTreasury - */ - function updateGhoTreasury(address newGhoTreasury) external; - - /** - * @notice Returns the address of the GHO treasury - * @return The address of the GhoTreasury contract - */ - function getGhoTreasury() external view returns (address); } diff --git a/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol b/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol index 7b534b80..fb5afbe3 100644 --- a/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol +++ b/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol @@ -132,14 +132,14 @@ contract GhoFlashMinter is IGhoFlashMinter { return _fee; } - /// @inheritdoc IGhoFlashMinter + /// @inheritdoc IGhoFacilitator function updateGhoTreasury(address newGhoTreasury) external override onlyPoolAdmin { address oldGhoTreasury = _ghoTreasury; _ghoTreasury = newGhoTreasury; emit GhoTreasuryUpdated(oldGhoTreasury, newGhoTreasury); } - /// @inheritdoc IGhoFlashMinter + /// @inheritdoc IGhoFacilitator function getGhoTreasury() external view returns (address) { return _ghoTreasury; } diff --git a/src/contracts/facilitators/flashMinter/interfaces/IGhoFlashMinter.sol b/src/contracts/facilitators/flashMinter/interfaces/IGhoFlashMinter.sol index ca824f7b..444b9c9e 100644 --- a/src/contracts/facilitators/flashMinter/interfaces/IGhoFlashMinter.sol +++ b/src/contracts/facilitators/flashMinter/interfaces/IGhoFlashMinter.sol @@ -33,13 +33,6 @@ interface IGhoFlashMinter is IERC3156FlashLender, IGhoFacilitator { uint256 fee ); - /** - * @dev Emitted when GHO treasury address is updated - * @param oldGhoTreasury The address of the old GhoTreasury - * @param newGhoTreasury The address of the new GhoTreasury - */ - event GhoTreasuryUpdated(address indexed oldGhoTreasury, address indexed newGhoTreasury); - /** * @notice Returns the address of the Aave Pool Addresses Provider contract * @return The address of the PoolAddressesProvider @@ -64,16 +57,4 @@ interface IGhoFlashMinter is IERC3156FlashLender, IGhoFacilitator { * @return The percentage fee of the flash-minted amount that needs to be repaid, on top of the principal (in bps). */ function getFee() external view returns (uint256); - - /** - * @notice Updates the address of the GHO treasury, where interest earned by the protocol is sent - * @param newGhoTreasury The address of the GhoTreasury - */ - function updateGhoTreasury(address newGhoTreasury) external; - - /** - * @notice Returns the address of the GHO treasury - * @return The address of the GhoTreasury contract - */ - function getGhoTreasury() external view returns (address); } diff --git a/src/contracts/gho/interfaces/IGhoFacilitator.sol b/src/contracts/gho/interfaces/IGhoFacilitator.sol index 1fefefb4..969c8e07 100644 --- a/src/contracts/gho/interfaces/IGhoFacilitator.sol +++ b/src/contracts/gho/interfaces/IGhoFacilitator.sol @@ -20,7 +20,27 @@ interface IGhoFacilitator { ); /** - * @notice Distribute accumulated fees to the GhoTreasury + * @dev Emitted when Gho Treasury address is updated + * @param oldGhoTreasury The address of the old GhoTreasury contract + * @param newGhoTreasury The address of the new GhoTreasury contract + */ + event GhoTreasuryUpdated(address indexed oldGhoTreasury, address indexed newGhoTreasury); + + /** + * @notice Distribute fees to the GhoTreasury */ function distributeFeesToTreasury() external; + + /** + * @notice Updates the address of the Gho Treasury + * @dev Extra precaution when updating this address. It is where revenue fees are sent to + * @param newGhoTreasury The address of the GhoTreasury + */ + function updateGhoTreasury(address newGhoTreasury) external; + + /** + * @notice Returns the address of the Gho Treasury + * @return The address of the GhoTreasury contract + */ + function getGhoTreasury() external view returns (address); } From 98a521c2eb8be8790e086a3b0b9f3091e78dfa00 Mon Sep 17 00:00:00 2001 From: miguelmtz <36620902+miguelmtzinf@users.noreply.github.com> Date: Thu, 15 Dec 2022 12:54:22 +0100 Subject: [PATCH 2/2] docs: Add clear warning for updateGhoTreasury --- src/contracts/gho/interfaces/IGhoFacilitator.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contracts/gho/interfaces/IGhoFacilitator.sol b/src/contracts/gho/interfaces/IGhoFacilitator.sol index 969c8e07..7995035d 100644 --- a/src/contracts/gho/interfaces/IGhoFacilitator.sol +++ b/src/contracts/gho/interfaces/IGhoFacilitator.sol @@ -33,7 +33,7 @@ interface IGhoFacilitator { /** * @notice Updates the address of the Gho Treasury - * @dev Extra precaution when updating this address. It is where revenue fees are sent to + * @dev WARNING: The GhoTreasury is where revenue fees are sent to. Update carefully * @param newGhoTreasury The address of the GhoTreasury */ function updateGhoTreasury(address newGhoTreasury) external;