Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8bafe86
feat : procedures to deploy contracts
Kogaroshi Nov 3, 2025
d95101b
feat : add batch contracts for deploy
Kogaroshi Nov 5, 2025
00ba92a
feat : add Logger for Deploy Engine
Kogaroshi Nov 5, 2025
9f6c70d
feat : Input helper for Deploy Engine
Kogaroshi Nov 5, 2025
4a51e33
Merge branch 'main' of https://github.com/aave/aave-v4 into feat/payl…
Kogaroshi Nov 7, 2025
cecd4f3
feat : add orchestration methods & 1st draft deploy payload
Kogaroshi Nov 7, 2025
460c2e0
fix : separate batch for configurators
Kogaroshi Nov 10, 2025
2aaeb00
feat : roles procedures & small fixes
Kogaroshi Nov 10, 2025
4581387
feat : test env orchestration (WIP)
Kogaroshi Nov 11, 2025
b94ed13
fix : fix errors test env orchestration
Kogaroshi Nov 11, 2025
3ba9fad
Merge branch 'main' of https://github.com/aave/aave-v4 into feat/payl…
Kogaroshi Nov 12, 2025
e455afb
fix : apply latest main changes
Kogaroshi Nov 12, 2025
00433e9
feat : procedures for Hub & Spoke configs setup (WIP)
Kogaroshi Nov 12, 2025
945619f
feat : finish test config engine & reorder structs
Kogaroshi Nov 13, 2025
8680dd6
fix : fix Licenses for payload engine
Kogaroshi Nov 14, 2025
21033d1
feat : use orchestration in test setup (WIP)
Kogaroshi Nov 14, 2025
5304e6c
pull latest from main
Kogaroshi Dec 1, 2025
9545217
fix : missing action
Kogaroshi Dec 1, 2025
4d36444
fix: clean up file paths; refactor
yan-man Dec 2, 2025
a951c30
feat: use toml; clean up logs; rft; naming
yan-man Dec 3, 2025
384aeef
fix: StdToml import
yan-man Dec 3, 2025
ac1dc8a
fix: debug mismatch of spoke instance
yan-man Dec 4, 2025
1fd5830
tmp: push deploy progress w output json
yan-man Dec 5, 2025
dd459c1
fix: min logger interface; mv input toml file; resolve computeCreated…
yan-man Dec 5, 2025
11be630
rft: DeployCore lib
yan-man Dec 5, 2025
7b16818
rft: metadata logger
yan-man Dec 5, 2025
8f7d6f7
feat: include timestamp in log output
yan-man Dec 5, 2025
63c93f9
fix: debug set roles
yan-man Dec 5, 2025
e38a93c
fix: clean up comments
yan-man Dec 5, 2025
563f04f
feat: broadcast flag; BatchTestProcedures tests
yan-man Dec 6, 2025
a455a57
test: batch deployment
yan-man Dec 6, 2025
e3642d3
fix: move test files
yan-man Dec 6, 2025
b06da1a
fix: CI
yan-man Dec 6, 2025
05c0dc0
fix: comments
yan-man Dec 6, 2025
d5affff
fix: CI
yan-man Dec 6, 2025
265a3a7
fix: CI
yan-man Dec 6, 2025
8d4cef0
fix: clean up;
yan-man Dec 6, 2025
beea923
fix: CI; move back to json
yan-man Dec 6, 2025
31509cf
fix: clean up logger
yan-man Dec 6, 2025
ac59e59
fix: lint
yan-man Dec 6, 2025
a224fe8
rft: hub/spoke roles + tests
yan-man Dec 8, 2025
17db1f2
feat: loadWarnings; abstract contract; zero addr native wrapper case
yan-man Dec 8, 2025
c49467f
fix: warnings
yan-man Dec 8, 2025
65b44c9
fix: consolidate setting roles
yan-man Dec 8, 2025
25a3ae4
feat: grantRoles bool; conditional test logic
yan-man Dec 9, 2025
e597f1c
rft: test suite setup
yan-man Dec 12, 2025
6c5c0b5
fix: rename roles for clarity
yan-man Dec 13, 2025
70e4501
fix: specify admin inputs
yan-man Dec 13, 2025
8f14c51
fix: AaveV4DeployBatchScript configurable inputs
yan-man Dec 13, 2025
e7f4ea5
fix: user warnings prompt
yan-man Dec 13, 2025
f6787b9
test: computeCreateAddress; pr comments
yan-man Dec 13, 2025
27260d0
fix: pr comments; re-order imports
yan-man Dec 13, 2025
8c26cf3
test: fix
yan-man Dec 13, 2025
0ad7618
fix: pr comments
yan-man Dec 16, 2025
198fc50
fix: rm named arg
yan-man Dec 16, 2025
5b13830
fix: pr comments
yan-man Dec 17, 2025
4358d33
fix: rename validation func
yan-man Dec 17, 2025
b3cf5e5
fix: func names
yan-man Dec 17, 2025
92eab04
test: AaveV4DeployBatchBaseScriptTest
yan-man Dec 17, 2025
d851888
fix: create2 factory; expand and clean up tests
yan-man Dec 17, 2025
5492653
chore: clean up logging
yan-man Dec 17, 2025
90f133f
fix: pragma consistency; errors
yan-man Dec 19, 2025
b8acf9c
fix: pr comments
yan-man Dec 20, 2025
7a82a0b
fix: tmp fix for CI
yan-man Dec 20, 2025
dfe4808
test: resolve
yan-man Dec 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 22 additions & 36 deletions scripts/deploy/AaveV4DeployBatchBase.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ abstract contract AaveV4DeployBatchBaseScript is Script, InputUtils {
(, address deployer, ) = vm.readCallers();
inputs = _loadWarningsAndSanitizeInputs(logger, inputs, deployer);

logger.log('CHAIN ID = ', block.chainid);
logger.log('...Starting Aave V4 Batch Deployment...');
vm.startBroadcast(deployer);
OrchestrationReports.FullDeploymentReport memory report = AaveV4DeployOrchestration
Expand All @@ -52,84 +53,69 @@ abstract contract AaveV4DeployBatchBaseScript is Script, InputUtils {
FullDeployInputs memory inputs,
address deployer
) internal virtual returns (FullDeployInputs memory) {
string memory header = 'WARNING: ';
string memory message = ' is zero address';
string memory outcome = '; defaulting to deployer';

FullDeployInputs memory sanitizedInputs = inputs;
bool hadWarnings = false;
if (inputs.grantRoles) {
_logAndAppend(logger, 'WARNING: Roles are being set');
_logAndAppend(logger, string.concat(header, 'Roles are being set'));
hadWarnings = true;
if (inputs.accessManagerAdmin == address(0)) {
_logAndAppend(
logger,
'WARNING: Access Manager Admin is zero address; role will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Access Manager Admin', message, outcome));
sanitizedInputs.accessManagerAdmin = deployer;
}
if (inputs.hubConfiguratorOwner == address(0)) {
_logAndAppend(
logger,
'WARNING: Hub Configurator Owner is zero address; role will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Hub Configurator Owner', message, outcome));
sanitizedInputs.hubConfiguratorOwner = deployer;
}
if (inputs.spokeConfiguratorOwner == address(0)) {
_logAndAppend(
logger,
'WARNING: Spoke Configurator Owner is zero address; role will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Spoke Configurator Owner', message, outcome));
sanitizedInputs.spokeConfiguratorOwner = deployer;
}
if (inputs.spokeProxyAdminOwner == address(0)) {
_logAndAppend(
logger,
'WARNING: Spoke Proxy Admin Owner is zero address; role will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Spoke Proxy Admin Owner', message, outcome));
sanitizedInputs.spokeProxyAdminOwner = deployer;
}
if (inputs.treasurySpokeOwner == address(0)) {
_logAndAppend(
logger,
'WARNING: Treasury Spoke Owner is zero address; role will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Treasury Spoke Owner', message, outcome));
sanitizedInputs.treasurySpokeOwner = deployer;
}
if (inputs.spokeAdmin == address(0)) {
_logAndAppend(
logger,
'WARNING: Spoke Admin is zero address; spoke admin roles will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Spoke Admin', message, outcome));
sanitizedInputs.spokeAdmin = deployer;
}
if (inputs.hubAdmin == address(0)) {
_logAndAppend(
logger,
'WARNING: Hub Admin is zero address; hub admin roles will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Hub Admin', message, outcome));
sanitizedInputs.hubAdmin = deployer;
}
}
if (inputs.hubLabels.length == 0) {
_logAndAppend(logger, 'WARNING: Hub will not be deployed');
_logAndAppend(logger, string.concat(header, 'Hub will not be deployed'));
hadWarnings = true;
sanitizedInputs.hubLabels = new string[](0);
}
if (inputs.spokeLabels.length == 0) {
_logAndAppend(logger, 'WARNING: Spoke will not be deployed');
_logAndAppend(logger, string.concat(header, 'Spoke will not be deployed'));
hadWarnings = true;
sanitizedInputs.spokeLabels = new string[](0);
}
if (inputs.nativeWrapper == address(0)) {
_logAndAppend(
logger,
'WARNING: Native wrapper zero address; NativeTokenGateway & SignatureGateway will not be deployed'
string.concat(
header,
'Native wrapper',
message,
"; NativeTokenGateway & SignatureGateway will not be deployed'"
)
);
hadWarnings = true;
sanitizedInputs.nativeWrapper = address(0);
}
if (inputs.gatewayOwner == address(0)) {
_logAndAppend(
logger,
'WARNING: Gateway owner zero address; role will be granted to deployer by default'
);
_logAndAppend(logger, string.concat(header, 'Gateway owner', message, outcome));
hadWarnings = true;
sanitizedInputs.gatewayOwner = deployer;
}
Expand Down
2 changes: 1 addition & 1 deletion snapshots/Hub.Operations.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are they changing? foundry version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no foundry version update. was trying to dig into this but couldnt id exactly why, base set up was just refactored.

Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"restore: full - with transfer": "173415",
"restore: partial": "89137",
"restore: partial - with transfer": "147439",
"transferShares": "71180"
"transferShares": "71192"
}
4 changes: 2 additions & 2 deletions snapshots/SignatureGateway.Operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"borrowWithSig": "215605",
"repayWithSig": "188872",
"setSelfAsUserPositionManagerWithSig": "75402",
"setUsingAsCollateralWithSig": "85053",
"setUsingAsCollateralWithSig": "85065",
"supplyWithSig": "153205",
"updateUserDynamicConfigWithSig": "62769",
"updateUserRiskPremiumWithSig": "61579",
"withdrawWithSig": "131696"
"withdrawWithSig": "131686"
}
2 changes: 1 addition & 1 deletion snapshots/Spoke.Operations.ZeroRiskPremium.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"liquidationCall: full": "310468",
"liquidationCall: partial": "310186",
"permitReserve + repay (multicall)": "166029",
"permitReserve + supply (multicall)": "146850",
"permitReserve + supply (multicall)": "146862",
"permitReserve + supply + enable collateral (multicall)": "160573",
"repay: full": "126094",
"repay: partial": "130983",
Expand Down
2 changes: 1 addition & 1 deletion snapshots/Spoke.Operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"liquidationCall: full": "344031",
"liquidationCall: partial": "343749",
"permitReserve + repay (multicall)": "163273",
"permitReserve + supply (multicall)": "146850",
"permitReserve + supply (multicall)": "146862",
"permitReserve + supply + enable collateral (multicall)": "160573",
"repay: full": "120256",
"repay: partial": "139545",
Expand Down
18 changes: 12 additions & 6 deletions src/deployments/batches/AaveV4SpokeInstanceBatch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
pragma solidity ^0.8.0;

