Skip to content

Commit

Permalink
update scripts (stader-labs#160)
Browse files Browse the repository at this point in the history
* update scripts

* set commission change

---------

Co-authored-by: Sanjay Yadav <[email protected]>
  • Loading branch information
sanjay-staderlabs and Sanjay Yadav authored May 27, 2023
1 parent bd9fd16 commit cd285b0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 37 deletions.
13 changes: 7 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
SOCIALIZING_POOL_CYCLE_DURATION=
SOCIALIZING_POOL_OPT_IN_COOL_DOWN_PERIOD=
REWARD_THRESHOLD=
MIN_BLOCK_DELAY_TO_FINALIZE_REQUEST=
STADER_ADMIN=
EXTERNAL_ADMIN=
STADER_TREASURY=
ETH_DEPOSIT_CONTRACT=
RATED_ORACLE=
RATED=
STADER_CONFIG=
VAULT_FACTORY=
AUCTION=
ETHx=
SD_TOKEN=
OPERATOR_REWARD_COLLECTOR=
PENALTY=
PERMISSIONED_NODE_REGISTRY=
PERMISSIONED_POOL=
Expand All @@ -24,8 +23,10 @@ INSURANCE_FUND=
STADER_ORACLE=
STAKE_POOL_MANAGER=
USER_WITHDRAW_MANAGER=
NODE_EL_REWARD_VAULT_IMPL=
WITHDRAW_VAULT_IMPL=

OWNER_PRIVATE_KEY=
GAS_PRICE=
API_KEY=
PROVIDER_URL=
PROVIDER_URL=
7 changes: 0 additions & 7 deletions contracts/PermissionedPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,6 @@ contract PermissionedPool is IStaderPoolBase, Initializable, AccessControlUpgrad
if (_protocolFee + _operatorFee > MAX_COMMISSION_LIMIT_BIPS) {
revert InvalidCommission();
}
if (protocolFee == _protocolFee) {
revert ProtocolFeeUnchanged();
}
if (operatorFee == _operatorFee) {
revert OperatorFeeUnchanged();
}

protocolFee = _protocolFee;
operatorFee = _operatorFee;

Expand Down
7 changes: 0 additions & 7 deletions contracts/PermissionlessPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ contract PermissionlessPool is IStaderPoolBase, Initializable, AccessControlUpgr
if (_protocolFee + _operatorFee > MAX_COMMISSION_LIMIT_BIPS) {
revert InvalidCommission();
}
if (protocolFee == _protocolFee) {
revert ProtocolFeeUnchanged();
}
if (operatorFee == _operatorFee) {
revert OperatorFeeUnchanged();
}

protocolFee = _protocolFee;
operatorFee = _operatorFee;

Expand Down
2 changes: 0 additions & 2 deletions contracts/interfaces/IStaderPoolBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import './INodeRegistry.sol';

interface IStaderPoolBase {
// Errors
error ProtocolFeeUnchanged();
error OperatorFeeUnchanged();
error UnsupportedOperation();
error InvalidCommission();
error CouldNotDetermineExcessETH();
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const config: HardhatUserConfig = {
},
],
},
defaultNetwork: 'hardhat',
defaultNetwork: 'goerli',
networks: {
hardhat: {},
goerli: {
Expand Down
30 changes: 16 additions & 14 deletions scripts/deployContracts.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
import { ethers, upgrades } from 'hardhat'

async function main() {

console.log('starting deployment process...')
const tempAdmin = process.env.TEMP_ADMIN ?? ''
const staderAdmin = process.env.STADER_ADMIN ?? ''
const externalAdmin = process.env.EXTERNAL_ADMIN ?? ''
const ethDepositContract = process.env.ETH_DEPOSIT_CONTRACT ?? ''
const ratedOracle = process.env.RATED ?? ''

const StaderConfig = await ethers.getContractFactory('StaderConfig')
const staderConfig = await upgrades.deployProxy(StaderConfig, [tempAdmin, ethDepositContract])
const staderConfig = await upgrades.deployProxy(StaderConfig, [staderAdmin, ethDepositContract])
console.log('stader config deployed at ', staderConfig.address)

const vaultFactory = await ethers.getContractFactory('VaultFactory')
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, [
externalAdmin,
staderConfig.address
])
const auctionInstance = await upgrades.deployProxy(auctionFactory, [externalAdmin, staderConfig.address])
console.log('auction contract deployed at ', auctionInstance.address)

const ETHxFactory = await ethers.getContractFactory('ETHx')
const ETHxToken = await upgrades.deployProxy(ETHxFactory, [externalAdmin, staderConfig.address])
console.log('ETHx deployed at ', ETHxToken.address)

const operatorRewardCollectorFactory = await ethers.getContractFactory('OperatorRewardsCollector')
const operatorRewardCollector = await upgrades.deployProxy(operatorRewardCollectorFactory, [
externalAdmin,
staderConfig.address,
])
console.log('operator reward collector at ', operatorRewardCollector.address)

const penaltyFactory = await ethers.getContractFactory('Penalty')
const penaltyInstance = await upgrades.deployProxy(penaltyFactory, [externalAdmin, staderConfig.address, ratedOracle])
console.log('penalty contract deployed at ', penaltyInstance.address)
Expand All @@ -50,14 +53,14 @@ async function main() {
console.log('permissionlessNodeRegistry deployed at ', permissionlessNodeRegistry.address)

const permissionlessPoolFactory = await ethers.getContractFactory('PermissionlessPool')
const permissionlessPool = await upgrades.deployProxy(permissionlessPoolFactory, [externalAdmin, 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, [
externalAdmin,
staderConfig.address
])
const poolSelector = await upgrades.deployProxy(poolSelectorFactory, [externalAdmin, staderConfig.address])
console.log('poolSelector deployed at ', poolSelector.address)

const poolUtilsFactory = await ethers.getContractFactory('PoolUtils')
Expand Down Expand Up @@ -96,7 +99,7 @@ async function main() {
const userWithdrawFactory = await ethers.getContractFactory('UserWithdrawalManager')
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()
Expand All @@ -106,7 +109,6 @@ async function main() {
const validatorWithdrawalVault = await ValidatorWithdrawalVault.deploy()
await validatorWithdrawalVault.deployed()
console.log('validatorWithdrawalVault ', validatorWithdrawalVault.address)

}

main()
6 changes: 6 additions & 0 deletions scripts/verifyContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const vaultFactory = process.env.VAULT_FACTORY ?? ''
const auction = process.env.AUCTION ?? ''
const ETHxToken = process.env.ETHx ?? ''
const staderToken = process.env.SD_TOKEN ?? ''
const operatorRewardCollector = process.env.OPERATOR_REWARD_COLLECTOR ?? ''
const penaltyContract = process.env.PENALTY ?? ''
const permissionedNodeRegistry = process.env.PERMISSIONED_NODE_REGISTRY ?? ''
const permissionedPool = process.env.PERMISSIONED_POOL ?? ''
Expand All @@ -21,11 +22,14 @@ const insuranceFund = process.env.STADER_INSURANCE_FUND ?? ''
const staderOracle = process.env.STADER_ORACLE ?? ''
const stakePoolManager = process.env.STAKE_POOL_MANAGER ?? ''
const userWithdrawManager = process.env.USER_WITHDRAW_MANAGER ?? ''
const nodeELRewardVault = process.env.NODE_EL_REWARD_VAULT_IMPL ?? ''
const withdrawVaultImpl = process.env.WITHDRAW_VAULT_IMPL ?? ''

const contractAddresses = [
vaultFactory,
auction,
ETHxToken,
operatorRewardCollector,
penaltyContract,
permissionedNodeRegistry,
permissionedPool,
Expand All @@ -41,6 +45,8 @@ const contractAddresses = [
staderOracle,
stakePoolManager,
userWithdrawManager,
nodeELRewardVault,
withdrawVaultImpl,
]

async function main() {
Expand Down

0 comments on commit cd285b0

Please sign in to comment.