Skip to content

Commit

Permalink
chore: add deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
0xblu committed Aug 8, 2024
1 parent 6762bdb commit 3b7f5ab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ runs = 1000
[rpc_endpoints]
mainnet = "${MAINNET_RPC}"
sepolia = "${SEPOLIA_RPC}"
optimism-sepolia = "${OPTIMISM_SEPOLIA_RPC}"

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY}", chain = "mainnet" }
sepolia = { key = "${ETHERSCAN_API_KEY}", chain = "sepolia" }
optimism-sepolia = { key = "${ETHERSCAN_API_KEY}", chain = "optimism-sepolia" }
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"coverage": "forge coverage --report summary --report lcov --match-path 'test/unit/*'",
"deploy:mainnet": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $MAINNET_RPC --broadcast --chain mainnet --private-key $MAINNET_DEPLOYER_PK'",
"deploy:optimism-sepolia": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $OPTIMISM_SEPOLIA_RPC --broadcast --chain optimism-sepolia --private-key $OPTIMISM_SEPOLIA_DEPLOYER_PK --verify --verifier blockscout --verifier-url https://optimism-sepolia.blockscout.com/api/'",
"deploy:sepolia": "bash -c 'source .env && forge script Deploy -vvvvv --rpc-url $SEPOLIA_RPC --broadcast --chain sepolia --private-key $SEPOLIA_DEPLOYER_PK'",
"lint:check": "yarn lint:sol-tests && yarn lint:sol-logic && forge fmt --check",
"lint:fix": "sort-package-json && forge fmt && yarn lint:sol-tests --fix && yarn lint:sol-logic --fix",
Expand Down
22 changes: 16 additions & 6 deletions script/Deploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
pragma solidity 0.8.26;

import {Grateful} from "contracts/Grateful.sol";
import {AaveV3Vault} from "contracts/vaults/AaveV3Vault.sol";
import {Script} from "forge-std/Script.sol";
import {IERC20} from "forge-std/interfaces/IERC20.sol";
import {IPool} from "yield-daddy/aave-v3/AaveV3ERC4626.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
import {IPool, IRewardsController} from "yield-daddy/aave-v3/AaveV3ERC4626.sol";

contract Deploy is Script {
struct DeploymentParams {
Expand All @@ -17,20 +18,29 @@ contract Deploy is Script {

function setUp() public {
address[] memory _tokens = new address[](1);
_tokens[0] = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
_tokens[0] = address(0x5fd84259d66Cd46123540766Be93DFE6D43130D7);

// Mainnet
_deploymentParams[1] = DeploymentParams(_tokens, IPool(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2));

// Sepolia
_deploymentParams[11_155_111] = DeploymentParams(_tokens, IPool(0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951));
// Optimism Sepolia
_deploymentParams[11_155_420] = DeploymentParams(_tokens, IPool(0xb50201558B00496A145fE76f7424749556E326D8));
}

function run() public {
DeploymentParams memory _params = _deploymentParams[block.chainid];

vm.startBroadcast();
new Grateful(_params.tokens, _params.aavePool);
Grateful _grateful = new Grateful(_params.tokens, _params.aavePool);
AaveV3Vault _vault = new AaveV3Vault(
ERC20(_params.tokens[0]),
ERC20(0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97),
_params.aavePool,
address(0),
IRewardsController(0x8164Cc65827dcFe994AB23944CBC90e0aa80bFcb),
address(_grateful)
);
_grateful.addVault(_params.tokens[0], address(_vault));
vm.stopBroadcast();
}
}

0 comments on commit 3b7f5ab

Please sign in to comment.