import {BatchReports} from 'src/deployments/libraries/BatchReports.sol';
import {Utils} from 'src/deployments/utils/libraries/Utils.sol';
import {
AaveV4AaveOracleDeployProcedure
} from 'src/deployments/procedures/deploy/spoke/AaveV4AaveOracleDeployProcedure.sol';
import {
AaveV4SpokeDeployProcedure
} from 'src/deployments/procedures/deploy/spoke/AaveV4SpokeDeployProcedure.sol';
import {Create2Utils} from 'src/deployments/utils/libraries/Create2Utils.sol';

import {ISpoke} from 'src/spoke/interfaces/ISpoke.sol';
import {IAaveOracle} from 'src/spoke/interfaces/IAaveOracle.sol';
Expand All @@ -23,11 +23,16 @@ contract AaveV4SpokeInstanceBatch is AaveV4SpokeDeployProcedure, AaveV4AaveOracl
uint8 oracleDecimals_,
string memory oracleDescription_
) {
// additional 2 nonces for AaveOracle, SpokeInstance, starting from contract nonce of 1
address predictedSpokeInstance = Utils.computeCreateAddress(address(this), 3);

// starting from contract nonce of 1
address predictedOracle = Create2Utils.computeCreateAddress(address(this), 1);
address predictedSpokeProxy = _computeSpokeInstanceAddress(
SALT,
predictedOracle,
spokeProxyAdminOwner_,
accessManager_
);
address aaveOracle = _deployAaveOracle(
predictedSpokeInstance,
predictedSpokeProxy,
oracleDecimals_,
oracleDescription_
);
Expand All @@ -37,7 +42,8 @@ contract AaveV4SpokeInstanceBatch is AaveV4SpokeDeployProcedure, AaveV4AaveOracl
oracle: aaveOracle
});

