Skip to content

Commit

Permalink
feat: dedicated ITS script (#106)
Browse files Browse the repository at this point in the history
* feat: dedicated ITS script

* feat: integrated script optimizations

* feat: address comments

* feat: update validateParameters function

* fix: hardcoded event names

* feat: add interchain token factory script

* feat: some refactoring

* feat: add to gh action

* fix: gh action salt

* feat: added rawSalt option

* fix: gh action

---------

Co-authored-by: Dean Amiel <[email protected]>
  • Loading branch information
deanamiel and Dean Amiel authored Nov 20, 2023
1 parent 14b6cad commit 1ec46ec
Show file tree
Hide file tree
Showing 8 changed files with 962 additions and 64 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,9 @@ jobs:

- name: Upgrade ITS using create2
run: node evm/deploy-its.js -s "ITS v1.0.0" -f "ITS v1.0.0 Factory" -m create2 -u -y

- name: InterchainTokenFactory deploy interchain token on current chain
run: node evm/interchainTokenFactory.js --action deployInterchainToken --name "test" --symbol "TST" --decimals 18 --distributor 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --salt "salt" -y

- name: InterchainTokenService deploy interchain token on current chain
run: node evm/its.js --action deployInterchainToken --name "test" --symbol "TST" --decimals 18 --distributor 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 --destinationChain '' --gasValue 0 --salt "salt" -y
2 changes: 1 addition & 1 deletion evm/cli-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const addExtendedOptions = (program, options = {}) => {
program.addOption(new Option('-v, --verify', 'verify the deployed contract on the explorer').env('VERIFY'));

if (options.artifactPath) {
program.addOption(new Option('-a, --artifactPath <artifactPath>', 'artifact path'));
program.addOption(new Option('--artifactPath <artifactPath>', 'artifact path'));
}

if (options.contractName) {
Expand Down
10 changes: 5 additions & 5 deletions evm/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
printWarn,
printError,
copyObject,
isString,
isNonEmptyString,
isNumber,
isAddressArray,
getBytecodeHash,
Expand Down Expand Up @@ -45,14 +45,14 @@ async function getConstructorArgs(contractName, chain, wallet) {
const governanceChain = contractConfig.governanceChain || 'Axelarnet';
contractConfig.governanceChain = governanceChain;

if (!isString(governanceChain)) {
if (!isNonEmptyString(governanceChain)) {
throw new Error(`Missing AxelarServiceGovernance.governanceChain in the chain info.`);
}

const governanceAddress = contractConfig.governanceAddress || 'axelar10d07y265gmmuvt4z0w9aw880jnsr700j7v9daj';
contractConfig.governanceAddress = governanceAddress;

if (!isString(governanceAddress)) {
if (!isNonEmptyString(governanceAddress)) {
throw new Error(`Missing AxelarServiceGovernance.governanceAddress in the chain info.`);
}

Expand Down Expand Up @@ -102,14 +102,14 @@ async function getConstructorArgs(contractName, chain, wallet) {
const governanceChain = contractConfig.governanceChain || 'Axelarnet';
contractConfig.governanceChain = governanceChain;

if (!isString(governanceChain)) {
if (!isNonEmptyString(governanceChain)) {
throw new Error(`Missing InterchainGovernance.governanceChain in the chain info.`);
}

const governanceAddress = contractConfig.governanceAddress || 'axelar10d07y265gmmuvt4z0w9aw880jnsr700j7v9daj';
contractConfig.governanceAddress = governanceAddress;

if (!isString(governanceAddress)) {
if (!isNonEmptyString(governanceAddress)) {
throw new Error(`Missing InterchainGovernance.governanceAddress in the chain info.`);
}

Expand Down
6 changes: 3 additions & 3 deletions evm/execute-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {

const readlineSync = require('readline-sync');
const { Command, Option } = require('commander');
const { isNumber, isString, loadConfig, saveConfig, printObj, printLog, printError, getContractJSON } = require('./utils');
const { isNumber, isNonEmptyString, loadConfig, saveConfig, printObj, printLog, printError, getContractJSON } = require('./utils');
const { addBaseOptions } = require('./cli-utils');

async function getCallData(action, targetContract, inputRecipient, inputAmount) {
Expand Down Expand Up @@ -129,7 +129,7 @@ async function executeContract(options, chain, wallet) {
throw new Error('Missing target address in the address info.');
}

if (!isString(action)) {
if (!isNonEmptyString(action)) {
throw new Error('Missing method name from the user info.');
}

Expand Down Expand Up @@ -181,7 +181,7 @@ async function main(options) {
const provider = getDefaultProvider(rpc);
const privateKey = options.privateKey;

if (!isString(privateKey)) {
if (!isNonEmptyString(privateKey)) {
throw new Error('Private Key value is not provided in the info file');
}

Expand Down
Loading

0 comments on commit 1ec46ec

Please sign in to comment.