Skip to content

Commit

Permalink
tt
Browse files Browse the repository at this point in the history
  • Loading branch information
BkChoy committed Dec 5, 2024
1 parent f33bc40 commit 956d6ce
Show file tree
Hide file tree
Showing 11 changed files with 2,339 additions and 26 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.

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
16 changes: 16 additions & 0 deletions deployments/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,21 @@
"stLINK_WrappedTokenBridge": {
"address": "0x6C1E2D2c55C83De945e3f37dF694cdE8452C1E82",
"artifact": "WrappedTokenBridge"
},
"METIS_L1Strategy": {
"address": "0x93c3d7039743f0a8cdB6D3e240f07153F2B52Ef1",
"artifact": "L1Strategy"
},
"METIS_L1Transmitter": {
"address": "0x5e2A7B992769E43D4E76a4bB92de9c0532F25Cde",
"artifact": "L1Transmitter"
},
"wstMETIS_SDLRewardsPool": {
"address": "0x19282e0365a5b90c9864446448E29465A9d226Eb",
"artifact": "RewardsPool"
},
"METIS_WrappedSDToken": {
"address": "0xd7cf0e0fC12fB97e03841CE4f3086dB327CE0F2B",
"artifact": "WrappedSDToken"
}
}
39 changes: 28 additions & 11 deletions deployments/metis.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
{
"METISToken": {
"address": "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",
"artifact": "@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20"
}
"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"
}
}







12 changes: 7 additions & 5 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import '@nomicfoundation/hardhat-toolbox'
import '@nomicfoundation/hardhat-ledger'
import '@openzeppelin/hardhat-upgrades'

export const ledgerAccount = '0x23c4602e63ACfe29b930c530B19d44a84AF0d767'
export const ledgerAccount = '0x43975fe745cB4171E15ceEd5d8D05A3502e0e87B'

