Skip to content

Commit

Permalink
deployed metis staking contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
BkChoy committed Dec 10, 2024
1 parent 4f9e567 commit 19642be
Show file tree
Hide file tree
Showing 14 changed files with 2,556 additions and 364 deletions.
625 changes: 625 additions & 0 deletions .openzeppelin/mainnet.json

Large diffs are not rendered by default.

1,561 changes: 1,561 additions & 0 deletions .openzeppelin/unknown-1088.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/metisStaking/L1Strategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ contract L1Strategy is UUPSUpgradeable, OwnableUpgradeable {
* @param _token address of METIS token
* @param _lockingInfo address of Metis locking info contract
* @param _vaultImplementation address of the implementation contract to use when deploying new vaults
* @param _rewardRecipient address on l2 that will claimed receive rewards
* @param _rewardRecipient address on l2 that will receive claimed rewards
* @param _minRewardsToClaim min amount of rewards required to relock/claim in vaults on a call to updateDeposits
* @param _operatorRewardPercentage basis point amount of an operator's earned rewards that they receive
**/
Expand Down
6 changes: 3 additions & 3 deletions contracts/metisStaking/L2Transmitter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ contract L2Transmitter is UUPSUpgradeable, OwnableUpgradeable, CCIPReceiverUpgra
* @return fee in native token
**/
function getExecuteUpdateFee() external view returns (uint256) {
uint256 depositFee = l2StandardBridgeGasOracle.minErc20BridgeCost();
uint256 bridgeFee = l2StandardBridgeGasOracle.minErc20BridgeCost();

Client.EVM2AnyMessage memory evm2AnyMessage = _buildCCIPMessage(type(uint256).max);
uint256 withdrawalFee = IRouterClient(getRouter()).getFee(l1ChainSelector, evm2AnyMessage);
uint256 ccipFee = IRouterClient(getRouter()).getFee(l1ChainSelector, evm2AnyMessage);

return MathUpgradeable.max(depositFee, withdrawalFee);
return bridgeFee + ccipFee;
}

/**
Expand Down
33 changes: 10 additions & 23 deletions deployments/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,33 +175,20 @@
"address": "0x6C1E2D2c55C83De945e3f37dF694cdE8452C1E82",
"artifact": "WrappedTokenBridge"
},
"METIS_StakingPool": {
"address": "0x6301330F485b2732048Ce701286731e399acd799",
"artifact": "StakingPool"
},
"METIS_SequencerVCS": {
"address": "0x2FD2b375bE982d7464b39E8668AB6AD31fF6Db67",
"artifact": "SequencerVCS"
"METIS_L1Strategy": {
"address": "0x93c3d7039743f0a8cdB6D3e240f07153F2B52Ef1",
"artifact": "L1Strategy"
},
"METIS_SequencerRewardsCCIPReceiver": {
"address": "0x49cCA9f37373041B1B29e15e3Eb8C6c205C200de",
"artifact": "SequencerRewardsCCIPReceiver"
"METIS_L1Transmitter": {
"address": "0x5e2A7B992769E43D4E76a4bB92de9c0532F25Cde",
"artifact": "L1Transmitter"
},
"METIS_PriorityPool": {
"address": "0x7498a1f8d3B537804144719b4076DcE110a34902",
"artifact": "PriorityPool"
"wstMETIS_SDLRewardsPool": {
"address": "0x19282e0365a5b90c9864446448E29465A9d226Eb",
"artifact": "RewardsPool"
},
"METIS_WrappedSDToken": {
"address": "0xB127D349eedB755C8ebAbf116d126B58F7B29Cbc",
"address": "0xd7cf0e0fC12fB97e03841CE4f3086dB327CE0F2B",
"artifact": "WrappedSDToken"
},
"stMETIS_SDLRewardsPool": {
"address": "0xc3dbba165C92e6d6efA3394ff67D219Ebe1DF6bB",
"artifact": "RewardsPoolWSD"
},
"METIS_PP_DistributionOracle": {
"address": "0xc8d54e58981009c04037a6ee7d4fc32d0f4da9be",
"artifact": "DistributionOracle"
}

}
47 changes: 28 additions & 19 deletions deployments/metis.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
{
"METISToken": {
"address": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",
"artifact": "@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20"
},
"METIS_SequencerRewardsCCIPSender": {
"address": "0x8d87CBD8C3632b7ef117A15F8100943a23b7D03b",
"artifact": "SequencerRewardsCCIPSender"
},
"METIS_WrappedSDToken": {
"address": "0xB6196B3B89981483C27ab642b27743a62c3D68aC",
"artifact": "BurnMintERC677"
}
"METISToken": {
"address": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",
"artifact": "@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20"
},
"METIS_StakingPool": {
"address": "0x19282e0365a5b90c9864446448E29465A9d226Eb",
"artifact": "StakingPool"
},
"METIS_L2Strategy": {
"address": "0xfb8256CFCeeAcfb4835a3EbF47EBEa2902e30567",
"artifact": "L2Strategy"
},
"METIS_L2Transmitter": {
"address": "0xc4bAf9Df7Da0dB146D8AeDEe447246ed47b4c2E4",
"artifact": "L2Transmitter"
},
"METIS_PriorityPool": {
"address": "0xbEF37783DC468050722db5053F19E1cC91C80E3b",
"artifact": "PriorityPool"
},
"METIS_WithdrawalPool": {
"address": "0xa68285a07F683a447775E19D50a06Cd6748a4fAe",
"artifact": "WithdrawalPool"
},
"METIS_WrappedSDToken": {
"address": "0x7F89e4A071136f8E3Ec12D8F87793Dc84038C054",
"artifact": "WrappedSDToken"
}
}







157 changes: 157 additions & 0 deletions scripts/prod/1.0.0-metis-staking/1-deploy-metis-staking-l2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import { ethers } from 'hardhat'
import { ERC20, PriorityPool, StakingPool } from '../../../typechain-types'
import { updateDeployments, deploy, getContract, deployUpgradeable } from '../../utils/deployment'
import { toEther } from '../../utils/helpers'
import { L2Strategy } from '../../../typechain-types/contracts/metisStaking/L2Strategy'

// 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: [
['0x23c4602e63ACfe29b930c530B19d44a84AF0d767', 300],
['0x23c4602e63ACfe29b930c530B19d44a84AF0d767', 600],
['0x04a0CF74fa31d75CFf4b87823cC44353c7be4dE4', 300],
], // fee receivers & percentage amounts in basis points
unusedDepositLimit: toEther(1000), // max number of tokens that can sit in the pool outside of a strategy
}
// L2 Strategy
const L2StrategyArgs = {
fees: [], // list of fees to be paid on rewards
maxDeposits: toEther(1), // maximum amount of deposits strategy can hold
}
// METIS Priority Pool
const PriorityPoolArgs = {
queueDepositMin: toEther(500), // min amount of tokens needed to execute deposit
queueDepositMax: toEther(100000), // max amount of tokens in a single deposit tx
allowInstantWithdrawals: true, // whether instant withdrawals are enabled
}
// Withdrawal Pool
const WithdrawalPoolArgs = {
minWithdrawalAmount: toEther(1), // minimum amount of LSTs that can be queued for withdrawal
minTimeBetweenWithdrawals: 86400, // min amount of time between execution of withdrawals
}
// L2 Transmitter
const L2TransmitterArgs = {
l2StandardBridge: '0x4200000000000000000000000000000000000010', // address of the L2 standard bridge
l2StandardBridgeGasOracle: '0x420000000000000000000000000000000000000F', // address of OVM_GasPriceOracle
minDepositThreshold: toEther(5000), // must exceed this amount of queued tokens to deposit to L1
minTimeBetweenUpdates: 86400 * 7, // min amount of time between calls to executeUpdate
ccipRouter: '0x7b9FB8717D306e2e08ce2e1Efa81F026bf9AD13c', // address of CCIP router
l1ChainSelector: '5009297550715157269', // CCIP selector for L1
extraArgs:
'0x97a657c9' + ethers.AbiCoder.defaultAbiCoder().encode(['uint256'], [500000]).slice(2), // extra args for CCIP messaging
}

async function main() {
const metisToken = (await getContract('METISToken', true)) as ERC20

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

const priorityPool = (await deployUpgradeable(
'PriorityPool',
[
metisToken.target,
stakingPool.target,
ethers.ZeroAddress,
PriorityPoolArgs.queueDepositMin,
PriorityPoolArgs.queueDepositMax,
PriorityPoolArgs.allowInstantWithdrawals,
],
true
)) as PriorityPool
console.log('METIS_PriorityPool deployed: ', priorityPool.target)

const withdrawalPool = await deployUpgradeable(
'WithdrawalPool',
[
metisToken.target,
stakingPool.target,
priorityPool.target,
WithdrawalPoolArgs.minWithdrawalAmount,
WithdrawalPoolArgs.minTimeBetweenWithdrawals,
],
true
)
console.log('METIS_WithdrawalPool deployed: ', withdrawalPool.target)

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

const l2Strategy = (await deployUpgradeable(
'L2Strategy',
[metisToken.target, stakingPool.target, L2StrategyArgs.fees, L2StrategyArgs.maxDeposits],
true
)) as L2Strategy
console.log('METIS_L2Strategy deployed: ', l2Strategy.target)

const l2Transmitter = await deployUpgradeable(
'L2Transmitter',
[
metisToken.target,
l2Strategy.target,
L2TransmitterArgs.l2StandardBridge,
L2TransmitterArgs.l2StandardBridgeGasOracle,
ethers.ZeroAddress,
withdrawalPool.target,
L2TransmitterArgs.minDepositThreshold,
L2TransmitterArgs.minTimeBetweenUpdates,
L2TransmitterArgs.ccipRouter,
L2TransmitterArgs.l1ChainSelector,
L2TransmitterArgs.extraArgs,
],
true
)
console.log('METIS_L2Transmitter deployed: ', l2Transmitter.target)

await (await stakingPool.setPriorityPool(priorityPool.target)).wait()
await (await stakingPool.addStrategy(l2Strategy.target)).wait()
await (await l2Strategy.setL2Transmitter(l2Transmitter.target)).wait()
await (await priorityPool.setWithdrawalPool(withdrawalPool.target)).wait()

updateDeployments(
{
METIS_StakingPool: stakingPool.target.toString(),
METIS_L2Strategy: l2Strategy.target.toString(),
METIS_L2Transmitter: l2Transmitter.target,
METIS_PriorityPool: priorityPool.target.toString(),
METIS_WithdrawalPool: withdrawalPool.target,
METIS_WrappedSDToken: wsdToken.target,
},
{
METIS_StakingPool: 'StakingPool',
METIS_L2Strategy: 'L2Strategy',
METIS_L2Transmitter: 'L2Transmitter',
METIS_PriorityPool: 'PriorityPool',
METIS_WithdrawalPool: 'WithdrawalPool',
METIS_WrappedSDToken: 'WrappedSDToken',
}
)
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
94 changes: 0 additions & 94 deletions scripts/prod/1.0.0-metis-staking/1-deploy-rewards-sender.ts

This file was deleted.

Loading

0 comments on commit 19642be

Please sign in to comment.