forked from stader-labs/ethx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prod values along with deploy script (stader-labs#156)
* prod vaules along with deploy script * review fix --------- Co-authored-by: Sanjay Yadav <[email protected]>
- Loading branch information
1 parent
82c4348
commit b26d7f1
Showing
11 changed files
with
57 additions
and
77 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 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
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
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
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
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,142 +1,112 @@ | ||
import { ethers, upgrades } from 'hardhat' | ||
|
||
async function main() { | ||
|
||
console.log('starting deployment process...') | ||
const admin = process.env.ADMIN ?? '' | ||
const tempAdmin = process.env.TEMP_ADMIN ?? '' | ||
const externalAdmin = process.env.EXTERNAL_ADMIN ?? '' | ||
const ethDepositContract = process.env.ETH_DEPOSIT_CONTRACT ?? '' | ||
const permissionlessPoolWeight: any = process.env.PERMISSIONLESS_POOL_WEIGHT | ||
const permissionedPoolWeight: any = process.env.PERMISSIONED_POOL_WEIGHT | ||
|
||
const ratedOracle = process.env.RATED_ORACLE ?? '' | ||
const ratedOracle = process.env.RATED ?? '' | ||
|
||
const StaderConfig = await ethers.getContractFactory('StaderConfig') | ||
const staderConfig = await upgrades.deployProxy(StaderConfig, [admin, ethDepositContract]) | ||
const staderConfig = await upgrades.deployProxy(StaderConfig, [tempAdmin, ethDepositContract]) | ||
console.log('stader config deployed at ', staderConfig.address) | ||
|
||
const vaultFactory = await ethers.getContractFactory('VaultFactory') | ||
const vaultFactoryInstance = await upgrades.deployProxy(vaultFactory, [admin, staderConfig.address]) | ||
const vaultFactoryInstance = await upgrades.deployProxy(vaultFactory, [externalAdmin, staderConfig.address]) | ||
console.log('vaultFactoryInstance deployed at ', vaultFactoryInstance.address) | ||
|
||
const auctionFactory = await ethers.getContractFactory('Auction') | ||
const auctionInstance = await upgrades.deployProxy(auctionFactory, [ | ||
admin, | ||
staderConfig.address, | ||
ethers.BigNumber.from('86400'), | ||
ethers.utils.parseEther('0.001'), | ||
externalAdmin, | ||
staderConfig.address | ||
]) | ||
console.log('auction contract deployed at ', auctionInstance.address) | ||
|
||
const ETHxFactory = await ethers.getContractFactory('ETHx') | ||
const ETHxToken = await upgrades.deployProxy(ETHxFactory, [admin, staderConfig.address]) | ||
const ETHxToken = await upgrades.deployProxy(ETHxFactory, [externalAdmin, staderConfig.address]) | ||
console.log('ETHx deployed at ', ETHxToken.address) | ||
|
||
const penaltyFactory = await ethers.getContractFactory('Penalty') | ||
const penaltyInstance = await upgrades.deployProxy(penaltyFactory, [admin, staderConfig.address, ratedOracle]) | ||
const penaltyInstance = await upgrades.deployProxy(penaltyFactory, [externalAdmin, staderConfig.address, ratedOracle]) | ||
console.log('penalty contract deployed at ', penaltyInstance.address) | ||
|
||
const PermissionedNodeRegistryFactory = await ethers.getContractFactory('PermissionedNodeRegistry') | ||
const permissionedNodeRegistry = await upgrades.deployProxy(PermissionedNodeRegistryFactory, [ | ||
admin, | ||
externalAdmin, | ||
staderConfig.address, | ||
]) | ||
console.log('permissionedNodeRegistry deployed at ', permissionedNodeRegistry.address) | ||
|
||
const permissinedPoolFactory = await ethers.getContractFactory('PermissionedPool') | ||
const permissionedPool = await upgrades.deployProxy(permissinedPoolFactory, [admin, staderConfig.address]) | ||
const permissionedPool = await upgrades.deployProxy(permissinedPoolFactory, [externalAdmin, staderConfig.address]) | ||
console.log('permissionedPool deployed at ', permissionedPool.address) | ||
|
||
const PermissionlessNodeRegistryFactory = await ethers.getContractFactory('PermissionlessNodeRegistry') | ||
const permissionlessNodeRegistry = await upgrades.deployProxy(PermissionlessNodeRegistryFactory, [ | ||
admin, | ||
externalAdmin, | ||
staderConfig.address, | ||
]) | ||
console.log('permissionlessNodeRegistry deployed at ', permissionlessNodeRegistry.address) | ||
|
||
const permissionlessPoolFactory = await ethers.getContractFactory('PermissionlessPool') | ||
const permissionlessPool = await upgrades.deployProxy(permissionlessPoolFactory, [admin, staderConfig.address]) | ||
const permissionlessPool = await upgrades.deployProxy(permissionlessPoolFactory, [externalAdmin, staderConfig.address]) | ||
console.log('permissionlessPool deployed at ', permissionlessPool.address) | ||
|
||
const poolSelectorFactory = await ethers.getContractFactory('PoolSelector') | ||
const poolSelector = await upgrades.deployProxy(poolSelectorFactory, [ | ||
admin, | ||
staderConfig.address, | ||
permissionlessPoolWeight, | ||
permissionedPoolWeight, | ||
externalAdmin, | ||
staderConfig.address | ||
]) | ||
console.log('poolSelector deployed at ', poolSelector.address) | ||
|
||
const poolUtilsFactory = await ethers.getContractFactory('PoolUtils') | ||
const poolUtilsInstance = await upgrades.deployProxy(poolUtilsFactory, [admin, staderConfig.address]) | ||
const poolUtilsInstance = await upgrades.deployProxy(poolUtilsFactory, [externalAdmin, staderConfig.address]) | ||
console.log('poolUtils deployed at ', poolUtilsInstance.address) | ||
|
||
const SDCollateralFactory = await ethers.getContractFactory('SDCollateral') | ||
const SDCollateral = await upgrades.deployProxy(SDCollateralFactory, [admin, staderConfig.address]) | ||
const SDCollateral = await upgrades.deployProxy(SDCollateralFactory, [externalAdmin, staderConfig.address]) | ||
console.log('SDCollateral deployed at ', SDCollateral.address) | ||
|
||
const socializingPoolFactory = await ethers.getContractFactory('SocializingPool') | ||
const permissionedSocializingPoolContract = await upgrades.deployProxy(socializingPoolFactory, [ | ||
admin, | ||
externalAdmin, | ||
staderConfig.address, | ||
]) | ||
console.log('permissioned socializingPoolContract deployed at ', permissionedSocializingPoolContract.address) | ||
|
||
const permissionlessSocializingPoolContract = await upgrades.deployProxy(socializingPoolFactory, [ | ||
admin, | ||
externalAdmin, | ||
staderConfig.address, | ||
]) | ||
console.log('permissionless socializingPoolContract deployed at ', permissionlessSocializingPoolContract.address) | ||
|
||
const insuranceFundFactory = await ethers.getContractFactory('StaderInsuranceFund') | ||
const insuranceFund = await upgrades.deployProxy(insuranceFundFactory, [admin, staderConfig.address]) | ||
const insuranceFund = await upgrades.deployProxy(insuranceFundFactory, [externalAdmin, staderConfig.address]) | ||
console.log('insurance fund deployed at ', insuranceFund.address) | ||
|
||
const staderOracleFactory = await ethers.getContractFactory('StaderOracle') | ||
const staderOracle = await upgrades.deployProxy(staderOracleFactory, [admin, staderConfig.address]) | ||
const staderOracle = await upgrades.deployProxy(staderOracleFactory, [externalAdmin, staderConfig.address]) | ||
console.log('stader oracle deployed at ', staderOracle.address) | ||
|
||
const poolManagerFactory = await ethers.getContractFactory('StaderStakePoolsManager') | ||
const staderStakingPoolManager = await upgrades.deployProxy(poolManagerFactory, [admin, staderConfig.address]) | ||
const staderStakingPoolManager = await upgrades.deployProxy(poolManagerFactory, [externalAdmin, staderConfig.address]) | ||
console.log('staderStakingPoolManager deployed at ', staderStakingPoolManager.address) | ||
|
||
const userWithdrawFactory = await ethers.getContractFactory('UserWithdrawalManager') | ||
const userWithdrawManager = await upgrades.deployProxy(userWithdrawFactory, [admin, staderConfig.address]) | ||
const userWithdrawManager = await upgrades.deployProxy(userWithdrawFactory, [externalAdmin, staderConfig.address]) | ||
console.log('userWithdrawManager deployed at ', userWithdrawManager.address) | ||
|
||
const NodeELRewardVault = await ethers.getContractFactory('NodeELRewardVault') | ||
const nodeELRewardVault = await NodeELRewardVault.deploy() | ||
await nodeELRewardVault.deployed() | ||
console.log('nodeELRewardVault ', nodeELRewardVault.address) | ||
|
||
// Grant Role | ||
// const minterRole = await ETHxToken.MINTER_ROLE() | ||
// await ETHxToken.grantRole(minterRole, staderStakingPoolManager.address) | ||
// console.log('granted minter role to pool manager') | ||
|
||
// const burnerRole = await ETHxToken.BURNER_ROLE() | ||
// await ETHxToken.grantRole(burnerRole, userWithdrawManager.address) | ||
// console.log('granted burner role to user withdraw manager') | ||
|
||
// const nodeRegistryContract = await vaultFactoryInstance.NODE_REGISTRY_CONTRACT() | ||
// await vaultFactoryInstance.grantRole(nodeRegistryContract, permissionlessNodeRegistry.address) | ||
// await vaultFactoryInstance.grantRole(nodeRegistryContract, permissionedNodeRegistry.address) | ||
// console.log('granted node registry role to permissioned and permissionless node registries') | ||
|
||
// const managerRole = await staderConfig.MANAGER() | ||
// await staderConfig.grantRole(managerRole, manager) | ||
// console.log(`granted manager role to ${manager}`) | ||
|
||
// const operatorRole = await staderConfig.OPERATOR() | ||
// await staderConfig.grantRole(operatorRole, operator.address) | ||
// console.log(`granted operator role to ${operator.address}`) | ||
|
||
//update stader config admin at the last so we can update all contract address with stader internal admin | ||
|
||
//Setter | ||
|
||
// const addPool1Txn = await poolUtilsInstance | ||
// .connect(operator.address) | ||
// .addNewPool(permissionlessPoolId, permissionlessPool.address) | ||
// addPool1Txn.wait() | ||
// console.log('permission less pool added') | ||
const ValidatorWithdrawalVault = await ethers.getContractFactory('ValidatorWithdrawalVault') | ||
const validatorWithdrawalVault = await ValidatorWithdrawalVault.deploy() | ||
await validatorWithdrawalVault.deployed() | ||
console.log('validatorWithdrawalVault ', validatorWithdrawalVault.address) | ||
|
||
// const addPool2Txn = await poolUtilsInstance.connect(operator.address).addNewPool(permissionedPoolId, permissionedPool.address) | ||
// addPool2Txn.wait() | ||
// console.log('permissioned pool added') | ||
} | ||
|
||
main() |