Skip to content

Commit 888e965

Browse files
efecarranzamiguelmtzinf
authored andcommitted
feat: rename variables and natspec updates
1 parent 27453dc commit 888e965

File tree

7 files changed

+36
-32
lines changed

7 files changed

+36
-32
lines changed

docs/remote-facilitator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Remote facilitators function similarly to those on Ethereum, but the way GHO is
2222

2323
[On Ethereum]
2424

25-
1. An `GhoDirectFacilitator` contract is deployed to represent the minting strategy on the remote chain. It is granted the `Facilitator` role on the Ethereum `GhoToken` contract, with a defined bucket capacity X.
25+
1. A `GhoDirectFacilitator` contract is deployed to represent the minting strategy on the remote chain. It is granted the `Facilitator` role on the Ethereum `GhoToken` contract, with a defined bucket capacity of X.
2626
2. An amount X of GHO is minted via the `GhoDirectFacilitator` and bridged to the remote chain (typically via `CCIP`).
2727

2828
[On the Remote Chain]

src/contracts/facilitators/gsm/GhoDirectFacilitator.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {IGhoDirectFacilitator} from 'src/contracts/facilitators/gsm/interfaces/I
88
/**
99
* @title GhoDirectFacilitator
1010
* @author Aave/TokenLogic
11-
* @notice GHO Facilitator used to directly mint GHO to a given address.
11+
* @notice Basic facilitator for minting and burning tokens to and from an account, controlled by an access control list.
1212
*/
1313
contract GhoDirectFacilitator is AccessControl, IGhoDirectFacilitator {
1414
/// @inheritdoc IGhoDirectFacilitator
@@ -23,17 +23,17 @@ contract GhoDirectFacilitator is AccessControl, IGhoDirectFacilitator {
2323
/**
2424
* @dev Constructor
2525
* @param admin The address of the initial owner
26-
* @param ghoAddress The address of GHO token
26+
* @param gho The address of GHO token
2727
*/
28-
constructor(address admin, address ghoAddress) {
28+
constructor(address admin, address gho) {
2929
require(admin != address(0), 'ZERO_ADDRESS_NOT_VALID');
30-
require(ghoAddress != address(0), 'ZERO_ADDRESS_NOT_VALID');
30+
require(gho != address(0), 'ZERO_ADDRESS_NOT_VALID');
3131

3232
_grantRole(DEFAULT_ADMIN_ROLE, admin);
3333
_grantRole(MINTER_ROLE, admin);
3434
_grantRole(BURNER_ROLE, admin);
3535

36-
GHO_TOKEN = ghoAddress;
36+
GHO_TOKEN = gho;
3737
}
3838

3939
/// @inheritdoc IGhoDirectFacilitator

src/contracts/facilitators/gsm/GhoReserve.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ contract GhoReserve is AccessControl, VersionedInitializable, IGhoReserve {
1919
using SafeCast for uint256;
2020

2121
/// @inheritdoc IGhoReserve
22-
bytes32 public constant MANAGE_ENTITY_ROLE = keccak256('MANAGE_ENTITY_ROLE');
22+
bytes32 public constant ENTITY_MANAGER_ROLE = keccak256('ENTITY_MANAGER_ROLE');
2323

2424
/// @inheritdoc IGhoReserve
25-
bytes32 public constant SET_LIMIT_ROLE = keccak256('SET_LIMIT_ROLE');
25+
bytes32 public constant LIMIT_MANAGER_ROLE = keccak256('LIMIT_MANAGER_ROLE');
2626

2727
/// @inheritdoc IGhoReserve
2828
bytes32 public constant TRANSFER_ROLE = keccak256('TRANSFER_ROLE');
@@ -38,11 +38,11 @@ contract GhoReserve is AccessControl, VersionedInitializable, IGhoReserve {
3838

3939
/**
4040
* @dev Constructor
41-
* @param ghoAddress The address of the GHO token on the remote chain
41+
* @param gho The address of the GHO token on the remote chain
4242
*/
43-
constructor(address ghoAddress) {
44-
require(ghoAddress != address(0), 'ZERO_ADDRESS_NOT_VALID');
45-
GHO_TOKEN = ghoAddress;
43+
constructor(address gho) {
44+
require(gho != address(0), 'ZERO_ADDRESS_NOT_VALID');
45+
GHO_TOKEN = gho;
4646
}
4747

4848
/**
@@ -53,8 +53,8 @@ contract GhoReserve is AccessControl, VersionedInitializable, IGhoReserve {
5353
require(admin != address(0), 'ZERO_ADDRESS_NOT_VALID');
5454

5555
_grantRole(DEFAULT_ADMIN_ROLE, admin);
56-
_grantRole(MANAGE_ENTITY_ROLE, admin);
57-
_grantRole(SET_LIMIT_ROLE, admin);
56+
_grantRole(ENTITY_MANAGER_ROLE, admin);
57+
_grantRole(LIMIT_MANAGER_ROLE, admin);
5858
_grantRole(TRANSFER_ROLE, admin);
5959
}
6060

@@ -82,13 +82,13 @@ contract GhoReserve is AccessControl, VersionedInitializable, IGhoReserve {
8282
}
8383

8484
/// @inheritdoc IGhoReserve
85-
function addEntity(address entity) external onlyRole(MANAGE_ENTITY_ROLE) {
85+
function addEntity(address entity) external onlyRole(ENTITY_MANAGER_ROLE) {
8686
require(_entities.add(entity), 'ENTITY_ALREADY_EXISTS');
8787
emit EntityAdded(entity);
8888
}
8989

9090
/// @inheritdoc IGhoReserve
91-
function removeEntity(address entity) external onlyRole(MANAGE_ENTITY_ROLE) {
91+
function removeEntity(address entity) external onlyRole(ENTITY_MANAGER_ROLE) {
9292
GhoUsage memory usage = _ghoUsage[entity];
9393
require(usage.used == 0, 'ENTITY_GHO_USED_NOT_ZERO');
9494
require(usage.limit == 0, 'ENTITY_GHO_LIMIT_NOT_ZERO');
@@ -98,7 +98,7 @@ contract GhoReserve is AccessControl, VersionedInitializable, IGhoReserve {
9898
}
9999

100100
/// @inheritdoc IGhoReserve
101-
function setLimit(address entity, uint256 limit) external onlyRole(SET_LIMIT_ROLE) {
101+
function setLimit(address entity, uint256 limit) external onlyRole(LIMIT_MANAGER_ROLE) {
102102
require(_entities.contains(entity), 'ENTITY_DOES_NOT_EXIST');
103103
_ghoUsage[entity].limit = limit.toUint128();
104104

src/contracts/facilitators/gsm/interfaces/IGhoDirectFacilitator.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.0;
33

4+
import {IAccessControl} from 'src/contracts/dependencies/openzeppelin-contracts/contracts/access/IAccessControl.sol';
5+
46
/**
57
* @title IGhoDirectFacilitator
68
* @author Aave/TokenLogic
79
* @notice Defines the behaviour of an GhoDirectFacilitator
810
*/
9-
interface IGhoDirectFacilitator {
11+
interface IGhoDirectFacilitator is IAccessControl {
1012
/**
1113
* @notice Mint an amount of GHO to an address
12-
* @dev Only callable by address with MINTER_ROLE.
14+
@dev Only callable by addresses with `MINTER_ROLE` role..
1315
* @param account The address receiving GHO
1416
* @param amount The amount of GHO to be minted
1517
*/
1618
function mint(address account, uint256 amount) external;
1719

1820
/**
1921
* @notice Burns an amount of GHO
20-
* @dev Only callable by address with BURNER_ROLE.
22+
* @dev Only callable by addresses with `BURNER_ROLE` role.
2123
* @param amount The amount of GHO to be burned
2224
*/
2325
function burn(uint256 amount) external;

src/contracts/facilitators/gsm/interfaces/IGhoReserve.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.0;
33

4+
import {IAccessControl} from 'src/contracts/dependencies/openzeppelin-contracts/contracts/access/IAccessControl.sol';
5+
46
/**
57
* @title IGhoReserve
68
* @author Aave/TokenLogic
79
* @notice Defines the behaviour of a GhoReserve
810
*/
9-
interface IGhoReserve {
11+
interface IGhoReserve is IAccessControl {
1012
/**
1113
* @dev Struct data representing GHO usage.
1214
* @param limit The maximum amount of GHO that can be used
@@ -103,13 +105,13 @@ interface IGhoReserve {
103105
* @notice Returns the identifier of the ManageEntity Role
104106
* @return The bytes32 id hash of the ManageEntity role
105107
*/
106-
function MANAGE_ENTITY_ROLE() external pure returns (bytes32);
108+
function ENTITY_MANAGER_ROLE() external pure returns (bytes32);
107109

108110
/**
109111
* @notice Returns the identifier of the SetLimit Role
110112
* @return The bytes32 id hash of the SetLimit role
111113
*/
112-
function SET_LIMIT_ROLE() external pure returns (bytes32);
114+
function LIMIT_MANAGER_ROLE() external pure returns (bytes32);
113115

114116
/**
115117
* @notice Returns the identifier of the Transfer Role

tests/helpers/Constants.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ contract Constants {
3131
bytes32 public constant BURNER_ROLE = keccak256('MINTER_ROLE');
3232

3333
// admin role for GhoReserve
34-
bytes32 public constant MANAGE_ENTITY_ROLE = keccak256('MANAGE_ENTITY_ROLE');
35-
bytes32 public constant SET_LIMIT_ROLE = keccak256('SET_LIMIT_ROLE');
34+
bytes32 public constant ENTITY_MANAGER_ROLE = keccak256('ENTITY_MANAGER_ROLE');
35+
bytes32 public constant LIMIT_MANAGER_ROLE = keccak256('LIMIT_MANAGER_ROLE');
3636
bytes32 public constant TRANSFER_ROLE = keccak256('TRANSFER_ROLE');
3737

3838
// signature typehash for GSM

tests/unit/TestGhoReserve.t.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ contract TestGhoReserve is TestGhoBase {
1919
GhoReserve reserve = new GhoReserve(address(GHO_TOKEN));
2020

2121
assertFalse(reserve.hasRole(DEFAULT_ADMIN_ROLE, address(this)));
22-
assertFalse(reserve.hasRole(MANAGE_ENTITY_ROLE, address(this)));
23-
assertFalse(reserve.hasRole(SET_LIMIT_ROLE, address(this)));
22+
assertFalse(reserve.hasRole(ENTITY_MANAGER_ROLE, address(this)));
23+
assertFalse(reserve.hasRole(LIMIT_MANAGER_ROLE, address(this)));
2424
assertFalse(reserve.hasRole(TRANSFER_ROLE, address(this)));
2525

2626
reserve.initialize(address(this));
2727

2828
assertTrue(reserve.hasRole(DEFAULT_ADMIN_ROLE, address(this)));
29-
assertTrue(reserve.hasRole(MANAGE_ENTITY_ROLE, address(this)));
30-
assertTrue(reserve.hasRole(SET_LIMIT_ROLE, address(this)));
29+
assertTrue(reserve.hasRole(ENTITY_MANAGER_ROLE, address(this)));
30+
assertTrue(reserve.hasRole(LIMIT_MANAGER_ROLE, address(this)));
3131
assertTrue(reserve.hasRole(TRANSFER_ROLE, address(this)));
3232
}
3333

@@ -167,7 +167,7 @@ contract TestGhoReserve is TestGhoBase {
167167
}
168168

169169
function testRevertAddEntityNoRole() public {
170-
vm.expectRevert(AccessControlErrorsLib.MISSING_ROLE(MANAGE_ENTITY_ROLE, ALICE));
170+
vm.expectRevert(AccessControlErrorsLib.MISSING_ROLE(ENTITY_MANAGER_ROLE, ALICE));
171171
vm.prank(ALICE);
172172
GHO_RESERVE.addEntity(ALICE);
173173
}
@@ -231,7 +231,7 @@ contract TestGhoReserve is TestGhoBase {
231231
}
232232

233233
function testRevertRemoveEntityNoRole() public {
234-
vm.expectRevert(AccessControlErrorsLib.MISSING_ROLE(MANAGE_ENTITY_ROLE, ALICE));
234+
vm.expectRevert(AccessControlErrorsLib.MISSING_ROLE(ENTITY_MANAGER_ROLE, ALICE));
235235
vm.prank(ALICE);
236236
GHO_RESERVE.removeEntity(ALICE);
237237
}
@@ -261,7 +261,7 @@ contract TestGhoReserve is TestGhoBase {
261261
}
262262

263263
function testRevertSetLimitNoRole() public {
264-
vm.expectRevert(AccessControlErrorsLib.MISSING_ROLE(SET_LIMIT_ROLE, ALICE));
264+
vm.expectRevert(AccessControlErrorsLib.MISSING_ROLE(LIMIT_MANAGER_ROLE, ALICE));
265265
vm.prank(ALICE);
266266
GHO_RESERVE.setLimit(ALICE, 1_000_000 ether);
267267
}

0 commit comments

Comments
 (0)