@@ -19,7 +19,7 @@ library Create2Helper {
19
19
address public constant CREATE2_SINGLETON_FACTORY = 0x2401ae9bBeF67458362710f90302Eb52b5Ce835a ;
20
20
bytes32 public constant CREATE2_SALT = bytes32 (0 );
21
21
22
- function _precomputeAddress (bytes memory bytecode ) internal pure returns (address ) {
22
+ function _precomputeAddress (bytes memory bytecode ) external pure returns (address ) {
23
23
return
24
24
address (
25
25
uint160 (
@@ -37,15 +37,15 @@ library Create2Helper {
37
37
);
38
38
}
39
39
40
- function _deployCreate2 (bytes memory bytecode ) internal returns (address ) {
40
+ function _deployCreate2 (bytes memory bytecode ) external returns (address ) {
41
41
(bool success , bytes memory returnData ) = CREATE2_SINGLETON_FACTORY.call (
42
42
abi.encodePacked (CREATE2_SALT, bytecode)
43
43
);
44
44
require (success, 'CREATE2_DEPLOYMENT_FAILED ' );
45
45
return address (bytes20 (returnData));
46
46
}
47
47
48
- function _isContract (address account ) internal view returns (bool ) {
48
+ function _isContract (address account ) external view returns (bool ) {
49
49
return account.code.length > 0 ;
50
50
}
51
51
}
@@ -88,8 +88,20 @@ contract GhoListingPayload is IProposalGenericExecutor {
88
88
address ghoInterestRateStrategy ,
89
89
address ghoDiscountRateStrategy
90
90
) {
91
- GHO_TOKEN = precomputeGhoTokenAddress ();
92
- GHO_FLASHMINTER = precomputeGhoFlashMinterAddress ();
91
+ GHO_TOKEN = Create2Helper._precomputeAddress (
92
+ abi.encodePacked (type (GhoToken).creationCode, abi.encode (AaveGovernanceV2.SHORT_EXECUTOR))
93
+ );
94
+ GHO_FLASHMINTER = Create2Helper._precomputeAddress (
95
+ abi.encodePacked (
96
+ type (GhoFlashMinter).creationCode,
97
+ abi.encode (
98
+ GHO_TOKEN,
99
+ AaveV3Ethereum.COLLECTOR,
100
+ FLASHMINT_FEE,
101
+ address (AaveV3Ethereum.POOL_ADDRESSES_PROVIDER)
102
+ )
103
+ )
104
+ );
93
105
GHO_ORACLE = ghoOracle;
94
106
GHO_ATOKEN_IMPL = ghoATokenImpl;
95
107
GHO_VARIABLE_DEBT_TOKEN_IMPL = ghoVariableDebtTokenImpl;
@@ -240,34 +252,4 @@ contract GhoListingPayload is IProposalGenericExecutor {
240
252
FACILITATOR_FLASHMINTER_BUCKET_CAPACITY
241
253
);
242
254
}
243
-
244
- /**
245
- * @notice Returns the precomputed address of GHO token
246
- * @return The precomputed address of the GhoToken
247
- */
248
- function precomputeGhoTokenAddress () public pure returns (address ) {
249
- return
250
- Create2Helper._precomputeAddress (
251
- abi.encodePacked (type (GhoToken).creationCode, abi.encode (AaveGovernanceV2.SHORT_EXECUTOR))
252
- );
253
- }
254
-
255
- /**
256
- * @notice Returns the precomputed address of the GHO FlashMinter
257
- * @return The precomputed address of the GhoFlashMinter
258
- */
259
- function precomputeGhoFlashMinterAddress () public pure returns (address ) {
260
- return
261
- Create2Helper._precomputeAddress (
262
- abi.encodePacked (
263
- type (GhoFlashMinter).creationCode,
264
- abi.encode (
265
- precomputeGhoTokenAddress (),
266
- AaveV3Ethereum.COLLECTOR,
267
- FLASHMINT_FEE,
268
- address (AaveV3Ethereum.POOL_ADDRESSES_PROVIDER)
269
- )
270
- )
271
- );
272
- }
273
255
}
0 commit comments