Skip to content

Commit

Permalink
Merge pull request #107 from stakedotlink/metis-staking-test-scripts
Browse files Browse the repository at this point in the history
metis test deployment scripts
  • Loading branch information
BkChoy authored Jun 13, 2024
2 parents 61d63ee + 6bd84c6 commit a93a16d
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/test/deploy/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs'
import { deployCore } from './modules/deploy-core'
import { deployLINKStaking } from './modules/deploy-link-staking'
import { deployMETISStaking } from './modules/deploy-metis-staking'
import { deployTestContracts } from './modules/deploy-test-contracts'

const path = './deployments/localhost.json'
Expand All @@ -13,6 +14,7 @@ async function main() {
await deployTestContracts()
await deployCore()
await deployLINKStaking()
await deployMETISStaking()
}

main()
Expand Down
118 changes: 118 additions & 0 deletions scripts/test/deploy/modules/deploy-metis-staking.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import {
ERC20,
ERC677,
PriorityPool,
SDLPoolPrimary,
StakingPool,
} from '../../../../typechain-types'
import {
updateDeployments,
deploy,
getContract,
deployUpgradeable,
} from '../../../utils/deployment'
import { getAccounts, toEther } from '../../../utils/helpers'

async function deploySequencerVCS() {
const metisToken = (await getContract('METISToken')) as ERC20
const stakingPool = (await getContract('METIS_StakingPool')) as StakingPool

const sequencerVCS = await deployUpgradeable('StrategyMock', [
metisToken.address,
stakingPool.address,
toEther(100),
toEther(100000),
])
console.log('SequencerVCS deployed: ', sequencerVCS.address)

await (await stakingPool.addStrategy(sequencerVCS.address)).wait()

updateDeployments(
{ METIS_SequencerVCS: sequencerVCS.address },
{ METIS_SequencerVCS: 'SequencerVCS' }
)
}

// Wrapped stMETIS
const WrappedSDTokenArgs = {
name: 'Wrapped stMETIS', // wrapped token name
symbol: 'wstMETIS', // wrapped token symbol
}
// METIS Staking Pool
const StakingPoolArgs = {
derivativeTokenName: 'Staked METIS', // METIS liquid staking token name
derivativeTokenSymbol: 'stMETIS', // METIS liquid staking token symbol
fees: [], // fee receivers & percentage amounts in basis points
}
// LINK Priority Pool
const PriorityPoolArgs = {
queueDepositMin: toEther(1000), // min amount of tokens neede to execute deposit
queueDepositMax: toEther(200000), // max amount of tokens in a single deposit tx
}

export async function deployMETISStaking() {
const { accounts } = await getAccounts()
const sdlPoolPrimary = (await getContract('SDLPoolPrimary')) as SDLPoolPrimary

const metisToken = (await deploy('contracts/core/tokens/base/ERC677.sol:ERC677', [
'Metis',
'METIS',
1000000,
])) as ERC677
console.log('METISToken deployed: ', metisToken.address)

const stakingPool = (await deployUpgradeable('StakingPool', [
metisToken.address,
StakingPoolArgs.derivativeTokenName,
StakingPoolArgs.derivativeTokenSymbol,
StakingPoolArgs.fees,
])) as StakingPool
console.log('METIS_StakingPool deployed: ', stakingPool.address)

const priorityPool = (await deployUpgradeable('PriorityPool', [
metisToken.address,
stakingPool.address,
sdlPoolPrimary.address,
PriorityPoolArgs.queueDepositMin,
PriorityPoolArgs.queueDepositMax,
])) as PriorityPool
console.log('METIS_PriorityPool deployed: ', priorityPool.address)

const wsdToken = await deploy('WrappedSDToken', [
stakingPool.address,
WrappedSDTokenArgs.name,
WrappedSDTokenArgs.symbol,
])
console.log('METIS_WrappedSDToken token deployed: ', wsdToken.address)

const stMetisSDLRewardsPool = await deploy('RewardsPoolWSD', [
sdlPoolPrimary.address,
stakingPool.address,
wsdToken.address,
])
console.log('stMetis_SDLRewardsPool deployed: ', stMetisSDLRewardsPool.address)

await (await stakingPool.addFee(stMetisSDLRewardsPool.address, 1000)).wait()
await (await sdlPoolPrimary.addToken(stakingPool.address, stMetisSDLRewardsPool.address)).wait()
await (await stakingPool.setPriorityPool(priorityPool.address)).wait()
await (await priorityPool.setDistributionOracle(accounts[0])).wait()

updateDeployments(
{
METISToken: metisToken.address,
METIS_StakingPool: stakingPool.address,
METIS_PriorityPool: priorityPool.address,
METIS_WrappedSDToken: wsdToken.address,
stMETIS_SDLRewardsPool: stMetisSDLRewardsPool.address,
},
{
METISToken: 'contracts/core/tokens/base/ERC677.sol:ERC677',
METIS_StakingPool: 'StakingPool',
METIS_PriorityPool: 'PriorityPool',
METIS_WrappedSDToken: 'WrappedSDToken',
stMETIS_SDLRewardsPool: 'RewardsPoolWSD',
}
)

await deploySequencerVCS()
}

0 comments on commit a93a16d

Please sign in to comment.