Skip to content

Commit

Permalink
[Upgrade] Fix set commission rate script (#225)
Browse files Browse the repository at this point in the history
* fix script

* fix explorer url

* fix mainchain script
  • Loading branch information
nxqbao authored May 17, 2023
1 parent a6b8132 commit 8134c49
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/upgrades/230406-update-slash-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'];
Expand Down
4 changes: 2 additions & 2 deletions src/upgrades/230411-add-GVs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'];
Expand Down
10 changes: 5 additions & 5 deletions src/upgrades/230515-change-min-commission-rate-5-percent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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])];
Expand Down Expand Up @@ -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
Expand All @@ -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'];
Expand Down
8 changes: 4 additions & 4 deletions src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

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;
let { governor } = await getNamedAccounts(); // NOTE: Should double check the `governor` account in the `hardhat.config.ts` file
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.');
Expand Down Expand Up @@ -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'];
Expand Down
2 changes: 2 additions & 0 deletions src/upgrades/upgradeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

0 comments on commit 8134c49

Please sign in to comment.