Skip to content

Commit

Permalink
calldata refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Sep 30, 2023
1 parent 256d26a commit 596b97c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions evm/governance.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const IGovernance = require('@axelar-network/axelar-gmp-sdk-solidity/interfaces/
const IGateway = require('@axelar-network/axelar-gmp-sdk-solidity/interfaces/IAxelarGateway.json');

async function processCommand(_, chain, options) {
const { contractName, address, action, calldata, nativeValue, date, privateKey, yes } = options;
const { contractName, address, action, nativeValue, date, privateKey, yes } = options;

const contracts = chain.contracts;
const contractConfig = contracts[contractName];
Expand Down Expand Up @@ -77,6 +77,7 @@ async function processCommand(_, chain, options) {
printInfo('Proposal Action', action);

let gmpPayload;
let calldata = options.calldata;

switch (action) {
case 'scheduleTimeLock': {
Expand Down Expand Up @@ -344,18 +345,18 @@ async function processCommand(_, chain, options) {

printInfo('Setup Params for upgrading AxelarGateway', setupParams);

const upgradeCalldata = gateway.interface.encodeFunctionData('upgrade', [
calldata = gateway.interface.encodeFunctionData('upgrade', [
implementation,
newGatewayImplementationCodeHash,
setupParams,
]);

const commandType = 0;
const types = ['uint256', 'address', 'bytes', 'uint256', 'uint256'];
const values = [commandType, target, upgradeCalldata, nativeValue, eta];
const values = [commandType, target, calldata, nativeValue, eta];

gmpPayload = defaultAbiCoder.encode(types, values);
const proposalEta = await governance.getProposalEta(target, upgradeCalldata, nativeValue);
const proposalEta = await governance.getProposalEta(target, calldata, nativeValue);

if (!BigNumber.from(proposalEta).eq(0)) {
printWarn('The proposal already exixts', etaToDate(proposalEta));
Expand Down Expand Up @@ -391,7 +392,7 @@ async function processCommand(_, chain, options) {
printInfo('Destination governance address', governanceAddress);
printInfo('GMP payload', gmpPayload);
printInfo('Target contract', target);
printInfo('Target calldata', upgradeCalldata);
printInfo('Target calldata', calldata);
printInfo('Native value', nativeValue);
}
}
Expand Down

0 comments on commit 596b97c

Please sign in to comment.