const balance = '100000000000000000000000'
const accounts = [
'f94a316b776d40462fe47bf4b97903c5e5b51db4c86b58cbac7a7128d675e817',
'c3381a96fa2be2aae2f2798e0887272e634417710aa09ecad9328754cdc8db8a', //0x11187eff852069a33d102476b2E8A9cc9167dAde
'33a3d35ee3408a701f0ff775390ede800f728562ed656ec0036f9e4fd96e7d5b', //0x2228bdc8584595DfefA75597C96B13c00a2D88C2
'fd52fbad9cb1258e30e6f83d1f2ecb2f6702887c1444d968133f41f3edb3f566', //0x33375555d73620FefD26cD083c425759a259FA18
Expand Down Expand Up @@ -39,12 +40,12 @@ const config: HardhatUserConfig = {
accounts,
},
mainnet: {
url: '',
ledgerAccounts: [ledgerAccount],
url: 'https://1rpc.io/eth',
accounts,
},
metis: {
url: '',
ledgerAccounts: [ledgerAccount],
url: 'https://andromeda.metis.io/?owner=1088',
accounts,
},
testnet: {
url: '',
Expand All @@ -61,6 +62,7 @@ const config: HardhatUserConfig = {
},
etherscan: {
apiKey: {
mainnet: 'GV3837YRY145BWPQEQEI4WVHTEQVMWTW1X',
metis: 'metis',
},
customChains: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ethers } from 'hardhat'
import { ERC20, PriorityPool, StakingPool } from '../../../typechain-types'
import { updateDeployments, deploy, getContract, deployUpgradeable } from '../../utils/deployment'
import { toEther, switchNetwork } from '../../utils/helpers'
import { toEther } from '../../utils/helpers'
import { L2Strategy } from '../../../typechain-types/contracts/metisStaking/L2Strategy'

// Wrapped stMETIS
Expand Down Expand Up @@ -49,8 +49,6 @@ const L2TransmitterArgs = {
}

async function main() {
await switchNetwork(1088, '')

const metisToken = (await getContract('METISToken', true)) as ERC20

const stakingPool = (await deployUpgradeable(
Expand Down
12 changes: 8 additions & 4 deletions scripts/prod/1.0.0-metis-staking/2-deploy-metis-staking-l1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {
} from '../../utils/deployment'
import { L1Strategy } from '../../../typechain-types/contracts/metisStaking/L1Strategy'
import { toEther } from '../../utils/helpers'
import { ethers } from 'hardhat'

const l2Transmitter = ''
const l2Transmitter = '0xc4bAf9Df7Da0dB146D8AeDEe447246ed47b4c2E4'

// wstMETIS
const wstMETISArgs = {
Expand All @@ -24,15 +25,16 @@ const L1StrategyArgs = {
}
// L1Transmitter
const L1TransmitterArgs = {
depositController: '', // address authorized to deposit queued tokens
depositController: '0x43975fe745cB4171E15ceEd5d8D05A3502e0e87B', // address authorized to deposit queued tokens
l1StandardBridge: '0x3980c9ed79d2c191A89E02Fa3529C60eD6e9c04b', // address of the L1 standard bridge
l1StandardBridgeGasOracle: '0x7f6B0b7589febc40419a8646EFf9801b87397063', // address of MVM_DiscountOracle
l2ChainId: '1088', // chain id of L2
l2MetisToken: '0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000', // address of METIS token on L2
minWithdrawalThreshold: toEther(200), // must exceed this amount of withdrawable tokens to withdraw to L2
ccipRouter: '0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D', // address of CCIP router
l2ChainSelector: '8805746078405598895', // CCIP chain selector for L2
extraArgs: '', // extra args for outgoing CCIP messages
extraArgs:
'0x97a657c9' + ethers.AbiCoder.defaultAbiCoder().encode(['uint256'], [500000]).slice(2), // extra args for CCIP messaging
}

async function main() {
Expand All @@ -44,7 +46,7 @@ async function main() {
[wstMETISArgs.name, wstMETISArgs.symbol, wstMETISArgs.decimals, 0],
true
)
console.log('METIS_WrappedSDToken deployed: ', await wrappedSDToken.getAddress())
console.log('METIS_WrappedSDToken deployed: ', wrappedSDToken.target)

const vaultImpAddress = (await deployImplementation('SequencerVault', true)) as string
console.log('SequencerVault implementation deployed: ', vaultImpAddress)
Expand Down Expand Up @@ -96,11 +98,13 @@ async function main() {
METIS_L1Strategy: l1Strategy.target.toString(),
METIS_L1Transmitter: l1Transmitter.target,
wstMETIS_SDLRewardsPool: wstMetisSDLRewardsPool.target,
METIS_WrappedSDToken: wrappedSDToken.target,
},
{
METIS_L1Strategy: 'L1Strategy',
METIS_L1Transmitter: 'L1Transmitter',
wstMETIS_SDLRewardsPool: 'RewardsPool',
METIS_WrappedSDToken: 'WrappedSDToken',
}
)
}
Expand Down
24 changes: 24 additions & 0 deletions scripts/prod/1.0.0-metis-staking/99-transfer-ownership-l2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { getContract } from '../../utils/deployment'

const owner = '0x43975fe745cB4171E15ceEd5d8D05A3502e0e87B'

async function main() {
const stakingPool = await getContract('METIS_StakingPool')
const l2Strategy = await getContract('METIS_L2Strategy')
const l2Transmitter = await getContract('METIS_L2Transmitter')
const pp = await getContract('METIS_PriorityPool')
const wp = await getContract('METIS_WithdrawalPool')

await (await stakingPool.transferOwnership(owner)).wait()
await (await l2Strategy.transferOwnership(owner)).wait()
await (await l2Transmitter.transferOwnership(owner)).wait()
await (await pp.transferOwnership(owner)).wait()
await (await wp.transferOwnership(owner)).wait()
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
18 changes: 18 additions & 0 deletions scripts/prod/1.0.0-metis-staking/999-transfer-ownership-l1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { getContract } from '../../utils/deployment'

const owner = '0x43975fe745cB4171E15ceEd5d8D05A3502e0e87B'

async function main() {
const l1Strategy = await getContract('METIS_L1Strategy')
const l1Transmitter = await getContract('METIS_L1Transmitter')

await (await l1Strategy.transferOwnership(owner)).wait()
await (await l1Transmitter.transferOwnership(owner)).wait()
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
48 changes: 48 additions & 0 deletions scripts/prod/1.0.0-metis-staking/t.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { ethers } from 'hardhat'
import { deployUpgradeable } from '../../utils/deployment'
import { toEther } from '../../utils/helpers'

const L2TransmitterArgs = {
l2StandardBridge: '0x4200000000000000000000000000000000000010', // address of the L2 standard bridge
l2StandardBridgeGasOracle: '0x420000000000000000000000000000000000000F', // address of OVM_GasPriceOracle
minDepositThreshold: toEther(1000), // 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
}

const metisToken = '0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000'
const l2Strategy = '0xfb8256CFCeeAcfb4835a3EbF47EBEa2902e30567'
const withdrawalPool = '0xa68285a07F683a447775E19D50a06Cd6748a4fAe'

const l1Transmitter = '0x5e2A7B992769E43D4E76a4bB92de9c0532F25Cde'

async function main() {
const l2Transmitter = await deployUpgradeable(
'L2Transmitter',
[
metisToken,
l2Strategy,
L2TransmitterArgs.l2StandardBridge,
L2TransmitterArgs.l2StandardBridgeGasOracle,
l1Transmitter,
withdrawalPool,
L2TransmitterArgs.minDepositThreshold,
L2TransmitterArgs.minTimeBetweenUpdates,
L2TransmitterArgs.ccipRouter,
L2TransmitterArgs.l1ChainSelector,
L2TransmitterArgs.extraArgs,
],
true
)
console.log('METIS_L2Transmitter deployed: ', l2Transmitter.target)
}

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

0 comments on commit 956d6ce

Please sign in to comment.