From 790e6d22d340665c906d41c6be32fc5b09a5bad6 Mon Sep 17 00:00:00 2001 From: miguelmtz <36620902+miguelmtzinf@users.noreply.github.com> Date: Tue, 4 Jul 2023 20:59:06 +0200 Subject: [PATCH] fix: Remove IERC20Burnable and IERC20Mintable from GhoToken (#357) --- src/contracts/gho/GhoToken.sol | 19 ++++------------- .../gho/interfaces/IERC20Burnable.sol | 13 ------------ .../gho/interfaces/IERC20Mintable.sol | 14 ------------- src/contracts/gho/interfaces/IGhoToken.sol | 21 ++++++++++++++++--- 4 files changed, 22 insertions(+), 45 deletions(-) delete mode 100644 src/contracts/gho/interfaces/IERC20Burnable.sol delete mode 100644 src/contracts/gho/interfaces/IERC20Mintable.sol diff --git a/src/contracts/gho/GhoToken.sol b/src/contracts/gho/GhoToken.sol index 9d8cd09e..854e10f8 100644 --- a/src/contracts/gho/GhoToken.sol +++ b/src/contracts/gho/GhoToken.sol @@ -30,14 +30,8 @@ contract GhoToken is ERC20, AccessControl, IGhoToken { _setupRole(DEFAULT_ADMIN_ROLE, admin); } - /** - * @notice Mints the requested amount of tokens to the account address. - * @dev Only facilitators with enough bucket capacity available can mint. - * @dev The bucket level is increased upon minting. - * @param account The address receiving the GHO tokens - * @param amount The amount to mint - */ - function mint(address account, uint256 amount) external override { + /// @inheritdoc IGhoToken + function mint(address account, uint256 amount) external { require(amount > 0, 'INVALID_MINT_AMOUNT'); Facilitator storage f = _facilitators[msg.sender]; @@ -51,13 +45,8 @@ contract GhoToken is ERC20, AccessControl, IGhoToken { emit FacilitatorBucketLevelUpdated(msg.sender, currentBucketLevel, newBucketLevel); } - /** - * @notice Burns the requested amount of tokens from the account address. - * @dev Only active facilitators (bucket level > 0) can burn. - * @dev The bucket level is decreased upon burning. - * @param amount The amount to burn - */ - function burn(uint256 amount) external override { + /// @inheritdoc IGhoToken + function burn(uint256 amount) external { require(amount > 0, 'INVALID_BURN_AMOUNT'); Facilitator storage f = _facilitators[msg.sender]; diff --git a/src/contracts/gho/interfaces/IERC20Burnable.sol b/src/contracts/gho/interfaces/IERC20Burnable.sol deleted file mode 100644 index c828aeb9..00000000 --- a/src/contracts/gho/interfaces/IERC20Burnable.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -/** - * @dev Interface of a burnable erc-20 token - */ -interface IERC20Burnable { - /** - * @dev Destroys `amount` tokens from caller - * @param amount The amount of tokens to destroy - */ - function burn(uint256 amount) external; -} diff --git a/src/contracts/gho/interfaces/IERC20Mintable.sol b/src/contracts/gho/interfaces/IERC20Mintable.sol deleted file mode 100644 index b6651bd2..00000000 --- a/src/contracts/gho/interfaces/IERC20Mintable.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -/** - * @dev Interface of a mintable erc-20 token - */ -interface IERC20Mintable { - /** - * @dev Creates `amount` new tokens for `account` - * @param account The address to create tokens for - * @param amount The amount of tokens to create - */ - function mint(address account, uint256 amount) external; -} diff --git a/src/contracts/gho/interfaces/IGhoToken.sol b/src/contracts/gho/interfaces/IGhoToken.sol index 82e28330..dcbd9780 100644 --- a/src/contracts/gho/interfaces/IGhoToken.sol +++ b/src/contracts/gho/interfaces/IGhoToken.sol @@ -3,14 +3,12 @@ pragma solidity ^0.8.0; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol'; -import {IERC20Burnable} from './IERC20Burnable.sol'; -import {IERC20Mintable} from './IERC20Mintable.sol'; /** * @title IGhoToken * @author Aave */ -interface IGhoToken is IERC20Burnable, IERC20Mintable, IERC20, IAccessControl { +interface IGhoToken is IERC20, IAccessControl { struct Facilitator { uint128 bucketCapacity; uint128 bucketLevel; @@ -71,6 +69,23 @@ interface IGhoToken is IERC20Burnable, IERC20Mintable, IERC20, IAccessControl { */ function BUCKET_MANAGER_ROLE() external pure returns (bytes32); + /** + * @notice Mints the requested amount of tokens to the account address. + * @dev Only facilitators with enough bucket capacity available can mint. + * @dev The bucket level is increased upon minting. + * @param account The address receiving the GHO tokens + * @param amount The amount to mint + */ + function mint(address account, uint256 amount) external; + + /** + * @notice Burns the requested amount of tokens from the account address. + * @dev Only active facilitators (bucket level > 0) can burn. + * @dev The bucket level is decreased upon burning. + * @param amount The amount to burn + */ + function burn(uint256 amount) external; + /** * @notice Add the facilitator passed with the parameters to the facilitators list. * @dev Only accounts with `FACILITATOR_MANAGER_ROLE` role can call this function