From 651e06e89228c35334bd788d0aa2c6678c249b46 Mon Sep 17 00:00:00 2001 From: 0xchin Date: Wed, 20 Nov 2024 04:21:21 -0300 Subject: [PATCH] chore: add base deploy script --- package.json | 1 + script/Deploy.sol | 47 ++++++++++++++++++++++++++++++--- test/integration/Grateful.t.sol | 15 +++++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 02ad124..f70de90 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "test": "TESTING=true FORKED_NETWORK=mainnet FORK_BLOCK=18920905 forge test -vvv ", "test:arbitrum": "TESTING=true FORKED_NETWORK=arbitrum FORK_BLOCK=236334831 forge test -vvv ", "test:arbitrum-sepolia": "TESTING=true FORKED_NETWORK=arbitrum-sepolia FORK_BLOCK=98684306 forge test -vvv ", + "test:base": "TESTING=true FORKED_NETWORK=base FORK_BLOCK=20648648 forge test -vvv ", "test:bnb": "TESTING=true FORKED_NETWORK=bnb FORK_BLOCK=44138162 forge test -vvv ", "test:fuzz": "echidna test/invariants/fuzz/Greeter.t.sol --contract InvariantGreeter --corpus-dir test/invariants/fuzz/echidna_coverage/ --test-mode assertion", "test:integration": "TESTING=true FORKED_NETWORK=mainnet FORK_BLOCK=18920905 forge test --match-contract Integration -vvv", diff --git a/script/Deploy.sol b/script/Deploy.sol index bb16fb5..bcd1041 100644 --- a/script/Deploy.sol +++ b/script/Deploy.sol @@ -226,6 +226,45 @@ contract Deploy is Script { rewardsController: address(0xaD4F91D26254B6B0C6346b390dDA2991FDE2F20d) }); + params = DeploymentParams({ + tokens: _tokens, + aavePool: IPool(0xb50201558B00496A145fE76f7424749556E326D8), + initialFee: 0.01 ether, // 1% + initialPerformanceFee: 0.05 ether, // 5% + vaults: _vaults + }); + } else if (chainId == CHAIN_BASE) { + address[] memory _tokens = new address[](3); + _tokens[0] = address(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913); // USDC + _tokens[1] = address(0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2); // USDT + _tokens[2] = address(0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb); // DAI + + VaultDeploymentParams[] memory _vaults = new VaultDeploymentParams[](1); + + _vaults[0] = VaultDeploymentParams({ + token: address(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913), // USDC + aToken: address(0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB), // aUSDC + rewardsController: address(0xf9cc4F0D883F1a1eb2c253bdb46c254Ca51E1F44) // Rewards Controller + }); + + params = DeploymentParams({ + tokens: _tokens, + aavePool: IPool(0xA238Dd80C259a72e81d7e4664a9801593F98d1c5), + initialFee: 0.01 ether, // 1% + initialPerformanceFee: 0.05 ether, // 5% + vaults: _vaults + }); + } else if (chainId == CHAIN_OPTIMISM_SEPOLIA) { + address[] memory _tokens = new address[](1); + _tokens[0] = address(0x5fd84259d66Cd46123540766Be93DFE6D43130D7); + + VaultDeploymentParams[] memory _vaults = new VaultDeploymentParams[](1); + _vaults[0] = VaultDeploymentParams({ + token: address(0x5fd84259d66Cd46123540766Be93DFE6D43130D7), + aToken: address(0xa818F1B57c201E092C4A2017A91815034326Efd1), + rewardsController: address(0xaD4F91D26254B6B0C6346b390dDA2991FDE2F20d) + }); + params = DeploymentParams({ tokens: _tokens, aavePool: IPool(0xb50201558B00496A145fE76f7424749556E326D8), @@ -259,9 +298,9 @@ contract Deploy is Script { function run() public { DeploymentParams memory _params = getDeploymentParams(block.chainid); - /* if (!vm.envBool("TESTING")) { + if (!vm.envBool("TESTING")) { vm.startBroadcast(); - } */ + } grateful = new Grateful(_params.tokens, _params.aavePool, _params.initialFee, _params.initialPerformanceFee); grateful.transferOwnership(GRATEFUL_MULTISIG); @@ -287,8 +326,8 @@ contract Deploy is Script { vaults[vaultParams.token] = vault; } - /* if (!vm.envBool("TESTING")) { + if (!vm.envBool("TESTING")) { vm.stopBroadcast(); - } */ + } } } diff --git a/test/integration/Grateful.t.sol b/test/integration/Grateful.t.sol index 892c93a..5a72dad 100644 --- a/test/integration/Grateful.t.sol +++ b/test/integration/Grateful.t.sol @@ -44,6 +44,11 @@ contract IntegrationGrateful is IntegrationBase { for (uint256 i = 0; i < _tokens.length; i++) { address tokenAddr = _tokens[i]; + + if (address(grateful.vaults(tokenAddr)) == address(0)) { + continue; + } + string memory symbol = _tokenSymbols[tokenAddr]; uint256 amount = _tokenAmounts[tokenAddr] * amountMultiplier; @@ -100,6 +105,11 @@ contract IntegrationGrateful is IntegrationBase { for (uint256 i = 0; i < _tokens.length; i++) { address tokenAddr = _tokens[i]; + + if (address(grateful.vaults(tokenAddr)) == address(0)) { + continue; + } + uint256 amount = _tokenAmounts[tokenAddr] * amountMultiplier; // Capture owner's initial balance before payment @@ -194,6 +204,11 @@ contract IntegrationGrateful is IntegrationBase { for (uint256 i = 0; i < _tokens.length; i++) { address tokenAddr = _tokens[i]; + + if (address(grateful.vaults(tokenAddr)) == address(0)) { + continue; + } + string memory symbol = _tokenSymbols[tokenAddr]; uint256 amount = _tokenAmounts[tokenAddr] * amountMultiplier;