Skip to content

Commit

Permalink
chore: upgrade ITS to v1.2.4 (#197)
Browse files Browse the repository at this point in the history
* chore: upgrade ITS to v1.2.2

* chore: upgrade ITS to v1.2.3

* misc

* add contract name

* upgrade to v1.2.4

* update scripts

* bump package version

* prettier

* fix artifact path
  • Loading branch information
milapsheth authored Mar 25, 2024
1 parent 8ee0106 commit 430dfec
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 213 deletions.
173 changes: 85 additions & 88 deletions axelar-chains-config/info/mainnet.json

Large diffs are not rendered by default.

210 changes: 105 additions & 105 deletions axelar-chains-config/info/testnet.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions axelar-chains-config/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion axelar-chains-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-chains-config",
"version": "1.1.0",
"version": "1.2.0",
"description": "A utility to get chain information from Axelar",
"main": "src/index.js",
"types": "dist/index.d.ts",
Expand Down
21 changes: 13 additions & 8 deletions evm/deploy-its.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ async function deployAll(config, wallet, chain, options) {
const deployments = {
tokenManagerDeployer: {
name: 'Token Manager Deployer',
contractName: 'TokenManagerDeployer',
async deploy() {
return await deployContract(
deployMethod,
Expand All @@ -151,6 +152,7 @@ async function deployAll(config, wallet, chain, options) {
},
interchainToken: {
name: 'Interchain Token',
contractName: 'InterchainToken',
async deploy() {
return await deployContract(
deployMethod,
Expand All @@ -166,6 +168,7 @@ async function deployAll(config, wallet, chain, options) {
},
interchainTokenDeployer: {
name: 'Interchain Token Deployer',
contractName: 'InterchainTokenDeployer',
async deploy() {
return await deployContract(
deployMethod,
Expand All @@ -181,6 +184,7 @@ async function deployAll(config, wallet, chain, options) {
},
tokenManager: {
name: 'Token Manager',
contractName: 'TokenManager',
async deploy() {
return await deployContract(
deployMethod,
Expand All @@ -196,6 +200,7 @@ async function deployAll(config, wallet, chain, options) {
},
tokenHandler: {
name: 'Token Handler',
contractName: 'TokenHandler',
async deploy() {
return await deployContract(
deployMethod,
Expand All @@ -211,6 +216,7 @@ async function deployAll(config, wallet, chain, options) {
},
implementation: {
name: 'Interchain Token Service Implementation',
contractName: 'InterchainTokenService',
async deploy() {
const args = [
contractConfig.tokenManagerDeployer,
Expand Down Expand Up @@ -239,6 +245,7 @@ async function deployAll(config, wallet, chain, options) {
},
address: {
name: 'Interchain Token Service Proxy',
contractName: 'InterchainProxy',
async deploy() {
const operatorAddress = options.operatorAddress || wallet.address;

Expand All @@ -265,6 +272,7 @@ async function deployAll(config, wallet, chain, options) {
},
interchainTokenFactoryImplementation: {
name: 'Interchain Token Factory Implementation',
contractName: 'InterchainTokenFactory',
async deploy() {
return await deployContract(
deployMethod,
Expand All @@ -280,6 +288,7 @@ async function deployAll(config, wallet, chain, options) {
},
interchainTokenFactory: {
name: 'Interchain Token Factory Proxy',
contractName: 'InterchainProxy',
async deploy() {
const args = [itsFactoryContractConfig.implementation, wallet.address, '0x'];
printInfo('ITS Factory Proxy args', args);
Expand All @@ -303,13 +312,9 @@ async function deployAll(config, wallet, chain, options) {

const deployment = deployments[key];

if (key === 'address' && options.reuseProxy) {
printInfo(`Reusing ${deployment.name} deployment at ${contractConfig.address}`);
continue;
}

if (key === 'interchainTokenFactory' && options.reuseProxy) {
printInfo(`Reusing ${deployment.name} deployment at ${itsFactoryContractConfig.address}`);
// When upgrading/reusing proxy, avoid re-deploying the proxy and the interchain token contract
if (options.reuseProxy && ['InterchainToken', 'InterchainProxy'].includes(deployment.contractName)) {
printInfo(`Reusing ${deployment.name} deployment for contract ${deployment.contractName} at ${contractConfig[key]}`);
continue;
}

Expand Down Expand Up @@ -473,7 +478,7 @@ if (require.main === module) {
.default('create3'),
);

addExtendedOptions(program, { skipExisting: true, upgrade: true, predictOnly: true });
addExtendedOptions(program, { artifactPath: true, skipExisting: true, upgrade: true, predictOnly: true });

program.addOption(new Option('--reuseProxy', 'reuse existing proxy (useful for upgrade deployments'));
program.addOption(new Option('--contractName <contractName>', 'contract name').default('InterchainTokenService')); // added for consistency
Expand Down
19 changes: 13 additions & 6 deletions evm/its.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { ethers } = require('hardhat');
const {
getDefaultProvider,
utils: { hexZeroPad, toUtf8Bytes, keccak256 },
utils: { hexZeroPad, toUtf8Bytes, keccak256, defaultAbiCoder },
BigNumber,
constants: { AddressZero },
Contract,
Expand Down Expand Up @@ -33,10 +33,11 @@ const IOwnable = getContractJSON('IOwnable');
const { addExtendedOptions } = require('./cli-utils');
const { getSaltFromKey } = require('@axelar-network/axelar-gmp-sdk-solidity/scripts/utils');
const tokenManagerImplementations = {
MINT_BURN: 0,
INTERCHAIN_TOKEN: 0,
MINT_BURN_FROM: 1,
LOCK_UNLOCK: 2,
LOCK_UNLOCK_FEE: 3,
MINT_BURN: 4,
};

function getDeploymentSalt(options) {
Expand Down Expand Up @@ -242,22 +243,26 @@ async function processCommand(config, chain, options) {
}

case 'deployTokenManager': {
const { destinationChain, type, params, gasValue } = options;
const { destinationChain, type, operator, tokenAddress, gasValue } = options;

const deploymentSalt = getDeploymentSalt(options);
const tokenManagerType = tokenManagerImplementations[type];

validateParameters({
isString: { destinationChain },
isValidCalldata: { params },
isValidNumber: { gasValue },
isValidAddress: { tokenAddress },
isValidCalldata: { operator },
isValidNumber: { gasValue, tokenManagerType },
});

isValidDestinationChain(config, destinationChain);

const params = defaultAbiCoder.encode(['bytes', 'address'], [operator, tokenAddress]);

const tx = await interchainTokenService.deployTokenManager(
deploymentSalt,
destinationChain,
tokenManagerImplementations[type],
tokenManagerType,
params,
gasValue,
gasOptions,
Expand Down Expand Up @@ -697,6 +702,8 @@ if (require.main === module) {
program.addOption(new Option('--destinationChain <destinationChain>', 'destination chain'));
program.addOption(new Option('--destinationAddress <destinationAddress>', 'destination address'));
program.addOption(new Option('--params <params>', 'params for TokenManager deployment'));
program.addOption(new Option('--tokenAddress <tokenAddress>', 'token address to use for token manager deployment'));
program.addOption(new Option('--operator <operator>', 'operator address to use for token manager'));
program.addOption(new Option('--gasValue <gasValue>', 'gas value').default(0));
program.addOption(new Option('--name <name>', 'token name'));
program.addOption(new Option('--symbol <symbol>', 'token symbol'));
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-contract-deployments",
"version": "1.1.0",
"version": "1.2.0",
"description": "Axelar contract deployment scripts",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 430dfec

Please sign in to comment.