-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
148 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
ETHERSCAN_API_KEY= | ||
# Used by the multi-chain deployment script | ||
|
||
# General | ||
PRIVATE_KEY= | ||
|
||
# RPC URLs | ||
OPTIMISM_SEPOLIA_RPC= | ||
OPTIMISM_MAINNET_RPC= | ||
OPTIMISM_MAINNET_RPC= | ||
|
||
CYBER_SEPOLIA_RPC= | ||
CYBER_MAINNET_RPC= | ||
|
||
# Etherscan API keys | ||
ETHEREUM_ETHERSCAN_API_KEY= | ||
OPTIMISM_ETHERSCAN_API_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
.PHONY: deploy-testnet deploy-mainnet | ||
.PHONY: deploy-testnet deploy-mainnet deploy-aave | ||
|
||
DEPLOY_CMD=source .env && forge script scripts/Deploy.s.sol:DeployScript | ||
DEPLOY_AAVE_CMD=source .env && forge script scripts/DeployAave.s.sol:DeployAaveScript | ||
VERIFY_CMD=--etherscan-api-key $$OPTIMISM_ETHERSCAN_API_KEY --verify | ||
|
||
deploy-testnet: | ||
source .env && forge script scripts/Deploy.s.sol:DeployScript --rpc-url $$OPTIMISM_SEPOLIA_RPC --broadcast --verify -vvvv | ||
${DEPLOY_CMD} --rpc-url $$OPTIMISM_TESTNET_RPC --broadcast ${VERIFY_CMD} -vvvv | ||
${DEPLOY_CMD} --rpc-url $$CYBER_TESTNET_RPC --broadcast -vvvv | ||
|
||
deploy-mainnet: | ||
source .env && forge script scripts/Deploy.s.sol:DeployScript --rpc-url $$OPTIMISM_MAINNET_RPC --broadcast --verify -vvvv | ||
${DEPLOY_CMD} --rpc-url $$OPTIMISM_MAINNET_RPC --broadcast ${VERIFY_CMD} -vvvv | ||
${DEPLOY_CMD} --rpc-url $$CYBER_MAINNET_RPC --broadcast -vvvv | ||
|
||
deploy-aave: | ||
${DEPLOY_AAVE_CMD} --rpc-url $$OPTIMISM_TESTNET_RPC --broadcast ${VERIFY_CMD} -vvvv | ||
${DEPLOY_AAVE_CMD} --rpc-url $$OPTIMISM_MAINNET_RPC --broadcast ${VERIFY_CMD} -vvvv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity 0.8.25; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
|
||
contract BaseScript is Script { | ||
// TEMPORARY | ||
// It will be replaced with multi-sig wallet. | ||
address public OWNER = 0xdA1d0C7f174effBA98Ea1E31424418DC9aeaEa22; | ||
|
||
uint256 public constant OPTIMISM_MAINNET = 10; | ||
uint256 public constant OPTIMISM_TESTNET = 11155420; | ||
uint256 public constant CYBER_MAINNET = 7560; | ||
uint256 public constant CYBER_TESTNET = 111557560; | ||
|
||
mapping(uint chainid => address shares_factory) public SHARES_FACTORY; | ||
mapping(uint chainid => address weth) public WETH; | ||
mapping(uint chainid => address aave_pool) public AAVE_POOL; | ||
mapping(uint chainid => address aave_weth_gateway) public AAVE_WETH_GATEWAY; | ||
|
||
constructor() { | ||
// Optimism Sepolia | ||
SHARES_FACTORY[OPTIMISM_TESTNET] = 0x9F94C75341D23EAb48793b2879F6062a400132e3; | ||
WETH[OPTIMISM_TESTNET] = 0x4200000000000000000000000000000000000006; | ||
AAVE_POOL[OPTIMISM_TESTNET] = 0xb50201558B00496A145fE76f7424749556E326D8; | ||
AAVE_WETH_GATEWAY[OPTIMISM_TESTNET] = 0x589750BA8aF186cE5B55391B0b7148cAD43a1619; | ||
|
||
// Optimism Mainnet | ||
SHARES_FACTORY[OPTIMISM_MAINNET] = address(0); | ||
WETH[OPTIMISM_MAINNET] = 0x4200000000000000000000000000000000000006; | ||
AAVE_POOL[OPTIMISM_MAINNET] = 0x794a61358D6845594F94dc1DB02A252b5b4814aD; | ||
AAVE_WETH_GATEWAY[OPTIMISM_MAINNET] = 0xe9E52021f4e11DEAD8661812A0A6c8627abA2a54; | ||
|
||
// Cyber Sepolia | ||
WETH[CYBER_TESTNET] = 0x4200000000000000000000000000000000000006; | ||
SHARES_FACTORY[CYBER_TESTNET] = address(0); | ||
|
||
// Cyber Mainnet | ||
WETH[CYBER_MAINNET] = address(0); | ||
SHARES_FACTORY[CYBER_MAINNET] = address(0); | ||
} | ||
|
||
modifier broadcast() { | ||
uint256 broadcaster = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(broadcaster); | ||
_; | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity 0.8.25; | ||
|
||
import { BaseScript } from "./Base.s.sol"; | ||
import { AaveYieldAggregator } from "contracts/core/aggregator/AaveYieldAggregator.sol"; | ||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
import { IAavePool } from "contracts/interface/IAave.sol"; | ||
|
||
contract DeployAaveScript is BaseScript { | ||
AaveYieldAggregator public aaveYieldAggregator; | ||
|
||
function run() public virtual broadcast { | ||
require(SHARES_FACTORY[block.chainid] != address(0), "SAHRES_FACTORY not set"); | ||
require(WETH[block.chainid] != address(0), "WETH not set"); | ||
require(AAVE_POOL[block.chainid] != address(0), "AAVE_POOL not set"); | ||
require(AAVE_WETH_GATEWAY[block.chainid] != address(0), "AAVE_WETH_GATEWAY not set"); | ||
|
||
if ( | ||
block.chainid == OPTIMISM_MAINNET || | ||
block.chainid == OPTIMISM_TESTNET | ||
) { | ||
aaveYieldAggregator = new AaveYieldAggregator( | ||
SHARES_FACTORY[block.chainid], | ||
WETH[block.chainid], | ||
AAVE_POOL[block.chainid], | ||
AAVE_WETH_GATEWAY[block.chainid] | ||
); | ||
aaveYieldAggregator.transferOwnership(OWNER); | ||
} | ||
|
||
/* | ||
******************************************************************************** | ||
* Mauunal steps to be executed after deploying this script | ||
******************************************************************************** | ||
*/ | ||
|
||
// Note: Migrate to AaveYieldAggregator with 3 days delay | ||
// vm.startPrank(owner); | ||
// sharesFactory.queueMigrateYield(address(aaveYieldAggregator)); | ||
// vm.warp(block.timestamp + 3 days); | ||
// sharesFactory.executeMigrateYield(); | ||
// vm.stopPrank(); | ||
} | ||
} |