Skip to content

Commit

Permalink
chore: add base deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
0xChin committed Nov 20, 2024
1 parent 036d26d commit 651e06e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
47 changes: 43 additions & 4 deletions script/Deploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand All @@ -287,8 +326,8 @@ contract Deploy is Script {
vaults[vaultParams.token] = vault;
}

/* if (!vm.envBool("TESTING")) {
if (!vm.envBool("TESTING")) {
vm.stopBroadcast();
} */
}
}
}
15 changes: 15 additions & 0 deletions test/integration/Grateful.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 651e06e

Please sign in to comment.