Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dedicated ITS script #106

Merged
merged 16 commits into from
Nov 20, 2023
9 changes: 8 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ jobs:
}
}' > ./axelar-chains-config/info/local.json

# Create .env file with default hardhat private key that's prefunded
# Create .env file with default hardhat private key that's prefunded, default salt is keccak256('salt')
- name: Prepare .env
run: |
echo 'PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' >> .env
echo 'ENV=local' >> .env
echo 'CHAINS=test' >> .env
echo 'SALT=0xa05e334153147e75f3f416139b5109d1179cb56fef6a4ecb4c4cbc92a7c37b70' >> .env
milapsheth marked this conversation as resolved.
Show resolved Hide resolved

- name: Display local.json
run: cat ./axelar-chains-config/info/local.json
Expand Down Expand Up @@ -113,3 +114,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 -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 -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
Loading