-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
39df201
commit c4b552c
Showing
9 changed files
with
245 additions
and
210 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,49 +1,36 @@ | ||
import { deployContract } from '@casimir/ethereum/helpers/deploy' | ||
import { ContractConfig, DeploymentConfig } from '@casimir/types' | ||
import { ethers } from 'hardhat' | ||
|
||
void async function () { | ||
const config: DeploymentConfig = { | ||
CasimirManager: { | ||
address: '', | ||
args: { | ||
oracleAddress: process.env.ORACLE_ADDRESS, | ||
beaconDepositAddress: process.env.BEACON_DEPOSIT_ADDRESS, | ||
linkFunctionsAddress: process.env.LINK_FUNCTIONS_ADDRESS, | ||
linkRegistrarAddress: process.env.LINK_REGISTRAR_ADDRESS, | ||
linkRegistryAddress: process.env.LINK_REGISTRY_ADDRESS, | ||
linkTokenAddress: process.env.LINK_TOKEN_ADDRESS, | ||
ssvNetworkAddress: process.env.SSV_NETWORK_ADDRESS, | ||
ssvNetworkViewsAddress: process.env.SSV_NETWORK_VIEWS_ADDRESS, | ||
ssvTokenAddress: process.env.SSV_TOKEN_ADDRESS, | ||
swapFactoryAddress: process.env.SWAP_FACTORY_ADDRESS, | ||
swapRouterAddress: process.env.SWAP_ROUTER_ADDRESS, | ||
wethTokenAddress: process.env.WETH_TOKEN_ADDRESS | ||
}, | ||
options: {}, | ||
proxy: false | ||
}, | ||
CasimirViews: { | ||
address: '', | ||
args: { | ||
managerAddress: '' | ||
}, | ||
options: {}, | ||
proxy: false | ||
} | ||
const managerArgs = { | ||
oracleAddress: process.env.ORACLE_ADDRESS, | ||
beaconDepositAddress: process.env.BEACON_DEPOSIT_ADDRESS, | ||
linkFunctionsAddress: process.env.LINK_FUNCTIONS_ADDRESS, | ||
linkRegistrarAddress: process.env.LINK_REGISTRAR_ADDRESS, | ||
linkRegistryAddress: process.env.LINK_REGISTRY_ADDRESS, | ||
linkTokenAddress: process.env.LINK_TOKEN_ADDRESS, | ||
ssvNetworkAddress: process.env.SSV_NETWORK_ADDRESS, | ||
ssvNetworkViewsAddress: process.env.SSV_NETWORK_VIEWS_ADDRESS, | ||
ssvTokenAddress: process.env.SSV_TOKEN_ADDRESS, | ||
swapFactoryAddress: process.env.SWAP_FACTORY_ADDRESS, | ||
swapRouterAddress: process.env.SWAP_ROUTER_ADDRESS, | ||
wethTokenAddress: process.env.WETH_TOKEN_ADDRESS | ||
} | ||
const managerFactory = await ethers.getContractFactory('CasimirManager') | ||
const manager = await managerFactory.deploy(...Object.values(managerArgs)) | ||
await manager.deployed() | ||
console.log(`CasimirManager contract deployed to ${manager.address}`) | ||
|
||
for (const name in config) { | ||
if (name === 'CasimirViews') { | ||
(config[name as keyof typeof config] as ContractConfig).args.managerAddress = config.CasimirManager.address | ||
} | ||
const registryAddress = await manager.getRegistryAddress() | ||
console.log(`CasimirRegistry contract deployed to ${registryAddress}`) | ||
|
||
const { args, options, proxy } = config[name as keyof typeof config] as ContractConfig | ||
const upkeepAddress = await manager.getUpkeepAddress() | ||
console.log(`CasimirUpkeep contract deployed to ${upkeepAddress}`) | ||
|
||
const contract = await deployContract(name, proxy, args, options) | ||
const { address } = contract | ||
|
||
console.log(`${name} contract deployed to ${address}`) | ||
|
||
;(config[name as keyof DeploymentConfig] as ContractConfig).address = address | ||
const viewsArgs = { | ||
managerAddress: manager.address, | ||
registryAddress | ||
} | ||
const viewsFactory = await ethers.getContractFactory('CasimirViews') | ||
const views = await viewsFactory.deploy(...Object.values(viewsArgs)) | ||
console.log(`CasimirViews contract deployed to ${views.address}`) | ||
}() |
Oops, something went wrong.