-
Notifications
You must be signed in to change notification settings - Fork 35
feat: deployment engine #1047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: deployment engine #1047
Changes from 45 commits
8bafe86
d95101b
00ba92a
9f6c70d
4a51e33
cecd4f3
460c2e0
2aaeb00
4581387
b94ed13
3ba9fad
e455afb
00433e9
945619f
8680dd6
21033d1
5304e6c
9545217
4d36444
a951c30
384aeef
ac1dc8a
1fd5830
dd459c1
11be630
7b16818
8f7d6f7
63c93f9
e38a93c
563f04f
a455a57
e3642d3
b06da1a
05c0dc0
d5affff
265a3a7
8d4cef0
beea923
31509cf
ac59e59
a224fe8
17db1f2
c49467f
65b44c9
25a3ae4
e597f1c
6c5c0b5
70e4501
8f14c51
e7f4ea5
f6787b9
27260d0
8c26cf3
0ad7618
198fc50
5b13830
4358d33
b3cf5e5
92eab04
d851888
5492653
90f133f
b8acf9c
7a82a0b
dfe4808
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,4 +22,6 @@ lcov* | |
| report/ | ||
|
|
||
| .DS_Store | ||
| .venv/ | ||
| .venv/ | ||
|
|
||
| output/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import 'scripts/deploy/AaveV4DeployBatchBase.s.sol'; | ||
|
|
||
| contract AaveV4DeployBatchScript is AaveV4DeployBatchBaseScript {} | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {Script} from 'forge-std/Script.sol'; | ||
|
|
||
| import {OrchestrationReports} from 'src/deployments/libraries/OrchestrationReports.sol'; | ||
| import {InputUtils} from 'src/deployments/utils/InputUtils.sol'; | ||
| import {DeployUtils} from 'src/deployments/utils/DeployUtils.sol'; | ||
| import {MetadataLogger} from 'src/deployments/utils/MetadataLogger.sol'; | ||
| import { | ||
| AaveV4DeployOrchestration | ||
| } from 'src/deployments/orchestration/AaveV4DeployOrchestration.sol'; | ||
|
|
||
| abstract contract AaveV4DeployBatchBaseScript is Script, DeployUtils, InputUtils { | ||
|
||
| string internal constant INPUT_PATH = 'scripts/deploy/inputs/AaveV4DeployInput.json'; | ||
|
||
| string internal constant OUTPUT_DIR = 'output/reports/deployments/'; | ||
| string internal constant OUTPUT_FILE = 'AaveV4DeployBatch.json'; | ||
|
|
||
| function run() external { | ||
| vm.createDir(OUTPUT_DIR, true); | ||
| MetadataLogger logger = new MetadataLogger(OUTPUT_DIR); | ||
| FullDeployInputs memory inputs = loadFullDeployInputs(INPUT_PATH); | ||
|
|
||
| _loadWarnings(logger, inputs); | ||
|
|
||
| logger.log('...Starting Aave V4 Batch Deployment...'); | ||
| address deployer = msg.sender; | ||
|
||
| vm.startBroadcast(deployer); | ||
| OrchestrationReports.FullDeploymentReport memory report = AaveV4DeployOrchestration | ||
| .deployAaveV4({ | ||
avniculae marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| logger: logger, | ||
| deployer: deployer, | ||
| admin: inputs.admin, | ||
| nativeWrapper: inputs.nativeWrapperAddress, | ||
| hubLabels: inputs.hubLabels, | ||
| spokeLabels: inputs.spokeLabels, | ||
| grantRoles: inputs.grantRoles | ||
| }); | ||
| vm.stopBroadcast(); | ||
| logger.writeJsonReportMarket(report); | ||
| logger.log('...Batch Deployment Completed...'); | ||
| logger.log('...Saving Logs...'); | ||
| logger.save({fileName: OUTPUT_FILE, withTimestamp: true}); | ||
| } | ||
|
|
||
| function _loadWarnings( | ||
| MetadataLogger logger, | ||
| FullDeployInputs memory inputs | ||
| ) internal pure virtual { | ||
| if (inputs.grantRoles) { | ||
| logger.log('WARNING: Roles are being set'); | ||
| if (inputs.admin == address(0)) { | ||
| logger.log('WARNING: Admin is zero address; Roles can not be set'); | ||
|
||
| } | ||
| } | ||
| if (inputs.hubLabels.length == 0) { | ||
| logger.log('WARNING: Hub will not be deployed'); | ||
| } | ||
| if (inputs.spokeLabels.length == 0) { | ||
| logger.log('WARNING: Spoke will not be deployed'); | ||
| } | ||
| if (inputs.nativeWrapperAddress == address(0)) { | ||
| logger.log('WARNING: Native wrapper zero address; NativeTokenGateway will not be deployed'); | ||
| } | ||
| logger.log(''); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "admin": "0x0000000000000000000000000000000000000001", | ||
|
||
| "nativeWrapperAddress": "0x0000000000000000000000000000000000000002", | ||
| "grantRoles": true, | ||
| "hubLabels": ["Hub 1", "Hub 2", "Hub 3"], | ||
| "spokeLabels": ["Spoke 1", "Spoke 2", "Spoke 3"] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {BatchReports} from 'src/deployments/libraries/BatchReports.sol'; | ||
| import {AaveV4AccessManagerEnumerableDeployProcedure} from 'src/deployments/procedures/deploy/AaveV4AccessManagerEnumerableDeployProcedure.sol'; | ||
|
|
||
| contract AaveV4AccessBatch is AaveV4AccessManagerEnumerableDeployProcedure { | ||
| BatchReports.AccessBatchReport internal _report; | ||
|
|
||
| constructor(address admin_) { | ||
|
||
| address accessManagerAddress = _deployAccessManagerEnumerable(admin_); | ||
| _report = BatchReports.AccessBatchReport({accessManagerAddress: accessManagerAddress}); | ||
| } | ||
|
|
||
| function getReport() external view returns (BatchReports.AccessBatchReport memory) { | ||
| return _report; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {BatchReports} from 'src/deployments/libraries/BatchReports.sol'; | ||
| import {AaveV4HubConfiguratorDeployProcedure} from 'src/deployments/procedures/deploy/AaveV4HubConfiguratorDeployProcedure.sol'; | ||
| import {AaveV4SpokeConfiguratorDeployProcedure} from 'src/deployments/procedures/deploy/AaveV4SpokeConfiguratorDeployProcedure.sol'; | ||
|
|
||
| contract AaveV4ConfiguratorBatch is | ||
| AaveV4HubConfiguratorDeployProcedure, | ||
| AaveV4SpokeConfiguratorDeployProcedure | ||
| { | ||
| BatchReports.ConfiguratorBatchReport internal _report; | ||
|
|
||
| constructor(address admin_) { | ||
| address hubConfiguratorAddress = _deployHubConfigurator(admin_); | ||
| address spokeConfiguratorAddress = _deploySpokeConfigurator(admin_); | ||
|
|
||
| _report = BatchReports.ConfiguratorBatchReport({ | ||
| hubConfiguratorAddress: hubConfiguratorAddress, | ||
| spokeConfiguratorAddress: spokeConfiguratorAddress | ||
| }); | ||
| } | ||
|
|
||
| function getReport() external view returns (BatchReports.ConfiguratorBatchReport memory) { | ||
| return _report; | ||
| } | ||
|
Comment on lines
29
to
37
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have getReport bc it's deployed in the constructor? (constructor can return data, but through assembly)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only see issue of initcode vs code size issue for spoke, and since this contract isn't deployed it should be ok i think - we can leverage a lib returning construction code and pass to a standard create2 factory
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this follows v3 style of the batched contract files for deployment, where constructors deploy the contracts and getReport method to retrieve the data. ig in this style we can retrieve the report in other places, vs a stateless lib. wdyt @miguelmtzinf ? |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {BatchReports} from 'src/deployments/libraries/BatchReports.sol'; | ||
| import { | ||
| AaveV4NativeTokenGatewayDeployProcedure | ||
| } from 'src/deployments/procedures/deploy/AaveV4NativeTokenGatewayDeployProcedure.sol'; | ||
| import { | ||
| AaveV4SignatureGatewayDeployProcedure | ||
| } from 'src/deployments/procedures/deploy/AaveV4SignatureGatewayDeployProcedure.sol'; | ||
|
|
||
| contract AaveV4GatewayBatch is | ||
| AaveV4NativeTokenGatewayDeployProcedure, | ||
| AaveV4SignatureGatewayDeployProcedure | ||
| { | ||
| BatchReports.GatewaysBatchReport internal _report; | ||
|
|
||
| constructor(address admin_, address nativeWrapper_) { | ||
| address nativeGatewayAddress; | ||
| if (nativeWrapper_ != address(0)) { | ||
| nativeGatewayAddress = _deployNativeTokenGateway(nativeWrapper_, admin_); | ||
yan-man marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| address signatureGatewayAddress = _deploySignatureGateway(admin_); | ||
|
|
||
| _report = BatchReports.GatewaysBatchReport({ | ||
| nativeGatewayAddress: nativeGatewayAddress, | ||
| signatureGatewayAddress: signatureGatewayAddress | ||
| }); | ||
| } | ||
|
|
||
| function getReport() external view returns (BatchReports.GatewaysBatchReport memory) { | ||
| return _report; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {BatchReports} from 'src/deployments/libraries/BatchReports.sol'; | ||
| import {AaveV4HubDeployProcedure} from 'src/deployments/procedures/deploy/AaveV4HubDeployProcedure.sol'; | ||
| import {AaveV4InterestRateStrategyDeployProcedure} from 'src/deployments/procedures/deploy/AaveV4InterestRateStrategyDeployProcedure.sol'; | ||
| import {AaveV4TreasurySpokeDeployProcedure} from 'src/deployments/procedures/deploy/AaveV4TreasurySpokeDeployProcedure.sol'; | ||
|
|
||
| contract AaveV4HubBatch is | ||
| AaveV4HubDeployProcedure, | ||
| AaveV4InterestRateStrategyDeployProcedure, | ||
| AaveV4TreasurySpokeDeployProcedure | ||
| { | ||
| BatchReports.HubBatchReport internal _report; | ||
|
|
||
| constructor(address admin_, address accessManagerAddress_) { | ||
| address hubAddress = _deployHub(accessManagerAddress_); | ||
| address irStrategyAddress = _deployInterestRateStrategy(hubAddress); | ||
| address treasurySpokeAddress = _deployTreasurySpoke(admin_, hubAddress); | ||
|
|
||
| _report = BatchReports.HubBatchReport({ | ||
| hubAddress: hubAddress, | ||
| irStrategyAddress: irStrategyAddress, | ||
| treasurySpokeAddress: treasurySpokeAddress | ||
| }); | ||
| } | ||
|
|
||
| function getReport() external view returns (BatchReports.HubBatchReport memory) { | ||
| return _report; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {BatchReports} from 'src/deployments/libraries/BatchReports.sol'; | ||
| import { | ||
| AaveV4SpokeInstanceDeployProcedure | ||
| } from 'src/deployments/procedures/deploy/AaveV4SpokeInstanceDeployProcedure.sol'; | ||
| import { | ||
| AaveV4TransparentUpgradeableProxyDeployProcedure | ||
| } from 'src/deployments/procedures/deploy/AaveV4TransparentUpgradeableProxyDeployProcedure.sol'; | ||
| import { | ||
| AaveV4AaveOracleDeployProcedure | ||
| } from 'src/deployments/procedures/deploy/AaveV4AaveOracleDeployProcedure.sol'; | ||
| import {Utils} from 'src/deployments/utils/libraries/Utils.sol'; | ||
|
|
||
| contract AaveV4SpokeInstanceBatch is | ||
| AaveV4SpokeInstanceDeployProcedure, | ||
| AaveV4TransparentUpgradeableProxyDeployProcedure, | ||
| AaveV4AaveOracleDeployProcedure | ||
| { | ||
| BatchReports.SpokeInstanceBatchReport internal _report; | ||
|
|
||
| constructor( | ||
| address admin_, | ||
| address accessManagerAddress_, | ||
| uint8 oracleDecimals_, | ||
| string memory oracleDescription_ | ||
| ) { | ||
| // additional 3 nonces for AaveOracle, SpokeInstance, and TransparentUpgradeableProxy | ||
|
||
| address predictedSpokeInstanceAddress = Utils.computeCreateAddress(address(this), 3); | ||
|
|
||
| address aaveOracleAddress = _deployAaveOracle( | ||
| predictedSpokeInstanceAddress, | ||
| oracleDecimals_, | ||
| oracleDescription_ | ||
| ); | ||
| address spokeImplementationAddress = _deploySpokeInstance(aaveOracleAddress); | ||
| address spokeProxyAddress = _proxify( | ||
| spokeImplementationAddress, | ||
| admin_, | ||
| abi.encodeWithSignature('initialize(address)', accessManagerAddress_) | ||
yan-man marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ); | ||
|
|
||
| require(spokeProxyAddress == predictedSpokeInstanceAddress, 'SpokeInstance address mismatch'); | ||
yan-man marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| _report = BatchReports.SpokeInstanceBatchReport({ | ||
| aaveOracleAddress: aaveOracleAddress, | ||
| spokeImplementationAddress: spokeImplementationAddress, | ||
| spokeProxyAddress: spokeProxyAddress | ||
| }); | ||
| } | ||
|
|
||
| function getReport() external view returns (BatchReports.SpokeInstanceBatchReport memory) { | ||
| return _report; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| library BatchReports { | ||
| struct AccessBatchReport { | ||
| address accessManagerAddress; | ||
| } | ||
|
|
||
| struct ConfiguratorBatchReport { | ||
| address hubConfiguratorAddress; | ||
| address spokeConfiguratorAddress; | ||
| } | ||
|
|
||
| struct SpokeInstanceBatchReport { | ||
| address spokeImplementationAddress; | ||
| address spokeProxyAddress; | ||
| address aaveOracleAddress; | ||
| } | ||
|
|
||
| struct HubBatchReport { | ||
| address hubAddress; | ||
| address irStrategyAddress; | ||
| address treasurySpokeAddress; | ||
| } | ||
|
|
||
| struct GatewaysBatchReport { | ||
| address signatureGatewayAddress; | ||
| address nativeGatewayAddress; | ||
| } | ||
|
|
||
| struct TestTokensBatchReport { | ||
yan-man marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| address wethAddress; | ||
| address[] tokenAddresses; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.