Skip to content

Commit ee6b6d0

Browse files
authored
fix: Add compilation config (#21)
* fix: Add compilation config * ci: Change to ubuntu-latest * fix: Remove extra output files of compilation * fix: Remove unnecessary getters for GhoToken and GhoFlashMinter * fix: Lower compilation runs * ci: Change to self-hosted
1 parent f69e74e commit ee6b6d0

File tree

4 files changed

+30
-42
lines changed

4 files changed

+30
-42
lines changed

foundry.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ test = 'tests'
44
script = 'scripts'
55
out = 'out'
66
libs = ['lib']
7+
78
remappings = [
89
'solidity-utils/=lib/solidity-utils/src'
910
]
1011
fs_permissions = [{access = "write", path = "./reports"}]
1112

13+
solc_version = "0.8.10"
14+
extra_output_files = ["metadata"]
15+
optimizer = true
16+
optimizer_runs = 5000
17+
1218
[rpc_endpoints]
1319
mainnet = "${RPC_MAINNET}"
1420
optimism = "${RPC_OPTIMISM}"

scripts/LaunchGho.s.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ contract LaunchGho is Script {
4141
aaveData.ghoInterestRateStrategy,
4242
aaveData.ghoDiscountRateStrategy
4343
);
44-
console2.log('GhoToken:', GhoListingPayload(payload).precomputeGhoTokenAddress());
45-
console2.log('FlashMinter:', GhoListingPayload(payload).precomputeGhoFlashMinterAddress());
44+
console2.log('GhoToken:', GhoListingPayload(payload).GHO_TOKEN());
45+
console2.log('FlashMinter:', GhoListingPayload(payload).GHO_FLASHMINTER());
4646
console2.log('Payload:', payload);
4747

4848
// Deploy GhoUiDataProvider
4949
address ghoUiDataProvider = Helpers.deployGhoUiDataProvider(
5050
address(AaveV3Ethereum.POOL),
51-
GhoListingPayload(payload).precomputeGhoTokenAddress()
51+
GhoListingPayload(payload).GHO_TOKEN()
5252
);
5353
console2.log('GhoUiDataProvider:', ghoUiDataProvider);
5454

src/contracts/GhoListingPayload.sol

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ library Create2Helper {
1919
address public constant CREATE2_SINGLETON_FACTORY = 0x2401ae9bBeF67458362710f90302Eb52b5Ce835a;
2020
bytes32 public constant CREATE2_SALT = bytes32(0);
2121

22-
function _precomputeAddress(bytes memory bytecode) internal pure returns (address) {
22+
function _precomputeAddress(bytes memory bytecode) external pure returns (address) {
2323
return
2424
address(
2525
uint160(
@@ -37,15 +37,15 @@ library Create2Helper {
3737
);
3838
}
3939

40-
function _deployCreate2(bytes memory bytecode) internal returns (address) {
40+
function _deployCreate2(bytes memory bytecode) external returns (address) {
4141
(bool success, bytes memory returnData) = CREATE2_SINGLETON_FACTORY.call(
4242
abi.encodePacked(CREATE2_SALT, bytecode)
4343
);
4444
require(success, 'CREATE2_DEPLOYMENT_FAILED');
4545
return address(bytes20(returnData));
4646
}
4747

48-
function _isContract(address account) internal view returns (bool) {
48+
function _isContract(address account) external view returns (bool) {
4949
return account.code.length > 0;
5050
}
5151
}
@@ -88,8 +88,20 @@ contract GhoListingPayload is IProposalGenericExecutor {
8888
address ghoInterestRateStrategy,
8989
address ghoDiscountRateStrategy
9090
) {
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+
);
93105
GHO_ORACLE = ghoOracle;
94106
GHO_ATOKEN_IMPL = ghoATokenImpl;
95107
GHO_VARIABLE_DEBT_TOKEN_IMPL = ghoVariableDebtTokenImpl;
@@ -240,34 +252,4 @@ contract GhoListingPayload is IProposalGenericExecutor {
240252
FACILITATOR_FLASHMINTER_BUCKET_CAPACITY
241253
);
242254
}
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-
}
273255
}

tests/GhoListingTest.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ contract GhoListingTest is ProtocolV3TestBase {
5656
aaveData.ghoDiscountRateStrategy
5757
);
5858
GhoListingPayload payload = GhoListingPayload(payloadAddress);
59-
GHO_TOKEN = payload.precomputeGhoTokenAddress();
60-
GHO_FLASHMINTER = payload.precomputeGhoFlashMinterAddress();
59+
GHO_TOKEN = payload.GHO_TOKEN();
60+
GHO_FLASHMINTER = payload.GHO_FLASHMINTER();
6161

6262
// Simulate GOV action
6363
uint256 listingProposalId = _passProposal(AaveGovernanceV2.SHORT_EXECUTOR, address(payload));
@@ -95,8 +95,8 @@ contract GhoListingTest is ProtocolV3TestBase {
9595
aaveData.ghoDiscountRateStrategy
9696
);
9797
GhoListingPayload payload = GhoListingPayload(payloadAddress);
98-
GHO_TOKEN = payload.precomputeGhoTokenAddress();
99-
GHO_FLASHMINTER = payload.precomputeGhoFlashMinterAddress();
98+
GHO_TOKEN = payload.GHO_TOKEN();
99+
GHO_FLASHMINTER = payload.GHO_FLASHMINTER();
100100

101101
// Simulate GOV action
102102
uint256 listingProposalId = _passProposal(AaveGovernanceV2.SHORT_EXECUTOR, address(payload));

0 commit comments

Comments
 (0)