Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 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
3fa2a73
chore : pull latest from main & start fixing conflicts and required c…
Kogaroshi Feb 10, 2026
637c139
fix : working on conflicts and required changes (WIP)
Kogaroshi Feb 10, 2026
8165e46
fix: resolve conflicts, clean up configurator roles
yan-man Feb 11, 2026
7573b81
fix : fix CI issue & some cleanup
Kogaroshi Feb 11, 2026
9445bb6
test: batch, procedures
yan-man Feb 11, 2026
518971b
feat: tokenization spoke deploy procedures (#1211)
yan-man Feb 12, 2026
3789ce4
feat: deployment eng progress
yan-man Feb 18, 2026
3a057e8
Merge branch 'main' into rft/payload-engine
yan-man Feb 18, 2026
2b35512
fix: pr comments
yan-man Feb 21, 2026
149a81a
Merge branch 'main' into rft/payload-engine
yan-man Feb 28, 2026
50f0a42
fix: pr comments
yan-man Mar 4, 2026
23964ce
chore: gas snapshot
yan-man Mar 4, 2026
afc2168
chore: cleanup; pr comments
yan-man Mar 4, 2026
c050e9c
Merge branch 'main' into rft/payload-engine
yan-man Mar 11, 2026
a1af515
fix: incorporate downstream changes from hub-agnostic treasury spoke
yan-man Mar 11, 2026
6d6ef93
fix: incorporate granular roles
yan-man Mar 11, 2026
44ea7b3
fix: add salt to report; update readme
yan-man Mar 11, 2026
a501cfb
fix: pr comments; deploy posms
yan-man Mar 12, 2026
27b2654
fix : make spoke oracle decimals constant in deploy engine
Kogaroshi Mar 12, 2026
5b276ef
feat : add Config posm to deploy engine
Kogaroshi Mar 12, 2026
d480e61
fix: read oracle decimals from constants; resolve tests
yan-man Mar 12, 2026
2bf3084
chore: reorder metadata logger (#1265)
DhairyaSethi Mar 12, 2026
a769e80
fix: default for max reserves limit
yan-man Mar 12, 2026
27fed29
fix: readCaller flow; lowercase logs
yan-man Mar 12, 2026
e0415e4
fix: resolve tests; rm chain field; abstract helper
yan-man Mar 12, 2026
7df7cf5
fix: incorporate deployer addr into salt; named args; import cleanup;…
yan-man Mar 13, 2026
f50372f
test: resolve hub configurator
yan-man Mar 13, 2026
1927ec5
Merge branch 'main' into rft/payload-engine
yan-man Mar 16, 2026
220e04a
fix: rm unneeded imports; readme; ordering of roles grant/setup; clea…
yan-man Mar 16, 2026
cddcab6
feat : deploy & config verification script
Kogaroshi Mar 13, 2026
b527ed7
fix : make script faster
Kogaroshi Mar 16, 2026
ac8a4c5
Merge branch 'rft/payload-engine' of github.com:aave/aave-v4 into fea…
Kogaroshi Mar 16, 2026
535e33b
feat : add more verifications
Kogaroshi Mar 16, 2026
b85a762
test: cov for hub roles procedure; rm warnings; debug dyn res
yan-man Mar 17, 2026
d38d5fb
feat: upgradeable hub
DhairyaSethi Mar 17, 2026
3c354be
fix: authority went from 0 to namespace storage
DhairyaSethi Mar 17, 2026
771996b
chore: fix import order
DhairyaSethi Mar 17, 2026
80dd213
chore: fix assume
DhairyaSethi Mar 17, 2026
1889a34
test: hub upgradeability
DhairyaSethi Mar 17, 2026
21a34ef
chore: cleanup
DhairyaSethi Mar 17, 2026
3cef969
fix: update roles to rm granularity initially
yan-man Mar 17, 2026
8aef158
test: add assertions on hub; extend to spoke
yan-man Mar 17, 2026
48d8363
chore: rm space
yan-man Mar 17, 2026
135677e
Merge remote-tracking branch 'origin/feat/upgradeable-hub' into rft/p…
yan-man Mar 17, 2026
c2b0db8
fix: resolve changes to upgradable hub
yan-man Mar 17, 2026
05a8258
test: zero hub proxy admin
yan-man Mar 17, 2026
dc43a0c
feat: log granted roles
yan-man Mar 18, 2026
ee74ceb
test: migrate multi hub tests to orchestration setup
yan-man Mar 18, 2026
2488b76
test: use interface for ir strat
yan-man Mar 18, 2026
119f026
test: setups using orchestration
yan-man Mar 18, 2026
a7d504d
fix: pr comments
yan-man Mar 18, 2026
ceadd86
fix: finalize migration to test orch
yan-man Mar 18, 2026
3deda23
Merge branch 'feat/upgradeable-hub' into rft/payload-engine
yan-man Mar 18, 2026
1964598
fix: rm deploySpoke
yan-man Mar 18, 2026
7b2c703
feat: multilayer json output for hubs/spokes on proxy/iml
yan-man Mar 18, 2026
c5819d8
fix: invalid caller test
DhairyaSethi Mar 18, 2026
04d1e76
Merge remote-tracking branch 'origin/feat/upgradeable-hub' into rft/p…
DhairyaSethi Mar 18, 2026
a4e7abb
chore: revert nested labels
DhairyaSethi Mar 18, 2026
9a8a84b
chore: cleanup
DhairyaSethi Mar 18, 2026
b2a798d
chore: cleanup
yan-man Mar 18, 2026
1236445
feat: bytecode helper; demo deploy script; fork tests post-deploy; pr…
yan-man Mar 18, 2026
aa7bb17
test: expand post deployment tests; skip ones excluded from report
yan-man Mar 19, 2026
c4872d0
chore: prettier
yan-man Mar 19, 2026
98e9fcb
chore: prettier
yan-man Mar 19, 2026
8a4af97
test: skip the demo anvil test
yan-man Mar 19, 2026
3b3140c
fix: readme, proxyAdminOwner check
yan-man Mar 20, 2026
8c82d38
pull latest from main
Kogaroshi Mar 20, 2026
79d3f80
fix : add liq logic verif
Kogaroshi Mar 20, 2026
29b024a
Merge branch 'rft/payload-engine' of github.com:aave/aave-v4 into fea…
Kogaroshi Mar 20, 2026
56db970
fix : more verifications & add tokenization-deploy verif
Kogaroshi Mar 20, 2026
6bd8fdd
feat : add more verification steps
Kogaroshi Mar 23, 2026
32a8047
fix : merge conflicts
Kogaroshi Mar 23, 2026
929c473
feat : role label verifications
Kogaroshi Mar 23, 2026
ca4dc6b
feat : extra script for 1st part of deploy
Kogaroshi Mar 23, 2026
eff8e74
feat : more verification tools & use xlsx file for config settings
Kogaroshi Mar 24, 2026
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Deployment
ACCOUNT=deployer
DRY=true # leave blank to broadcast

# Test rpc_endpoints
RPC_MAINNET=https://eth.llamarpc.com
RPC_AVALANCHE=https://api.avax.network/ext/bc/C/rpc
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ report/

.DS_Store
.venv/

output/
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,18 @@ coverage :
make coverage-clean
make coverage-report
make coverage-badge

# Deployment
# Step 1:Pre-deploy LiquidationLogic library (required before deploying spokes)
# `make deploy-precompile CHAIN=mainnet`
deploy-precompile :;
FOUNDRY_PROFILE=${CHAIN} forge clean && forge script scripts/LibraryPreCompile.s.sol \
--rpc-url ${CHAIN} --account ${ACCOUNT} --ffi \
$(if ${DRY},, --broadcast --verify) \

# Step 2: Deploy contracts + grant roles to deployer
# `make deploy-contracts CHAIN=mainnet`
deploy-contracts :;
FOUNDRY_PROFILE=${CHAIN} forge clean && forge script scripts/deploy/AaveV4DeployBatch.s.sol:AaveV4DeployBatchScript \
--rpc-url ${CHAIN} --account ${ACCOUNT} --slow \
$(if ${DRY},, --broadcast --verify) \
10 changes: 9 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ src = 'src'
test = 'tests'
out = 'out'
libs = ['lib']
fs_permissions = [{ access = "read", path = "tests/mocks/JsonBindings.sol" }]
fs_permissions = [
{ access = "read", path = "tests/mocks/JsonBindings.sol" },
{ access = "read", path = "./config" },
{ access = "read", path = "./out" },
{ access = "read-write", path = "./output" }
]
skip = ["tests/mocks/JsonBindings.sol"]
solc_version = "0.8.28"
evm_version = "cancun"
Expand Down Expand Up @@ -49,6 +54,8 @@ gas_snapshot_check = true
test = 'tests/gas'
isolate = true

[profile.anvil]

[profile.coverage]
optimizer = true
optimizer_runs = 444444444444
Expand All @@ -71,6 +78,7 @@ zkevm = "${RPC_ZKEVM}"
gnosis = "${RPC_GNOSIS}"
bnb = "${RPC_BNB}"
celo = "${RPC_CELO}"
anvil = "http://127.0.0.1:8545"

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY_MAINNET}", chainId = 1 }
Expand Down
46 changes: 46 additions & 0 deletions scripts/LibraryPreCompile.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2025 Aave Labs
pragma solidity ^0.8.0;

import {Script} from 'forge-std/Script.sol';
import {console2 as console} from 'forge-std/console2.sol';
import {SpokeDeployUtils} from 'scripts/SpokeDeployUtils.sol';

/**
* @dev Deploy LiquidationLogic library using CREATE2 and save the output
* to FOUNDRY_LIBRARIES env variable in .env file.
* This preprocessing step is required before running the main Deploy script,
* as SpokeInstance depends on LiquidationLogic as an external library.
*
* The script will ask you to re-execute if FOUNDRY_LIBRARIES is set but the
* library is not deployed, due to setting mutation of bytecode that could
* result in different library addresses.
*
* Usage:
* forge script scripts/LibraryPreCompile.s.sol --broadcast --fork-url $RPC --ffi
*/
contract LibraryPreCompile is Script {
function run() external {
bool found = SpokeDeployUtils._librariesPathExists();

if (found) {
address lastLib = SpokeDeployUtils._getLiquidationLogicAddress();
if (lastLib.code.length > 0) {
console.log('[LibraryPreCompile] LiquidationLogic detected. Skipping re-deployment.');
return;
} else {
SpokeDeployUtils._deleteLibrariesPath();
console.log(
'LibraryPreCompile: FOUNDRY_LIBRARIES was detected and removed. Please run again to deploy library with a fresh compilation.'
);
revert('RETRY AGAIN');
}
}

vm.startBroadcast();
SpokeDeployUtils._deployAndWriteLibrariesConfig();
vm.stopBroadcast();

console.log('LibraryPreCompile: FOUNDRY_LIBRARIES set. Run the main deploy script.');
}
}
108 changes: 108 additions & 0 deletions scripts/SpokeDeployUtils.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2025 Aave Labs
pragma solidity ^0.8.0;

import {Vm} from 'forge-std/Vm.sol';
import {Create2Utils} from 'src/deployments/utils/libraries/Create2Utils.sol';

/// @title SpokeDeployUtils
/// @notice Utilities for deploying LiquidationLogic as an external library.
/// @dev LiquidationLogic must be deployed before SpokeInstance because SpokeInstance
/// is compiled with via-ir and has references to the library.
/// 1. Run LibraryPreCompile.s.sol to deploy library, writes FOUNDRY_LIBRARIES to .env
/// 2. Run the main deploy script to link via FOUNDRY_LIBRARIES
library SpokeDeployUtils {
Vm internal constant vm = Vm(address(uint160(uint256(keccak256('hevm cheat code')))));

// ==================== Library Deployment ====================

/// @notice Deploys LiquidationLogic via CREATE2 with salt=0.
/// @dev The CREATE2 factory must already be deployed on the target chain.
/// For Anvil, etch it beforehand (see scripts/deploy/AaveV4DeployBatchAnvil.s.sol).
/// @return The deployed library address.
function deployLiquidationLogic() internal returns (address) {
bytes memory bytecode = vm.getCode('src/spoke/libraries/LiquidationLogic.sol:LiquidationLogic');
return Create2Utils.create2Deploy(bytes32(0), bytecode);
}

/// @notice Returns the FOUNDRY_LIBRARIES-compatible string for library linking.
function getLibraryString(address liquidationLogic) internal pure returns (string memory) {
return
string(
abi.encodePacked(
'src/spoke/libraries/LiquidationLogic.sol:LiquidationLogic:',
vm.toString(liquidationLogic)
)
);
}

/// @notice Deploys LiquidationLogic and appends FOUNDRY_LIBRARIES to .env.
function _deployAndWriteLibrariesConfig() internal {
address liquidationLogic = deployLiquidationLogic();

string memory librariesSolcString = getLibraryString(liquidationLogic);

string memory sedCommand = string(
abi.encodePacked('echo FOUNDRY_LIBRARIES=', librariesSolcString, ' >> .env')
);
string[] memory command = new string[](3);

command[0] = 'bash';
command[1] = '-c';
command[2] = string(abi.encodePacked('response="$(', sedCommand, ')"; $response;'));
vm.ffi(command);
}

// ==================== .env Management (FFI) ====================

/// @notice Checks if .env contains a FOUNDRY_LIBRARIES entry.
function _librariesPathExists() internal returns (bool) {
string
memory checkCommand = '[ -e .env ] && grep -q "FOUNDRY_LIBRARIES" .env && echo true || echo false';
string[] memory command = new string[](3);

command[0] = 'bash';
command[1] = '-c';
command[2] = string(
abi.encodePacked(
'response="$(',
checkCommand,
')"; cast abi-encode "response(bool)" $response;'
)
);
bytes memory res = vm.ffi(command);

return abi.decode(res, (bool));
}

/// @notice Deletes the FOUNDRY_LIBRARIES line from .env.
function _deleteLibrariesPath() internal {
string memory deleteCommand = "sed -i.bak -r '/FOUNDRY_LIBRARIES/d' .env && rm .env.bak";
string[] memory delCommand = new string[](3);

delCommand[0] = 'bash';
delCommand[1] = '-c';
delCommand[2] = string(abi.encodePacked('response="$(', deleteCommand, ')"; $response;'));
vm.ffi(delCommand);
}

/// @notice Reads the LiquidationLogic address from FOUNDRY_LIBRARIES in .env.
/// @return The address, or address(0) if not found.
function _getLiquidationLogicAddress() internal returns (address) {
string memory getLibraryAddress = "sed -nr 's/.*LiquidationLogic:([^,]*).*/\\1/p' .env";
string[] memory getAddressCommand = new string[](3);

getAddressCommand[0] = 'bash';
getAddressCommand[1] = '-c';
getAddressCommand[2] = string(
abi.encodePacked(
'response="$(',
getLibraryAddress,
')"; [ -z "$response" ] && cast abi-encode "response(address)" 0x0000000000000000000000000000000000000000 || cast abi-encode "response(address)" $response'
)
);

bytes memory res = vm.ffi(getAddressCommand);
return abi.decode(res, (address));
}
}
Loading
Loading