mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 15:38:06 -05:00
[Fix] - Remove proxy admin from remote tokenbridge script (#393)
* remove proxy admin from remote tokenbridge script * Update contracts/scripts/operational/setRemoteTokenBridgeTask.ts Co-authored-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com> Signed-off-by: The Dark Jester <thedarkjester@users.noreply.github.com> * remove unused param * linting * address PR comments * remove proxy admin address * remove safe address --------- Signed-off-by: The Dark Jester <thedarkjester@users.noreply.github.com> Co-authored-by: kyzooghost <73516204+kyzooghost@users.noreply.github.com>
This commit is contained in:
@@ -61,7 +61,7 @@ To deploy the contracts, you will need to run the Bridged Token, Token Bridge, a
|
||||
You can refer to the following links that describe the usage of these scripts. <br />
|
||||
- [Bridged Token Deployment Script](./deployment.md#bridgedtoken) <br />
|
||||
- [Token Bridge Deployment Script](./deployment.md#tokenbridge) <br />
|
||||
- [Operational Script](./operational.md#transferownershipandsetremotetokenbridge)
|
||||
- [Operational Script](./operational.md#setRemoteTokenBridge)
|
||||
|
||||
|
||||
All addresses created will be stored in the deployments folder as a separate file. `./contracts/deployment/<network_name>`
|
||||
|
||||
@@ -226,7 +226,7 @@ npx hardhat setVerifierAddress \
|
||||
<br />
|
||||
<br />
|
||||
|
||||
### transferOwnershipAndSetRemoteTokenBridge
|
||||
### setRemoteTokenBridge
|
||||
|
||||
<br />
|
||||
Parameters that should be filled either in .env or passed as CLI arguments:
|
||||
@@ -237,8 +237,6 @@ Parameters that should be filled either in .env or passed as CLI arguments:
|
||||
| INFURA_API_KEY | true | key | Infura API Key |
|
||||
| REMOTE_TOKEN_BRIDGE_ADDRESS | true | address | Token Bridge address deployed on the `--remote-network`. It must be provided as CLI argument using the `--remote-token-bridge-address` flag. If not found, the script will also check .env. variable `TOKEN_BRIDGE_ADDRESS`. If the .env variable doesn't exist, it will also check the `deployments/<remote-network>` folder and try to use that address. Otherwise it will throw an error. |
|
||||
| TOKEN_BRIDGE_ADDRESS | true | address | Token Bridge address deployed on current network. It must be provided as CLI argument using the `--token-bridge-address` flag. If not found, the script will also check .env. variable `TOKEN_BRIDGE_ADDRESS`. If the .env variable doesn't exist, it will also check the `deployments/<network_name>` folder and try to use that address. Otherwise it will throw an error. |
|
||||
| --token-bridge-proxy-admin-address | true | address | TokenBridge Proxy Admin address. If not provided as a CLI argument, the script will also check the `deployments/<network_name>` folder and try to use that address if it exists. Otherwise it will throw an error. |
|
||||
| --safe-address | true | address | Safe address. It must be provided as CLI argument using the `--safe-address` flag otherwise the script will throw an error. |
|
||||
| --remote-network | true | string | Network name. It must be provided as CLI argument using the `--safe-address` flag otherwise the script will throw an error. |
|
||||
|
||||
<br />
|
||||
@@ -251,7 +249,7 @@ e.g. `--remote-network linea_sepolia --network sepolia` or vice-versa.
|
||||
Base command:
|
||||
|
||||
```shell
|
||||
npx hardhat transferOwnershipAndSetRemoteTokenBridge --safe-address <address> --remote-network sepolia --network linea_sepolia
|
||||
npx hardhat setRemoteTokenBridge --remote-network sepolia --network linea_sepolia
|
||||
```
|
||||
|
||||
Base command with cli arguments:
|
||||
@@ -259,11 +257,9 @@ Base command with cli arguments:
|
||||
```shell
|
||||
SEPOLIA_PRIVATE_KEY=<key> \
|
||||
INFURA_API_KEY=<key> \
|
||||
npx hardhat transferOwnershipAndSetRemoteTokenBridge \
|
||||
--safe-address <address> \
|
||||
npx hardhat setRemoteTokenBridge \
|
||||
--remote-token-bridge-address <address> \
|
||||
--token-bridge-address <address> \
|
||||
--token-bridge-proxy-admin-address <address> \
|
||||
--remote-network sepolia \
|
||||
--network linea_sepolia
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@ import "./scripts/operational/grantContractRolesTask";
|
||||
import "./scripts/operational/renounceContractRolesTask";
|
||||
import "./scripts/operational/setRateLimitTask";
|
||||
import "./scripts/operational/setVerifierAddressTask";
|
||||
import "./scripts/operational/transferOwnershipAndSetRemoteTokenBridgeTask";
|
||||
import "./scripts/operational/setRemoteTokenBridgeTask";
|
||||
import "./scripts/operational/setMessageServiceOnTokenBridgeTask";
|
||||
|
||||
import "solidity-docgen";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// import { ethers, network, upgrades } from "hardhat";
|
||||
import { task } from "hardhat/config";
|
||||
import { ProxyAdminReplica, TokenBridge } from "../../typechain-types";
|
||||
import { TokenBridge } from "../../typechain-types";
|
||||
import { getTaskCliOrEnvValue } from "../../common/helpers/environmentHelper";
|
||||
import { getDeployedContractOnNetwork } from "../../common/helpers/readAddress";
|
||||
|
||||
@@ -11,24 +11,17 @@ import { getDeployedContractOnNetwork } from "../../common/helpers/readAddress";
|
||||
*******************************************************************************************
|
||||
SEPOLIA_PRIVATE_KEY=<key> \
|
||||
INFURA_API_KEY=<key> \
|
||||
npx hardhat transferOwnershipAndSetRemoteTokenBridge \
|
||||
--safe-address <address> \
|
||||
npx hardhat setRemoteTokenBridge \
|
||||
--remote-token-bridge-address <address> \
|
||||
--token-bridge-address <address> \
|
||||
--token-bridge-proxy-admin-address <address> \
|
||||
--remote-network sepolia \
|
||||
--network linea_sepolia
|
||||
*******************************************************************************************
|
||||
*/
|
||||
|
||||
task(
|
||||
"transferOwnershipAndSetRemoteTokenBridge",
|
||||
"Transfers the ownership of TokenBridge and Proxy Admin to the Safe address and also sets the remoteTokenBridge address.",
|
||||
)
|
||||
.addParam("safeAddress")
|
||||
task("setRemoteTokenBridge", "Sets the remoteTokenBridge address.")
|
||||
.addOptionalParam("remoteTokenBridgeAddress")
|
||||
.addOptionalParam("tokenBridgeAddress")
|
||||
.addOptionalParam("tokenBridgeProxyAdminAddress")
|
||||
.addParam("remoteNetwork")
|
||||
.setAction(async (taskArgs, hre) => {
|
||||
const ethers = hre.ethers;
|
||||
@@ -38,30 +31,23 @@ task(
|
||||
"remoteTokenBridgeAddress",
|
||||
"REMOTE_TOKEN_BRIDGE_ADDRESS",
|
||||
);
|
||||
let tokenBridgeAddress = getTaskCliOrEnvValue(taskArgs, "tokenBridgeAddress", "TOKEN_BRIDGE_ADDRESS");
|
||||
let tokenBridgeProxyAdmin = taskArgs.tokenBridgeProxyAdminAddress;
|
||||
|
||||
if (tokenBridgeAddress === undefined) {
|
||||
let tokenBridgeAddress = getTaskCliOrEnvValue(taskArgs, "tokenBridgeAddress", "TOKEN_BRIDGE_ADDRESS");
|
||||
|
||||
if (!tokenBridgeAddress) {
|
||||
tokenBridgeAddress = await getDeployedContractOnNetwork(hre.network.name, "TokenBridge");
|
||||
if (tokenBridgeAddress === undefined) {
|
||||
if (!tokenBridgeAddress) {
|
||||
throw "tokenBridgeAddress is undefined";
|
||||
}
|
||||
}
|
||||
|
||||
if (remoteTokenBridgeAddress === undefined) {
|
||||
if (!remoteTokenBridgeAddress) {
|
||||
remoteTokenBridgeAddress = await getDeployedContractOnNetwork(taskArgs.remoteNetwork, "TokenBridge");
|
||||
if (remoteTokenBridgeAddress === undefined) {
|
||||
if (!remoteTokenBridgeAddress) {
|
||||
throw "remoteTokenBridgeAddress is undefined";
|
||||
}
|
||||
}
|
||||
|
||||
if (tokenBridgeProxyAdmin === undefined) {
|
||||
tokenBridgeProxyAdmin = await getDeployedContractOnNetwork(hre.network.name, "TokenBridgeProxyAdmin");
|
||||
if (tokenBridgeProxyAdmin === undefined) {
|
||||
throw "tokenBridgeProxyAdmin is undefined";
|
||||
}
|
||||
}
|
||||
|
||||
const chainId = (await ethers.provider.getNetwork()).chainId;
|
||||
console.log(`Current network's chainId is ${chainId}`);
|
||||
|
||||
@@ -72,10 +58,4 @@ task(
|
||||
await tx.wait();
|
||||
|
||||
console.log(`RemoteTokenBridge set for the TokenBridge on: ${hre.network.name}`);
|
||||
|
||||
const ProxyAdmin = await ethers.getContractFactory("ProxyAdminReplica");
|
||||
const proxyAdmin = ProxyAdmin.attach(tokenBridgeProxyAdmin) as ProxyAdminReplica;
|
||||
await proxyAdmin.transferOwnership(taskArgs.safeAddress);
|
||||
|
||||
console.log(`TokenBridge ownership and proxy admin set to: ${taskArgs.safeAddress}`);
|
||||
});
|
||||
@@ -11,8 +11,9 @@ import { requireEnv } from "../hardhat/utils";
|
||||
NB: Be sure of who owns the Timelock before transferring admin to the
|
||||
timelock controller. There is the potential to brick ownership
|
||||
|
||||
|
||||
*******************************************************************************************
|
||||
npx hardhat run --network zkevm_dev scripts/operational/transferProxyAdminOwnership.ts
|
||||
PROXY_ADMIN_OWNER_ADDRESS=0x.. PROXY_ADDRESS=0x.. CONTRACT_TYPE=TokenBridge npx hardhat run --network zkevm_dev scripts/operational/transferProxyAdminOwnership.ts
|
||||
*******************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user