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: fixed its deployment #102

Merged
merged 11 commits into from
Nov 15, 2023
12 changes: 12 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
"rpc": "http://127.0.0.1:8545",
"tokenSymbol": "TEST",
"contracts": {
"AxelarGasService": {
"collector": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
},
"InterchainGovernance": {
"minimumTimeDelay": 3600
},
Expand Down Expand Up @@ -101,3 +104,12 @@ jobs:

- name: Deploy Operators using create3
run: node evm/deploy-contract.js -c Operators -m create3 -y

- name: Deploy AxelarGasService using create2
run: node evm/deploy-upgradable.js -c AxelarGasService -m create2 -y

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

- 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Install dependencies via
`npm ci`

[EVM deployment instructions](./evm/README.md)
[EVM deployment instructions](./evm/README.md)
3 changes: 1 addition & 2 deletions evm/deploy-const-address-deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ async function deployConstAddressDeployer(wallet, chain, options = {}, verifyOpt

const contractConfig = contracts[contractName];

const rpc = chain.rpc;
const provider = getDefaultProvider(rpc);
const provider = wallet.provider;
const expectedAddress = contractConfig.address ? contractConfig.address : await predictAddressCreate(wallet.address, 0);

if (!options.force && (await provider.getCode(expectedAddress)) !== '0x') {
Expand Down
420 changes: 210 additions & 210 deletions evm/deploy-its.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions evm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ function getContractPath(contractName) {
const searchDirs = [
path.join(projectRoot, 'node_modules', '@axelar-network', 'axelar-gmp-sdk-solidity', 'artifacts', 'contracts'),
path.join(projectRoot, 'node_modules', '@axelar-network', 'axelar-cgp-solidity', 'artifacts', 'contracts'),
path.join(projectRoot, 'node_modules', '@axelar-network', 'interchain-token-service', 'artifacts', 'contracts'),
];

for (const dir of searchDirs) {
Expand All @@ -846,8 +847,6 @@ function getContractJSON(contractName, artifactPath) {
contractPath = getContractPath(contractName);
}

printInfo('Contract path', contractPath);

try {
const contractJson = require(contractPath);
return contractJson;
Expand Down
59 changes: 58 additions & 1 deletion evm/verify-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
utils: { defaultAbiCoder },
} = ethers;
const { Command, Option } = require('commander');
const { verifyContract, getEVMAddresses, printInfo, printError, mainProcessor } = require('./utils');
const { verifyContract, getEVMAddresses, printInfo, printError, mainProcessor, getContractJSON } = require('./utils');
const { addBaseOptions } = require('./cli-utils');

async function processCommand(config, chain, options) {
Expand Down Expand Up @@ -203,6 +203,63 @@ async function processCommand(config, chain, options) {
break;
}

case 'InterchainTokenService': {
const InterchainTokenService = getContractJSON('InterchainTokenService');
const interchainTokenServiceFactory = await getContractFactoryFromArtifact(InterchainTokenService, wallet);
const interchainTokenService = interchainTokenServiceFactory.attach(
options.address || chain.contracts.InterchainTokenService.address,
);

const implementation = await interchainTokenService.implementation();
const tokenManagerDeployer = await interchainTokenService.tokenManagerDeployer();
const interchainTokenDeployer = await interchainTokenService.interchainTokenDeployer();
const interchainToken = await interchainTokenDeployer.implementation();
const interchainTokenFactory = await interchainTokenService.interchainTokenFactory();

const tokenManagerMintBurn = await interchainTokenService.implementationMintBurn();
const tokenManagerMintBurnFrom = await interchainTokenService.implementationMintBurnFrom();
const tokenManagerLockUnlock = await interchainTokenService.implementationLockUnlock();
const tokenManagerLockUnlockFee = await interchainTokenService.implementationLockUnlockFee();

const trustedChains = Object.values(config.chains).map((chain) => chain.id);
const trustedAddresses = trustedChains
.map(async (chainName) => await interchainTokenService.trustedAddress(chainName))
.filter((address) => address !== '');

await verifyContract(env, chain.name, tokenManagerDeployer, [], verifyOptions);
await verifyContract(env, chain.name, interchainToken, [], verifyOptions);
await verifyContract(env, chain.name, interchainTokenDeployer, [interchainToken], verifyOptions);
await verifyContract(env, chain.name, tokenManagerMintBurn, [interchainTokenService.address], verifyOptions);
await verifyContract(env, chain.name, tokenManagerMintBurnFrom, [interchainTokenService.address], verifyOptions);
await verifyContract(env, chain.name, tokenManagerLockUnlock, [interchainTokenService.address], verifyOptions);
await verifyContract(env, chain.name, tokenManagerLockUnlockFee, [interchainTokenService.address], verifyOptions);
await verifyContract(
env,
chain.name,
implementation,
[
tokenManagerDeployer,
interchainTokenDeployer,
chain.contracts.AxelarGateway.address,
chain.contracts.AxelarGasService.address,
interchainTokenFactory,
chain.name,
[tokenManagerMintBurn, tokenManagerMintBurnFrom, tokenManagerLockUnlock, tokenManagerLockUnlockFee],
],
verifyOptions,
);
await verifyContract(env, chain.name, interchainTokenFactory, [interchainTokenService.address], verifyOptions);
await verifyContract(
env,
chain.name,
interchainTokenService.address,
[implementation, chain.contracts.InterchainTokenService.deployer, trustedChains, trustedAddresses],
verifyOptions,
);

break;
}

default: {
throw new Error(`Contract ${contractName} is not supported`);
}
Expand Down
Loading
Loading