From 8134c49356ff14a2a10c4bd6a50c36f5e2470b1c Mon Sep 17 00:00:00 2001 From: Bao Date: Wed, 17 May 2023 11:24:47 +0700 Subject: [PATCH] [Upgrade] Fix set commission rate script (#225) * fix script * fix explorer url * fix mainchain script --- src/upgrades/230406-update-slash-conditions.ts | 4 ++-- src/upgrades/230411-add-GVs.ts | 4 ++-- .../230515-change-min-commission-rate-5-percent.ts | 10 +++++----- .../230516-set-pause-enforcer-mainchain-gateway.ts | 8 ++++---- src/upgrades/upgradeUtils.ts | 2 ++ 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/upgrades/230406-update-slash-conditions.ts b/src/upgrades/230406-update-slash-conditions.ts index 3979bb5c2..f7d7f879d 100644 --- a/src/upgrades/230406-update-slash-conditions.ts +++ b/src/upgrades/230406-update-slash-conditions.ts @@ -5,7 +5,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { VoteType } from '../script/proposal'; import { RoninValidatorSet__factory, SlashIndicator__factory } from '../types'; import { SlashIndicatorArguments } from '../utils'; -import { proxyCall, proxyInterface } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall, proxyInterface } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -91,7 +91,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE VoteType.For // ballot type ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230406UpdateSlashConditions']; diff --git a/src/upgrades/230411-add-GVs.ts b/src/upgrades/230411-add-GVs.ts index 984e4ba5e..869f3a1f6 100644 --- a/src/upgrades/230411-add-GVs.ts +++ b/src/upgrades/230411-add-GVs.ts @@ -3,7 +3,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { VoteType } from '../script/proposal'; import { RoninTrustedOrganization__factory } from '../types'; -import { proxyCall } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -124,7 +124,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE trustedOrgInstructions.map(() => 2_000_000) // gasAmounts ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230411AddGVs']; diff --git a/src/upgrades/230515-change-min-commission-rate-5-percent.ts b/src/upgrades/230515-change-min-commission-rate-5-percent.ts index 0f27a1c72..25cece198 100644 --- a/src/upgrades/230515-change-min-commission-rate-5-percent.ts +++ b/src/upgrades/230515-change-min-commission-rate-5-percent.ts @@ -10,7 +10,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { VoteType } from '../script/proposal'; import { GatewayV2__factory, Staking__factory } from '../types'; import { StakingArguments } from '../utils'; -import { proxyCall, proxyInterface } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall, proxyInterface } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -25,9 +25,9 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE const newRoninPauseEnforcerLogic = '0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837'; const maintenanceProxy = await deployments.get('MaintenanceProxy'); - const validatorSetProxy = await deployments.get('ValidatorSetProxy'); + const validatorSetProxy = await deployments.get('RoninValidatorSetProxy'); const stakingProxy = await deployments.get('StakingProxy'); - const roninGatewayProxy = await deployments.get('RoninGatewayV2Proxy'); + const roninGatewayAddress = '0x0cf8ff40a508bdbc39fbe1bb679dcba64e65c7df'; const maintenanceInstructions = [proxyInterface.encodeFunctionData('upgradeTo', [newMaintenanceLogic])]; const validatorSetInstructions = [proxyInterface.encodeFunctionData('upgradeTo', [newValidatorSetLogic])]; @@ -71,7 +71,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE ...maintenanceInstructions.map(() => maintenanceProxy.address), ...validatorSetInstructions.map(() => validatorSetProxy.address), ...stakingInstructions.map(() => stakingProxy.address), - ...gatewayInstructions.map(() => roninGatewayProxy.address), + ...gatewayInstructions.map(() => roninGatewayAddress), ], // targets [...maintenanceInstructions, ...validatorSetInstructions, ...stakingInstructions, ...gatewayInstructions].map( () => 0 @@ -83,7 +83,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE VoteType.For // ballot type ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230515ChangeMinCommissionRate5Percent']; diff --git a/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts b/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts index b51788b80..bb75ae2f7 100644 --- a/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts +++ b/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts @@ -7,7 +7,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { GatewayV2__factory } from '../types'; -import { proxyCall } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -15,7 +15,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE console.log('Governor:', governor); const newMainchainPauseEnforcerLogic = ''; // TODO: Should input new pause enforcer here - const mainchainGatewayProxy = await deployments.get('MainchainGatewayV2Proxy'); + const mainchainGatewayProxyAddress = '0x1A2a1c938CE3eC39b6D47113c7955bAa9DD454F2'; // NOTE: Please double check this address if (newMainchainPauseEnforcerLogic == '') { console.log('Error: Address of new enforcer not set.'); @@ -51,13 +51,13 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE proposalChainId, proposalExpiryTimestamp, // expiryTimestamp - gatewayInstructions.map(() => mainchainGatewayProxy.address), // targets + gatewayInstructions.map(() => mainchainGatewayProxyAddress), // targets gatewayInstructions.map(() => 0), // values gatewayInstructions, // datas gatewayInstructions.map(() => 1_000_000) // gasAmounts ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230516SetNewEnforcerMainchainGateway']; diff --git a/src/upgrades/upgradeUtils.ts b/src/upgrades/upgradeUtils.ts index 833ec28bf..25e5dbef0 100644 --- a/src/upgrades/upgradeUtils.ts +++ b/src/upgrades/upgradeUtils.ts @@ -4,3 +4,5 @@ import { TransparentUpgradeableProxyV2__factory } from '../types'; export const proxyInterface = new TransparentUpgradeableProxyV2__factory().interface; export const proxyCall = (calldata: BytesLike) => proxyInterface.encodeFunctionData('functionDelegateCall', [calldata]); + +export const EXPLORER_URL = 'https://app.roninchain.com';