Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add task for staking upgrade #348

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"rust-analyzer.linkedProjects": ["gas-oracle/app/Cargo.toml", "prover/Cargo.toml"]
"rust-analyzer.linkedProjects": [
"gas-oracle/app/Cargo.toml",
"prover/Cargo.toml"
],
"cSpell.words": [
"ethgw",
"nomiclabs",
"predeploys",
"segw",
"undelegate",
"wethgw"
]
}
1 change: 1 addition & 0 deletions contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ yarn-error.log
!.yarn/plugins
.pnp.*
deployFile.json
newFile.json

dist
artifacts
Expand Down
4 changes: 2 additions & 2 deletions contracts/deploy/010-ProxyAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

export const deployProxyAdmin = async (
hre: HardhatRuntimeEnvironment,
Expand All @@ -25,7 +25,7 @@ export const deployProxyAdmin = async (
const contract = await Factory.deploy()
await contract.deployed()
console.log("%s=%s ; TX_HASH: %s", ProxyAdminImplStorageName, contract.address.toLocaleLowerCase(), contract.deployTransaction.hash);
// check params then storge
// check params then storage
await assertContractVariable(contract, 'owner', await deployer.getAddress())
const blockNumber = await hre.ethers.provider.getBlockNumber()
console.log("BLOCK_NUMBER: %s", blockNumber)
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/011-EmptyContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

export const deployEmptyContract = async (
hre: HardhatRuntimeEnvironment,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/012-Verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"
import { hexlify } from "ethers/lib/utils";

export const deployZkEvmVerifierV1 = async (
Expand Down
6 changes: 3 additions & 3 deletions contracts/deploy/013-DeployProxys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

export const deployContractProxyByStorageName = async (
hre: HardhatRuntimeEnvironment,
Expand Down Expand Up @@ -45,7 +45,7 @@ export const deployContractProxyByStorageName = async (
return ''
}

export const deployContractProxys = async (
export const deployContractProxies = async (
hre: HardhatRuntimeEnvironment,
path: string,
deployer: any,
Expand Down Expand Up @@ -162,4 +162,4 @@ export const deployContractProxys = async (
return ''
}

export default deployContractProxys
export default deployContractProxies
2 changes: 1 addition & 1 deletion contracts/deploy/014-DeployImpls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

export const deployContractImpls = async (
hre: HardhatRuntimeEnvironment,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/015-MessengerInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"
import { predeploys } from "../src";

export const MessengerInit = async (
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/016-RollupInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

export const RollupInit = async (
hre: HardhatRuntimeEnvironment,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/017-GatewayInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

export const GatewayInit = async (
hre: HardhatRuntimeEnvironment,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/018-StakingInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

export const StakingInit = async (
hre: HardhatRuntimeEnvironment,
Expand Down
32 changes: 15 additions & 17 deletions contracts/deploy/019-AdminTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import {
ImplStorageName,
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"


export const adminTransferByProxyStorageName = async (
export const AdminTransferByProxyStorageName = async (
hre: HardhatRuntimeEnvironment,
path: string,
deployer: any,
Expand All @@ -34,7 +33,6 @@ export const adminTransferByProxyStorageName = async (
}
if (admin !== deployerAddr) {
return `Proxy admin address ${admin} should deployer address ${deployerAddr}`

}
}
console.log(`change ${storageName} admin transfer from ${deployerAddr} to ProxyAdmin ${ProxyAdminImplAddr} `)
Expand Down Expand Up @@ -73,79 +71,79 @@ export const AdminTransfer = async (

// ************************ messenger contracts admin change ************************
// L1CrossDomainMessengerProxy admin change
let err = await adminTransferByProxyStorageName(hre, path, deployer, L1CrossDomainMessengerStorageName)
let err = await AdminTransferByProxyStorageName(hre, path, deployer, L1CrossDomainMessengerStorageName)
if (err != '') {
return err
}

// L1MessageQueueWithGasPriceOracleProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1MessageQueueWithGasPriceOracleProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1MessageQueueWithGasPriceOracleProxyStorageName)
if (err != '') {
return err
}

// ************************ staking contracts admin change ************************
// StakingProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1StakingProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1StakingProxyStorageName)
if (err != '') {
return err
}

// ************************ rollup contracts admin change ************************
// RollupProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, RollupProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, RollupProxyStorageName)
if (err != '') {
return err
}

// ************************ gateway contracts admin change ************************
// L1GatewayRouterProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1GatewayRouterProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1GatewayRouterProxyStorageName)
if (err != '') {
return err
}

// L1ETHGatewayProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1ETHGatewayProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1ETHGatewayProxyStorageName)
if (err != '') {
return err
}

// L1StandardERC20GatewayProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1StandardERC20GatewayProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1StandardERC20GatewayProxyStorageName)
if (err != '') {
return err
}

// L1CustomERC20GatewayProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1CustomERC20GatewayProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1CustomERC20GatewayProxyStorageName)
if (err != '') {
return err
}
// L1ERC721GatewayProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1ERC721GatewayProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1ERC721GatewayProxyStorageName)
if (err != '') {
return err
}

// L1ERC1155GatewayProxy admin change
err = await adminTransferByProxyStorageName(hre, path, deployer, L1ERC1155GatewayProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1ERC1155GatewayProxyStorageName)
if (err != '') {
return err
}

// EnforcedTxGatewayProxy admin change
// err = await adminTransferByProxyStorageName(hre, path, deployer, EnforcedTxGatewayProxyStorageName)
// err = await AdminTransferByProxyStorageName(hre, path, deployer, EnforcedTxGatewayProxyStorageName)
// if (err != '') {
// return err
// }

err = await adminTransferByProxyStorageName(hre, path, deployer, L1WETHGatewayProxyStorageName)
err = await AdminTransferByProxyStorageName(hre, path, deployer, L1WETHGatewayProxyStorageName)
if (err != '') {
return err
}

return ''
}

export default AdminTransfer
module.exports = { AdminTransfer, AdminTransferByProxyStorageName }
2 changes: 1 addition & 1 deletion contracts/deploy/020-ContractInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ProxyStorageName,
ContractFactoryName,
ImplStorageName,
} from "./types"
} from "../src/types"

export const ContractInit = async (
hre: HardhatRuntimeEnvironment,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/021-StakingRegister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ethers } from 'ethers'
import {
ProxyStorageName,
ContractFactoryName,
} from "./types"
} from "../src/types"

const two = BigInt(2)
const gwei = BigInt(1e9)
Expand Down
7 changes: 4 additions & 3 deletions contracts/deploy/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import deployProxyAdmin from './010-ProxyAdmin'
import deployEmptyContract from './011-EmptyContract'
import deployContractProxys from './013-DeployProxys'
import deployContractProxies from './013-DeployProxys'
import deployZkEvmVerifierV1 from './012-Verifier'
import deployContractImpls from './014-DeployImpls'
import MessengerInit from './015-MessengerInit'
import RollupInit from './016-RollupInit'
import GatewayInit from './017-GatewayInit'
import StakingInit from './018-StakingInit'
import AdminTransfer from './019-AdminTransfer'
import {AdminTransfer,AdminTransferByProxyStorageName} from './019-AdminTransfer'
import ContractInit from './020-ContractInit'
import StakingRegister from './021-StakingRegister'

Expand All @@ -16,13 +16,14 @@ export {
deployProxyAdmin,
deployEmptyContract,
deployZkEvmVerifierV1,
deployContractProxys,
deployContractProxies,
deployContractImpls,
MessengerInit,
RollupInit,
GatewayInit,
StakingInit,
AdminTransfer,
AdminTransferByProxyStorageName,
ContractInit,
StakingRegister
}
1 change: 1 addition & 0 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "./tasks/overflow_test"
import "./tasks/check"
import "./tasks/query"
import "./tasks/proxy_upgrade"
import "./tasks/staking_upgrade"
import "./src/plugin"
import * as process from "process";

Expand Down
4 changes: 2 additions & 2 deletions contracts/src/deploy-config/l1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const config = {
rollupProposer: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
rollupChallenger: '0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65',
// genesis config
rollupGenesisStateRoot: '0x2ca550ca7aad8025d63463a22367661a6b87e01e2c0c643a97357dcbdfa080b0',
rollupGenesisStateRoot: '0x291ad7aa4b987ca3757f6366537c4ca5153d9806c2d8d4fe581b4f7f1c82791e',
withdrawRoot: '0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757',
batchHeader: '0x0000000000000000000000000000000000000000000000000051a6705d798bdd4c94ed9358cd991a637491a3ecab61740c861ce4a43a7e7edf010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c4440140000000000000000000000000000000000000000000000000000000000000000',
batchHeader: '0x00000000000000000000000000000000000000000000000000ef92a9a5b8635def2307487663beea972478acb3a76bf6320ceeea8a40480e67010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c4440140000000000000000000000000000000000000000000000000000000000000000',

// staking config
// staking Cross-Chain config
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions contracts/tasks/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ task("deposit-l1-gateway-eth")
const Factory = await hre.ethers.getContractFactory('L1ETHGateway')
const contract = Factory.attach("0x2279b7a0a67db372996a5fab50d91eaa73d2ebe6")
const res = await contract["depositETH(uint256,uint256)"](hre.ethers.utils.parseEther('1'), 110000, { value: hre.ethers.utils.parseEther('1.1') })
const recipet = await res.wait()
console.log(`Deposit status ${recipet.status == 1}`)
const rec = await res.wait()
console.log(`Deposit status ${rec.status == 1}`)
});

task("deploy-token")
Expand Down
Loading
Loading