require(spokeProxy == predictedSpokeInstance, InvalidParam('predicted spoke instance'));
require(aaveOracle == predictedOracle, InvalidParam('predicted oracle'));
require(spokeProxy == predictedSpokeProxy, InvalidParam('predicted spoke instance'));
require(ISpoke(spokeProxy).ORACLE() == aaveOracle, InvalidParam('spoke oracle'));
require(IAaveOracle(aaveOracle).SPOKE() == spokeProxy, InvalidParam('aave oracle spoke'));

Expand Down
3 changes: 3 additions & 0 deletions src/deployments/procedures/AaveV4DeployProcedureBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
// Copyright (c) 2025 Aave Labs
pragma solidity ^0.8.0;

import {Create2Utils} from 'src/deployments/utils/libraries/Create2Utils.sol';
contract AaveV4DeployProcedureBase {
error InvalidParam(string errorMessage);

bytes32 public constant SALT = bytes32('v1');
function _validateZeroAddress(address addr, string memory errorMessage) internal pure {
require(addr != address(0), InvalidParam(errorMessage));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
pragma solidity ^0.8.0;

import {HubConfigurator} from 'src/hub/HubConfigurator.sol';
import {AaveV4DeployProcedureBase} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
import {
Create2Utils,
AaveV4DeployProcedureBase
} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
contract AaveV4HubConfiguratorDeployProcedure is AaveV4DeployProcedureBase {
function _deployHubConfigurator(address owner) internal returns (address) {
_validateZeroAddress(owner, 'owner');
return address(new HubConfigurator({owner_: owner}));
return
Create2Utils.create2Deploy(
SALT,
abi.encodePacked(type(HubConfigurator).creationCode, abi.encode(owner))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
pragma solidity ^0.8.0;

import {Hub} from 'src/hub/Hub.sol';
import {AaveV4DeployProcedureBase} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
import {
Create2Utils,
AaveV4DeployProcedureBase
} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
contract AaveV4HubDeployProcedure is AaveV4DeployProcedureBase {
function _deployHub(address accessManager) internal returns (address) {
_validateZeroAddress(accessManager, 'access manager');
return address(new Hub({authority_: accessManager}));
return
Create2Utils.create2Deploy(
SALT,
abi.encodePacked(type(Hub).creationCode, abi.encode(accessManager))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
pragma solidity ^0.8.0;

import {AssetInterestRateStrategy} from 'src/hub/AssetInterestRateStrategy.sol';
import {AaveV4DeployProcedureBase} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
import {
Create2Utils,
AaveV4DeployProcedureBase
} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
contract AaveV4InterestRateStrategyDeployProcedure is AaveV4DeployProcedureBase {
function _deployInterestRateStrategy(address hub) internal returns (address) {
require(hub != address(0), InvalidParam('hub'));
return address(new AssetInterestRateStrategy({hub_: hub}));
return
Create2Utils.create2Deploy(
SALT,
abi.encodePacked(type(AssetInterestRateStrategy).creationCode, abi.encode(hub))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
pragma solidity ^0.8.0;

import {NativeTokenGateway} from 'src/position-manager/NativeTokenGateway.sol';
import {AaveV4DeployProcedureBase} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
import {
Create2Utils,
AaveV4DeployProcedureBase
} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
contract AaveV4NativeTokenGatewayDeployProcedure is AaveV4DeployProcedureBase {
function _deployNativeTokenGateway(
address nativeWrapper,
address owner
) internal returns (address) {
_validateZeroAddress(nativeWrapper, 'native wrapper');
_validateZeroAddress(owner, 'owner');
return address(new NativeTokenGateway({nativeWrapper_: nativeWrapper, initialOwner_: owner}));
return
Create2Utils.create2Deploy(
SALT,
abi.encodePacked(type(NativeTokenGateway).creationCode, abi.encode(nativeWrapper, owner))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
pragma solidity ^0.8.0;

import {SignatureGateway} from 'src/position-manager/SignatureGateway.sol';
import {AaveV4DeployProcedureBase} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
import {
Create2Utils,
AaveV4DeployProcedureBase
} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
contract AaveV4SignatureGatewayDeployProcedure is AaveV4DeployProcedureBase {
function _deploySignatureGateway(address owner) internal returns (address) {
_validateZeroAddress(owner, 'owner');
return address(new SignatureGateway({initialOwner_: owner}));
return
Create2Utils.create2Deploy(
SALT,
abi.encodePacked(type(SignatureGateway).creationCode, abi.encode(owner))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ contract AaveV4AaveOracleDeployProcedure is AaveV4DeployProcedureBase {
_validateZeroAddress(spoke_, 'spoke');
require(decimals_ > 0, InvalidParam('oracle decimals'));
require(bytes(description_).length > 0, InvalidParam('oracle description'));
// AaveOracle must be deployed via create to compute the predicted address via without inputs
return
address(new AaveOracle({spoke_: spoke_, decimals_: decimals_, description_: description_}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
pragma solidity ^0.8.0;

import {SpokeConfigurator} from 'src/spoke/SpokeConfigurator.sol';
import {AaveV4DeployProcedureBase} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';
import {
Create2Utils,
AaveV4DeployProcedureBase
} from 'src/deployments/procedures/AaveV4DeployProcedureBase.sol';

contract AaveV4SpokeConfiguratorDeployProcedure is AaveV4DeployProcedureBase {
function _deploySpokeConfigurator(address owner) internal returns (address) {
_validateZeroAddress(owner, 'owner');
return address(new SpokeConfigurator({owner_: owner}));
return
Create2Utils.create2Deploy(
SALT,
abi.encodePacked(type(SpokeConfigurator).creationCode, abi.encode(owner))
);
}
}
Loading
Loading