Skip to content

Commit

Permalink
reSDL and priority pool deployment/upgrade scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
BkChoy committed Sep 14, 2023
1 parent 3469bd2 commit 89b3363
Show file tree
Hide file tree
Showing 9 changed files with 957 additions and 138 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.4
16.20.2
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"@nomiclabs/hardhat-waffle": "^2.0.2",
"@openzeppelin/hardhat-upgrades": "1.28.0",
"@openzeppelin/merkle-tree": "^1.0.5",
"@safe-global/api-kit": "^1.3.1",
"@safe-global/protocol-kit": "^1.3.0",
"@safe-global/safe-core-sdk-types": "^2.3.0",
"@typechain/ethers-v5": "^9.0.0",
"@typechain/hardhat": "^4.0.0",
"@types/chai": "^4.3.0",
Expand Down
95 changes: 0 additions & 95 deletions scripts/core/mint-initial-sdl.ts

This file was deleted.

38 changes: 0 additions & 38 deletions scripts/core/upgrade-delegator-pool.ts

This file was deleted.

6 changes: 4 additions & 2 deletions scripts/linkStaking/deploy-link-staking-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const LINK_StakingPool = {
}
// LINK Priority Pool
const LINK_PriorityPool = {
queueDepositThreshold: toEther(1000), // min amount of tokens neede to execute deposit
queueDepositMin: toEther(1000), // min amount of tokens neede to execute deposit
queueDepositMax: toEther(200000), // max amount of tokens in a single deposit tx}
}

async function main() {
Expand All @@ -34,7 +35,8 @@ async function main() {
linkToken.address,
stakingPool.address,
sdlPool.address,
LINK_PriorityPool.queueDepositThreshold,
LINK_PriorityPool.queueDepositMin,
LINK_PriorityPool.queueDepositMax,
])
console.log('LINK_PriorityPool deployed: ', priorityPool.address)

Expand Down
45 changes: 45 additions & 0 deletions scripts/prod/deploy-priority-pool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { ERC677, PriorityPool, SDLPool, StakingPool } from '../../typechain-types'
import { updateDeployments, getContract, deployUpgradeable } from '../utils/deployment'
import { toEther } from '../utils/helpers'

const multisigAddress = '0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D'

// LINK Priority Pool
const LINK_PriorityPool = {
queueDepositMin: toEther(5000), // min amount of tokens needed to execute deposit
queueDepositMax: toEther(200000), // max amount of tokens in a single deposit tx
}

async function main() {
const linkToken = (await getContract('LINKToken')) as ERC677
const sdlPool = (await getContract('SDLPool')) as SDLPool
const stakingPool = (await getContract('LINK_StakingPool')) as StakingPool

const priorityPool = (await deployUpgradeable('PriorityPool', [
linkToken.address,
stakingPool.address,
sdlPool.address,
LINK_PriorityPool.queueDepositMin,
LINK_PriorityPool.queueDepositMax,
])) as PriorityPool
console.log('LINK_PriorityPool deployed: ', priorityPool.address)

let tx = await priorityPool.transferOwnership(multisigAddress)
await tx.wait()

updateDeployments(
{
LINK_PriorityPool: priorityPool.address,
},
{
LINK_PriorityPool: 'PriorityPool',
}
)
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
76 changes: 76 additions & 0 deletions scripts/prod/deploy-sdl-pool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import {
DelegatorPool,
ERC677,
LinearBoostController,
SDLPool,
StakingPool,
WrappedSDToken,
} from '../../typechain-types'
import { updateDeployments, deploy, getContract, deployUpgradeable } from '../utils/deployment'

const multisigAddress = '0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D'

// Linear Boost Controller
const LinearBoostControllerParams = {
maxLockingDuration: 4 * 365 * 86400, // maximum locking duration
maxBoost: 8, // maximum boost amount
}
// SDL Pool
const SDLPoolParams = {
derivativeTokenName: 'Reward Escrowed SDL', // SDL staking derivative token name
derivativeTokenSymbol: 'reSDL', // SDL staking derivative token symbol
}

async function main() {
const sdlToken = (await getContract('SDLToken')) as ERC677
const delegatorPool = (await getContract('DelegatorPool')) as DelegatorPool
const stakingPool = (await getContract('LINK_StakingPool')) as StakingPool
const wsdToken = (await getContract('LINK_WrappedSDToken')) as WrappedSDToken

const lbc = (await deploy('LinearBoostController', [
LinearBoostControllerParams.maxLockingDuration,
LinearBoostControllerParams.maxBoost,
])) as LinearBoostController
console.log('LinearBoostController deployed: ', lbc.address)

const sdlPool = (await deployUpgradeable('SDLPool', [
SDLPoolParams.derivativeTokenName,
SDLPoolParams.derivativeTokenSymbol,
sdlToken.address,
lbc.address,
delegatorPool.address,
])) as SDLPool
console.log('SDLPool deployed: ', sdlPool.address)

const stLinkSDLRewardsPool = await deploy('RewardsPoolWSD', [
sdlPool.address,
stakingPool.address,
wsdToken.address,
])
console.log('stLINK_SDLRewardsPool deployed: ', stLinkSDLRewardsPool.address)

let tx = await sdlPool.addToken(stakingPool.address, stLinkSDLRewardsPool.address)
await tx.wait()

tx = await lbc.transferOwnership(multisigAddress)
await tx.wait()

tx = await sdlPool.transferOwnership(multisigAddress)
await tx.wait()

updateDeployments(
{
LinearBoostController: lbc.address,
SDLPool: sdlPool.address,
stLINK_SDLRewardsPool: stLinkSDLRewardsPool.address,
},
{ stLINK_SDLRewardsPool: 'RewardsPoolWSD' }
)
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
Loading

0 comments on commit 89b3363

Please sign in to comment.