From 3a93e6ad7e9628a8931343c0a2aa4286541d57d5 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Thu, 6 Nov 2025 21:15:08 +0400 Subject: [PATCH 1/7] feat: generator changes for multi-chain deploy --- .gitmodules | 2 +- Makefile | 2 + foundry.lock | 4 +- foundry.toml | 10 ----- generator/templates/script.template.ts | 62 +++++++++++++++++--------- generator/utils/importsResolver.ts | 6 +++ lib/aave-helpers | 2 +- 7 files changed, 54 insertions(+), 34 deletions(-) diff --git a/.gitmodules b/.gitmodules index 982b3f5a4..88a991726 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "lib/aave-helpers"] path = lib/aave-helpers url = https://github.com/bgd-labs/aave-helpers - branch = main + branch = feat/multi-deploy diff --git a/Makefile b/Makefile index 938cd4d84..a8fccd78c 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,8 @@ deploy-ledger-zk :; FOUNDRY_PROFILE=zksync forge script $(if $(filter zksync,${c deploy-ledger :; forge script $(if $(filter zksync,${chain}),--zksync) ${contract} --rpc-url ${chain} $(if ${dry},--sender 0x73AF3bcf944a6559933396c1577B257e2054D935 -vvvv, --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv --slow --broadcast) $(if ${legacy}, --legacy, ) deploy-pk :; forge script $(if $(filter zksync,${chain}),--zksync) ${contract} --rpc-url ${chain} $(if ${dry},--sender 0x73AF3bcf944a6559933396c1577B257e2054D935 -vvvv, --private-key ${PRIVATE_KEY} --verify -vvvv --slow --broadcast) +deploy-multichain-ledger :; forge script ${contract} $(if ${dry},--sender 0x73AF3bcf944a6559933396c1577B257e2054D935 -vvvv, --ledger --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv --slow --broadcast) $(if ${legacy}, --legacy, ) + # Utilities download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${address} ${address} git-diff : diff --git a/foundry.lock b/foundry.lock index 02ebceb80..eb5b93601 100644 --- a/foundry.lock +++ b/foundry.lock @@ -2,7 +2,7 @@ "lib/aave-helpers": { "branch": { "name": "main", - "rev": "7eec1e60b71e0904d7f1afa5743965b9524bf30a" + "rev": "5a4748337c3a7f54b7ca5614112919cbeef97910" } } -} \ No newline at end of file +} diff --git a/foundry.toml b/foundry.toml index 262c09d15..af4ec3bea 100644 --- a/foundry.toml +++ b/foundry.toml @@ -42,16 +42,6 @@ out = 'out/cancun' evm_version = 'cancun' cache_path = 'cache/cancun' -[profile.deploy] -out = 'out/shanghai' -evm_version = 'shanghai' -cache_path = 'cache/shanghai' - -[profile.linea] -out = 'out/london' -evm_version = 'london' -cache_path = 'cache/london' - [rpc_endpoints] mainnet = "${RPC_MAINNET}" optimism = "${RPC_OPTIMISM}" diff --git a/generator/templates/script.template.ts b/generator/templates/script.template.ts index 0304f67b7..96e7edd07 100644 --- a/generator/templates/script.template.ts +++ b/generator/templates/script.template.ts @@ -1,5 +1,4 @@ import { - CHAIN_TO_CHAIN_ID, generateContractName, generateFolderName, getChainAlias, @@ -20,7 +19,10 @@ export function generateScript(options: Options) { const hasWhitelabelPool = options.pools.some((pool) => isWhitelabelPool(pool)); // generate imports - template += `import {${['Ethereum', ...chains.filter((c) => c !== 'Ethereum' && c !== 'ZkSync')] + template += `import {${[ + 'Ethereum', + ...chains.filter((c) => hasWhitelabelPool && c !== 'Ethereum' && c !== 'ZkSync'), + ] .map((chain) => `${chain}Script`) .join(', ')}} from 'solidity-utils/contracts/utils/ScriptUtils.sol';\n`; template += options.pools @@ -40,18 +42,15 @@ export function generateScript(options: Options) { return acc; }, {}); - // generate chain scripts - template += Object.keys(poolsToChainsMap) - .filter((c) => c !== 'ZkSync') - .map((chain) => { - return `/** + if (hasWhitelabelPool) { + template += Object.keys(poolsToChainsMap) + .filter((c) => c !== 'ZkSync') + .map((chain) => { + return `/** * @dev Deploy ${chain} * deploy-command: make deploy-ledger contract=src/${folderName}/${fileName}.s.sol:Deploy${chain} chain=${getChainAlias( chain, )} - * verify-command: FOUNDRY_PROFILE=deploy npx catapulta-verify -b broadcast/${fileName}.s.sol/${ - CHAIN_TO_CHAIN_ID[chain] - }/run-latest.json */ contract Deploy${chain} is ${chain}Script { function run() external broadcast { @@ -74,19 +73,42 @@ export function generateScript(options: Options) { .join('\n')} // register action at payloadsController - ${ - hasWhitelabelPool - ? `GovV3Helpers.createPermissionedPayloadCalldata(GovernanceV3${poolsToChainsMap[chain][0].pool.replace('AaveV3', '')}.PERMISSIONED_PAYLOADS_CONTROLLER, actions);` - : 'GovV3Helpers.createPayload(actions);' - } + GovV3Helpers.createPermissionedPayloadCalldata(GovernanceV3${poolsToChainsMap[chain][0].pool.replace('AaveV3', '')}.PERMISSIONED_PAYLOADS_CONTROLLER, actions); } }`; - }) - .join('\n\n'); - template += '\n\n'; + }) + .join('\n\n'); + template += '\n\n'; + } else { + // multi chain deploy scripts + template += ` + /** + * @dev Deploy and Register Payloads on all networks + * deploy-command: make deploy-multichain-ledger contract=src/${folderName}/${fileName}.s.sol:DeployPayloads + */ + contract DeployPayloads is Script { + function run() external { + ${Object.keys(poolsToChainsMap) + .filter((c) => c !== 'ZkSync') + .map( + (chain) => ` + // ${chain} + bytes[] memory ${chain.toLowerCase()}Payload = new bytes[](${poolsToChainsMap[chain].length}); + ${poolsToChainsMap[chain] + .map( + ({contractName, pool}, ix) => + `${chain.toLowerCase()}Payload[${ix}] = type(${contractName}).creationCode;`, + ) + .join('\n')} + GovV3Helpers.deployRegisterPayload(vm, ChainIds.${chain.toUpperCase()}, ${chain.toLowerCase()}Payload); + `, + ) + .join('\n')} + } + }`; + template += '\n\n'; - // generate proposal creation script - if (!hasWhitelabelPool) { + // generate proposal creation script template += `/** * @dev Create Proposal * command: make deploy-ledger contract=src/${folderName}/${fileName}.s.sol:CreateProposal chain=mainnet diff --git a/generator/utils/importsResolver.ts b/generator/utils/importsResolver.ts index ef3f818ae..74a3554f3 100644 --- a/generator/utils/importsResolver.ts +++ b/generator/utils/importsResolver.ts @@ -61,6 +61,12 @@ function findMatch(code: string, needle: string) { */ export function prefixWithImports(code: string) { let imports = ''; + if (findMatch(code, 'Script')) { + imports += `import {Script} from 'forge-std/Script.sol';\n`; + } + if (findMatch(code, 'ChainIds')) { + imports += `import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol';\n`; + } const govMatches = findMatches(code, GovernanceImports); // gov related imports if (govMatches.length > 0) diff --git a/lib/aave-helpers b/lib/aave-helpers index 7eec1e60b..5a4748337 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit 7eec1e60b71e0904d7f1afa5743965b9524bf30a +Subproject commit 5a4748337c3a7f54b7ca5614112919cbeef97910 From 48c8297a517d20775aa39494ba5053b8dab54f5d Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Thu, 6 Nov 2025 21:16:01 +0400 Subject: [PATCH 2/7] chore: cleanup --- foundry.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundry.lock b/foundry.lock index eb5b93601..02bf57770 100644 --- a/foundry.lock +++ b/foundry.lock @@ -5,4 +5,4 @@ "rev": "5a4748337c3a7f54b7ca5614112919cbeef97910" } } -} +} \ No newline at end of file From 0cdad9186d991baec2f440bcc390e765235cf4ff Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Thu, 6 Nov 2025 21:20:48 +0400 Subject: [PATCH 3/7] chore: update test snapshots --- .../__snapshots__/assetListing.spec.ts.snap | 54 +++++++------------ .../priceFeedsUpdate.spec.ts.snap | 27 ++++------ .../__snapshots__/rateUpdates.spec.ts.snap | 27 ++++------ 3 files changed, 40 insertions(+), 68 deletions(-) diff --git a/generator/features/__snapshots__/assetListing.spec.ts.snap b/generator/features/__snapshots__/assetListing.spec.ts.snap index c3e1a82db..ce24c093f 100644 --- a/generator/features/__snapshots__/assetListing.spec.ts.snap +++ b/generator/features/__snapshots__/assetListing.spec.ts.snap @@ -218,6 +218,8 @@ contract AaveV3Ethereum_Test_20231023_Test is ProtocolV3TestBase { "defaultScript": "// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {Script} from 'forge-std/Script.sol'; +import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol'; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/src/GovV3Helpers.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; @@ -225,24 +227,15 @@ import {EthereumScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; import {AaveV3Ethereum_Test_20231023} from './AaveV3Ethereum_Test_20231023.sol'; /** - * @dev Deploy Ethereum - * deploy-command: make deploy-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:DeployEthereum chain=mainnet - * verify-command: FOUNDRY_PROFILE=deploy npx catapulta-verify -b broadcast/Test_20231023.s.sol/1/run-latest.json + * @dev Deploy and Register Payloads on all networks + * deploy-command: make deploy-multichain-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:DeployPayloads */ -contract DeployEthereum is EthereumScript { - function run() external broadcast { - // deploy payloads - address payload0 = GovV3Helpers.deployDeterministic( - type(AaveV3Ethereum_Test_20231023).creationCode - ); - - // compose action - IPayloadsControllerCore.ExecutionAction[] - memory actions = new IPayloadsControllerCore.ExecutionAction[](1); - actions[0] = GovV3Helpers.buildAction(payload0); - - // register action at payloadsController - GovV3Helpers.createPayload(actions); +contract DeployPayloads is Script { + function run() external { + // Ethereum + bytes[] memory ethereumPayload = new bytes[](1); + ethereumPayload[0] = type(AaveV3Ethereum_Test_20231023).creationCode; + GovV3Helpers.deployRegisterPayload(vm, ChainIds.ETHEREUM, ethereumPayload); } } @@ -498,6 +491,8 @@ contract AaveV3Ethereum_Test_20231023_Test is ProtocolV3TestBase { "defaultScript": "// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {Script} from 'forge-std/Script.sol'; +import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol'; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/src/GovV3Helpers.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; @@ -505,24 +500,15 @@ import {EthereumScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; import {AaveV3Ethereum_Test_20231023} from './AaveV3Ethereum_Test_20231023.sol'; /** - * @dev Deploy Ethereum - * deploy-command: make deploy-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:DeployEthereum chain=mainnet - * verify-command: FOUNDRY_PROFILE=deploy npx catapulta-verify -b broadcast/Test_20231023.s.sol/1/run-latest.json + * @dev Deploy and Register Payloads on all networks + * deploy-command: make deploy-multichain-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:DeployPayloads */ -contract DeployEthereum is EthereumScript { - function run() external broadcast { - // deploy payloads - address payload0 = GovV3Helpers.deployDeterministic( - type(AaveV3Ethereum_Test_20231023).creationCode - ); - - // compose action - IPayloadsControllerCore.ExecutionAction[] - memory actions = new IPayloadsControllerCore.ExecutionAction[](1); - actions[0] = GovV3Helpers.buildAction(payload0); - - // register action at payloadsController - GovV3Helpers.createPayload(actions); +contract DeployPayloads is Script { + function run() external { + // Ethereum + bytes[] memory ethereumPayload = new bytes[](1); + ethereumPayload[0] = type(AaveV3Ethereum_Test_20231023).creationCode; + GovV3Helpers.deployRegisterPayload(vm, ChainIds.ETHEREUM, ethereumPayload); } } diff --git a/generator/features/__snapshots__/priceFeedsUpdate.spec.ts.snap b/generator/features/__snapshots__/priceFeedsUpdate.spec.ts.snap index 7191769e8..e0329cf29 100644 --- a/generator/features/__snapshots__/priceFeedsUpdate.spec.ts.snap +++ b/generator/features/__snapshots__/priceFeedsUpdate.spec.ts.snap @@ -120,6 +120,8 @@ contract AaveV3Ethereum_Test_20231023_Test is ProtocolV3TestBase { "defaultScript": "// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {Script} from 'forge-std/Script.sol'; +import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol'; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/src/GovV3Helpers.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; @@ -127,24 +129,15 @@ import {EthereumScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; import {AaveV3Ethereum_Test_20231023} from './AaveV3Ethereum_Test_20231023.sol'; /** - * @dev Deploy Ethereum - * deploy-command: make deploy-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:DeployEthereum chain=mainnet - * verify-command: FOUNDRY_PROFILE=deploy npx catapulta-verify -b broadcast/Test_20231023.s.sol/1/run-latest.json + * @dev Deploy and Register Payloads on all networks + * deploy-command: make deploy-multichain-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:DeployPayloads */ -contract DeployEthereum is EthereumScript { - function run() external broadcast { - // deploy payloads - address payload0 = GovV3Helpers.deployDeterministic( - type(AaveV3Ethereum_Test_20231023).creationCode - ); - - // compose action - IPayloadsControllerCore.ExecutionAction[] - memory actions = new IPayloadsControllerCore.ExecutionAction[](1); - actions[0] = GovV3Helpers.buildAction(payload0); - - // register action at payloadsController - GovV3Helpers.createPayload(actions); +contract DeployPayloads is Script { + function run() external { + // Ethereum + bytes[] memory ethereumPayload = new bytes[](1); + ethereumPayload[0] = type(AaveV3Ethereum_Test_20231023).creationCode; + GovV3Helpers.deployRegisterPayload(vm, ChainIds.ETHEREUM, ethereumPayload); } } diff --git a/generator/features/__snapshots__/rateUpdates.spec.ts.snap b/generator/features/__snapshots__/rateUpdates.spec.ts.snap index 7a7bb887c..8961da4fc 100644 --- a/generator/features/__snapshots__/rateUpdates.spec.ts.snap +++ b/generator/features/__snapshots__/rateUpdates.spec.ts.snap @@ -226,6 +226,8 @@ contract AaveV2EthereumAMM_Test_20231023_Test is ProtocolV2TestBase { "defaultScript": "// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {Script} from 'forge-std/Script.sol'; +import {ChainIds} from 'solidity-utils/contracts/utils/ChainHelpers.sol'; import {GovV3Helpers, IPayloadsControllerCore, PayloadsControllerUtils} from 'aave-helpers/src/GovV3Helpers.sol'; import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol'; @@ -233,24 +235,15 @@ import {EthereumScript} from 'solidity-utils/contracts/utils/ScriptUtils.sol'; import {AaveV2EthereumAMM_Test_20231023} from './AaveV2EthereumAMM_Test_20231023.sol'; /** - * @dev Deploy Ethereum - * deploy-command: make deploy-ledger contract=src/20231023_AaveV2EthereumAMM_Test/Test_20231023.s.sol:DeployEthereum chain=mainnet - * verify-command: FOUNDRY_PROFILE=deploy npx catapulta-verify -b broadcast/Test_20231023.s.sol/1/run-latest.json + * @dev Deploy and Register Payloads on all networks + * deploy-command: make deploy-multichain-ledger contract=src/20231023_AaveV2EthereumAMM_Test/Test_20231023.s.sol:DeployPayloads */ -contract DeployEthereum is EthereumScript { - function run() external broadcast { - // deploy payloads - address payload0 = GovV3Helpers.deployDeterministic( - type(AaveV2EthereumAMM_Test_20231023).creationCode - ); - - // compose action - IPayloadsControllerCore.ExecutionAction[] - memory actions = new IPayloadsControllerCore.ExecutionAction[](1); - actions[0] = GovV3Helpers.buildAction(payload0); - - // register action at payloadsController - GovV3Helpers.createPayload(actions); +contract DeployPayloads is Script { + function run() external { + // Ethereum + bytes[] memory ethereumPayload = new bytes[](1); + ethereumPayload[0] = type(AaveV2EthereumAMM_Test_20231023).creationCode; + GovV3Helpers.deployRegisterPayload(vm, ChainIds.ETHEREUM, ethereumPayload); } } From 5e26ecdd9e9f34e64c3a87d44fac0bf0444cb4b3 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Thu, 6 Nov 2025 21:41:24 +0400 Subject: [PATCH 4/7] fix: template --- generator/templates/script.template.ts | 49 +++++++++++++------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/generator/templates/script.template.ts b/generator/templates/script.template.ts index 96e7edd07..f3e606f54 100644 --- a/generator/templates/script.template.ts +++ b/generator/templates/script.template.ts @@ -41,10 +41,10 @@ export function generateScript(options: Options) { acc[chain].push({contractName, pool}); return acc; }, {}); + const filteredPoolToChainsMap = Object.keys(poolsToChainsMap).filter((c) => c !== 'ZkSync'); if (hasWhitelabelPool) { - template += Object.keys(poolsToChainsMap) - .filter((c) => c !== 'ZkSync') + template += filteredPoolToChainsMap .map((chain) => { return `/** * @dev Deploy ${chain} @@ -81,31 +81,32 @@ export function generateScript(options: Options) { template += '\n\n'; } else { // multi chain deploy scripts - template += ` - /** - * @dev Deploy and Register Payloads on all networks - * deploy-command: make deploy-multichain-ledger contract=src/${folderName}/${fileName}.s.sol:DeployPayloads - */ - contract DeployPayloads is Script { - function run() external { - ${Object.keys(poolsToChainsMap) - .filter((c) => c !== 'ZkSync') - .map( - (chain) => ` - // ${chain} - bytes[] memory ${chain.toLowerCase()}Payload = new bytes[](${poolsToChainsMap[chain].length}); - ${poolsToChainsMap[chain] + if (filteredPoolToChainsMap.length > 0) { + template += ` + /** + * @dev Deploy and Register Payloads on all networks + * deploy-command: make deploy-multichain-ledger contract=src/${folderName}/${fileName}.s.sol:DeployPayloads + */ + contract DeployPayloads is Script { + function run() external { + ${filteredPoolToChainsMap .map( - ({contractName, pool}, ix) => - `${chain.toLowerCase()}Payload[${ix}] = type(${contractName}).creationCode;`, + (chain) => ` + // ${chain} + bytes[] memory ${chain.toLowerCase()}Payload = new bytes[](${poolsToChainsMap[chain].length}); + ${poolsToChainsMap[chain] + .map( + ({contractName, pool}, ix) => + `${chain.toLowerCase()}Payload[${ix}] = type(${contractName}).creationCode;`, + ) + .join('\n')} + GovV3Helpers.deployRegisterPayload(vm, ChainIds.${chain.toUpperCase()}, ${chain.toLowerCase()}Payload); + `, ) .join('\n')} - GovV3Helpers.deployRegisterPayload(vm, ChainIds.${chain.toUpperCase()}, ${chain.toLowerCase()}Payload); - `, - ) - .join('\n')} - } - }`; + } + }`; + } template += '\n\n'; // generate proposal creation script From 2a81bb2b6af00c065314b5667f8ef7c556776e00 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Fri, 7 Nov 2025 16:37:20 +0400 Subject: [PATCH 5/7] chore: bump helpers --- foundry.lock | 4 ++-- lib/aave-helpers | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/foundry.lock b/foundry.lock index 02bf57770..29cfc56b9 100644 --- a/foundry.lock +++ b/foundry.lock @@ -2,7 +2,7 @@ "lib/aave-helpers": { "branch": { "name": "main", - "rev": "5a4748337c3a7f54b7ca5614112919cbeef97910" + "rev": "f9c2a2ac2073f535674bad2254cb5533a1083e22" } } -} \ No newline at end of file +} diff --git a/lib/aave-helpers b/lib/aave-helpers index 5a4748337..f9c2a2ac2 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit 5a4748337c3a7f54b7ca5614112919cbeef97910 +Subproject commit f9c2a2ac2073f535674bad2254cb5533a1083e22 From 2ed08b897ef302453d4b09309012d0037c457786 Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Fri, 7 Nov 2025 16:40:02 +0400 Subject: [PATCH 6/7] chore: bump helpers --- foundry.lock | 6 +++--- lib/aave-helpers | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/foundry.lock b/foundry.lock index 29cfc56b9..f29822cb7 100644 --- a/foundry.lock +++ b/foundry.lock @@ -1,8 +1,8 @@ { "lib/aave-helpers": { "branch": { - "name": "main", - "rev": "f9c2a2ac2073f535674bad2254cb5533a1083e22" + "name": "feat/multi-deploy", + "rev": "89d808f97df37a9f38ceb9a70ec46271ee005054" } } -} +} \ No newline at end of file diff --git a/lib/aave-helpers b/lib/aave-helpers index f9c2a2ac2..89d808f97 160000 --- a/lib/aave-helpers +++ b/lib/aave-helpers @@ -1 +1 @@ -Subproject commit f9c2a2ac2073f535674bad2254cb5533a1083e22 +Subproject commit 89d808f97df37a9f38ceb9a70ec46271ee005054 From 7c1927808fb3241e01ae76728f801ef8280c629d Mon Sep 17 00:00:00 2001 From: Harsh Pandey Date: Fri, 7 Nov 2025 17:03:16 +0400 Subject: [PATCH 7/7] fix: change ppc scripts to two func. one for deploy another for calldata --- generator/templates/script.template.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/generator/templates/script.template.ts b/generator/templates/script.template.ts index f3e606f54..0da284b13 100644 --- a/generator/templates/script.template.ts +++ b/generator/templates/script.template.ts @@ -58,17 +58,32 @@ export function generateScript(options: Options) { ${poolsToChainsMap[chain] .map( ({contractName, pool}, ix) => - `address payload${ix} = GovV3Helpers.deployDeterministic(type(${contractName}).creationCode);`, + `GovV3Helpers.deployDeterministic(type(${contractName}).creationCode);`, ) .join('\n')} + } + }`; + }) + .join('\n\n'); + template += '\n\n'; + // generate permissioned-payload calldata script + template += filteredPoolToChainsMap + .map((chain) => { + return `/** + * @dev Generate Calldata for ${chain} + * deploy-command: forge script --rpc-url ${getChainAlias(chain)} src/${folderName}/${fileName}.s.sol:RegisterPayloadCalldata${chain} + */ + contract RegisterPayloadCalldata${chain} is ${chain}Script { + function run() external view { // compose action IPayloadsControllerCore.ExecutionAction[] memory actions = new IPayloadsControllerCore.ExecutionAction[](${ poolsToChainsMap[chain].length }); ${poolsToChainsMap[chain] .map( - ({contractName, pool}, ix) => `actions[${ix}] = GovV3Helpers.buildAction(payload${ix});`, + ({contractName, pool}, ix) => + `actions[${ix}] = GovV3Helpers.buildAction(type(${contractName}).creationCode);`, ) .join('\n')}