diff --git a/generator/features/__snapshots__/assetListing.spec.ts.snap b/generator/features/__snapshots__/assetListing.spec.ts.snap index 336e7ee2e..2573fb620 100644 --- a/generator/features/__snapshots__/assetListing.spec.ts.snap +++ b/generator/features/__snapshots__/assetListing.spec.ts.snap @@ -103,10 +103,11 @@ contract AaveV3Ethereum_Test_20231023 is AaveV3PayloadEthereum { using SafeERC20 for IERC20; address public constant PSP = 0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5; + uint256 internal constant PSP_SEED_AMOUNT = 10 ** 18; function _postExecute() internal override { - IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), 10 ** 18); - AaveV3Ethereum.POOL.supply(PSP, 10 ** 18, address(AaveV3Ethereum.COLLECTOR), 0); + IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), PSP_SEED_AMOUNT); + AaveV3Ethereum.POOL.supply(PSP, PSP_SEED_AMOUNT, address(AaveV3Ethereum.COLLECTOR), 0); } function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) { @@ -166,7 +167,7 @@ contract AaveV3Ethereum_Test_20231023_Test is ProtocolV3TestBase { AaveV3Ethereum_Test_20231023 internal proposal; function setUp() public { - vm.createSelectFork(vm.rpcUrl('mainnet'), 18461057); + vm.createSelectFork(vm.rpcUrl('mainnet'), 18480118); proposal = new AaveV3Ethereum_Test_20231023(); } @@ -219,7 +220,7 @@ contract DeployEthereum is EthereumScript { * command: make deploy-ledger contract=src/20231023_AaveV3Ethereum_Test/Test_20231023.s.sol:CreateProposal chain=mainnet */ contract CreateProposal is EthereumScript { - function run() external broadcast { + function run() external { // create payloads PayloadsControllerUtils.Payload[] memory payloads = new PayloadsControllerUtils.Payload[](1); @@ -230,6 +231,7 @@ contract CreateProposal is EthereumScript { payloads[0] = GovV3Helpers.buildMainnetPayload(vm, actionsEthereum); // create proposal + vm.startBroadcast(); GovV3Helpers.createProposal2_5( payloads, GovV3Helpers.ipfsHashFile(vm, 'src/20231023_AaveV3Ethereum_Test/Test.md') @@ -245,10 +247,11 @@ exports[`feature: assetListing > should return reasonable code 1`] = ` "code": { "constants": [ "address public constant PSP = 0xcAfE001067cDEF266AfB7Eb5A286dCFD277f3dE5;", + "uint256 internal constant PSP_SEED_AMOUNT = 10 ** 18;", ], "execute": [ - "IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), 10 ** 18); - AaveV3Ethereum.POOL.supply(PSP, 10 ** 18, address(AaveV3Ethereum.COLLECTOR), 0);", + "IERC20(PSP).forceApprove(address(AaveV3Ethereum.POOL), PSP_SEED_AMOUNT); + AaveV3Ethereum.POOL.supply(PSP, PSP_SEED_AMOUNT, address(AaveV3Ethereum.COLLECTOR), 0);", ], "fn": [ "function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) { diff --git a/generator/features/assetListing.ts b/generator/features/assetListing.ts index b88cf08a0..fbf352f34 100644 --- a/generator/features/assetListing.ts +++ b/generator/features/assetListing.ts @@ -100,11 +100,16 @@ export const assetListing: FeatureModule = { build(opt, pool, cfg) { const response: CodeArtifact = { code: { - constants: cfg.map((cfg) => `address public constant ${cfg.assetSymbol} = ${cfg.asset};`), + constants: cfg + .map((cfg) => [ + `address public constant ${cfg.assetSymbol} = ${cfg.asset};`, + `uint256 internal constant ${cfg.assetSymbol}_SEED_AMOUNT = 10 ** ${cfg.decimals};`, + ]) + .flat(), execute: cfg.map( (cfg) => - `IERC20(${cfg.assetSymbol}).forceApprove(address(${pool}.POOL), 10 ** ${cfg.decimals}); - ${pool}.POOL.supply(${cfg.assetSymbol}, 10 ** ${cfg.decimals}, address(${pool}.COLLECTOR), 0);` + `IERC20(${cfg.assetSymbol}).forceApprove(address(${pool}.POOL), ${cfg.assetSymbol}_SEED_AMOUNT); + ${pool}.POOL.supply(${cfg.assetSymbol}, ${cfg.assetSymbol}_SEED_AMOUNT, address(${pool}.COLLECTOR), 0);` ), fn: [ `function newListings() public pure override returns (IAaveV3ConfigEngine.Listing[] memory) {