Skip to content

Commit

Permalink
Merge branch 'main' into refactor/check-ownership-request
Browse files Browse the repository at this point in the history
  • Loading branch information
blockchainguyy authored Aug 20, 2024
2 parents ea839d8 + 9d9d9af commit 26a4b00
Show file tree
Hide file tree
Showing 25 changed files with 763 additions and 185 deletions.
21 changes: 18 additions & 3 deletions axelar-chains-config/info/stagenet.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
"deployer": "0xBeF25f4733b9d451072416360609e5A4c115293E"
},
"AxelarDepositService": {
"wrappedSymbol": "WAVAX"
"wrappedSymbol": "WAVAX",
"refundIssuer": "0x2517bA7a3E2cef54c1CD8618e7B0B661A7623817",
"salt": "AxelarDepositService",
"address": "0x405407133E2783aEb56F2cA9d8e6025465De0B9f",
"implementation": "0x523ee715a997bd471BfbE1B66acCF0d47D1fD812",
"deployer": "0xBeF25f4733b9d451072416360609e5A4c115293E"
},
"ConstAddressDeployer": {
"address": "0x98B2920D53612483F91F12Ed7754E51b4A77919e"
Expand Down Expand Up @@ -132,7 +137,12 @@
"deployer": "0xBeF25f4733b9d451072416360609e5A4c115293E"
},
"AxelarDepositService": {
"wrappedSymbol": "WFTM"
"wrappedSymbol": "WFTM",
"refundIssuer": "0x2517bA7a3E2cef54c1CD8618e7B0B661A7623817",
"salt": "AxelarDepositService",
"address": "0x405407133E2783aEb56F2cA9d8e6025465De0B9f",
"implementation": "0x523ee715a997bd471BfbE1B66acCF0d47D1fD812",
"deployer": "0xBeF25f4733b9d451072416360609e5A4c115293E"
},
"ConstAddressDeployer": {
"address": "0x98B2920D53612483F91F12Ed7754E51b4A77919e"
Expand Down Expand Up @@ -235,7 +245,12 @@
"deployer": "0xBeF25f4733b9d451072416360609e5A4c115293E"
},
"AxelarDepositService": {
"wrappedSymbol": "WDEV"
"wrappedSymbol": "WDEV",
"refundIssuer": "0x2517bA7a3E2cef54c1CD8618e7B0B661A7623817",
"salt": "AxelarDepositService",
"address": "0x405407133E2783aEb56F2cA9d8e6025465De0B9f",
"implementation": "0x20fee12E3d138b783aa9238467BDFDDECA407EF9",
"deployer": "0xBeF25f4733b9d451072416360609e5A4c115293E"
},
"ConstAddressDeployer": {
"address": "0x98B2920D53612483F91F12Ed7754E51b4A77919e"
Expand Down
307 changes: 303 additions & 4 deletions axelar-chains-config/info/testnet.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cosmwasm/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const programHandler = () => {
),
);
program.addOption(new Option('--instantiate2', 'use instantiate2 for constant address deployment'));
program.addOption(new Option('-l, --label <label>', 'contract instance label'));
program.addOption(new Option('--aarch64', 'aarch64').env('AARCH64').default(false));
program.addOption(new Option('-y, --yes', 'skip deployment prompt confirmation').env('YES'));

Expand Down
2 changes: 2 additions & 0 deletions cosmwasm/submit-proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ const programHandler = () => {

program.name('submit-proposal').description('Submit governance proposals');

// TODO: combine deploy-contract and submit-proposal options to remove duplicates
program.addOption(
new Option('-e, --env <env>', 'environment')
.choices(['local', 'devnet', 'devnet-amplifier', 'devnet-verifiers', 'stagenet', 'testnet', 'mainnet'])
Expand All @@ -267,6 +268,7 @@ const programHandler = () => {
),
);
program.addOption(new Option('--instantiate2', 'use instantiate2 for constant address deployment'));
program.addOption(new Option('-l, --label <label>', 'contract instance label'));
program.addOption(new Option('--aarch64', 'aarch64').env('AARCH64').default(false));
program.addOption(new Option('-y, --yes', 'skip prompt confirmation').env('YES'));

Expand Down
22 changes: 14 additions & 8 deletions cosmwasm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const calculateDomainSeparator = (chain, router, network) => keccak256(Buffer.fr

const getSalt = (salt, contractName, chainNames) => fromHex(getSaltFromKey(salt || contractName.concat(chainNames)));

const getLabel = ({ contractName, label }) => label || contractName;

const readWasmFile = ({ artifactPath, contractName, aarch64 }) =>
readFileSync(`${artifactPath}/${pascalToSnake(contractName)}${aarch64 ? '-aarch64' : ''}.wasm`);

Expand Down Expand Up @@ -94,7 +96,9 @@ const uploadContract = async (client, wallet, config, options) => {
});
};

const instantiateContract = (client, wallet, initMsg, config, { contractName, salt, instantiate2, chainNames, admin }) => {
const instantiateContract = (client, wallet, initMsg, config, options) => {
const { contractName, salt, instantiate2, chainNames, admin } = options;

return wallet
.getAccounts()
.then(([account]) => {
Expand All @@ -105,17 +109,19 @@ const instantiateContract = (client, wallet, initMsg, config, { contractName, sa
} = config;
const initFee = gasLimit === 'auto' ? 'auto' : calculateFee(gasLimit, GasPrice.fromString(gasPrice));

const contractLabel = getLabel(options);

return instantiate2
? client.instantiate2(
account.address,
contractConfig.codeId,
getSalt(salt, contractName, chainNames),
initMsg,
contractName,
contractLabel,
initFee,
{ admin },
)
: client.instantiate(account.address, contractConfig.codeId, initMsg, contractName, initFee, {
: client.instantiate(account.address, contractConfig.codeId, initMsg, contractLabel, initFee, {
admin,
});
})
Expand Down Expand Up @@ -167,7 +173,7 @@ const makeMultisigInstantiateMsg = ({ adminAddress, governanceAddress, blockExpi
};
};

const makeRewardsInstantiateMsg = ({ governanceAddress, rewardsDenom, params }) => {
const makeRewardsInstantiateMsg = ({ governanceAddress, rewardsDenom }) => {
if (!validateAddress(governanceAddress)) {
throw new Error('Missing or invalid Rewards.governanceAddress in axelar info');
}
Expand All @@ -176,7 +182,7 @@ const makeRewardsInstantiateMsg = ({ governanceAddress, rewardsDenom, params })
throw new Error('Missing or invalid Rewards.rewardsDenom in axelar info');
}

return { governance_address: governanceAddress, rewards_denom: rewardsDenom, params };
return { governance_address: governanceAddress, rewards_denom: rewardsDenom };
};

const makeRouterInstantiateMsg = ({ adminAddress, governanceAddress }, { NexusGateway: { address: nexusGateway } }) => {
Expand Down Expand Up @@ -573,12 +579,12 @@ const getStoreCodeParams = (options) => {
};

const getStoreInstantiateParams = (config, options, msg) => {
const { contractName, admin } = options;
const { admin } = options;

return {
...getStoreCodeParams(options),
admin,
label: contractName,
label: getLabel(options),
msg: Buffer.from(JSON.stringify(msg)),
};
};
Expand All @@ -592,7 +598,7 @@ const getInstantiateContractParams = (config, options, msg) => {
...getSubmitProposalParams(options),
admin,
codeId: contractConfig.codeId,
label: contractName,
label: getLabel(options),
msg: Buffer.from(JSON.stringify(msg)),
};
};
Expand Down
63 changes: 38 additions & 25 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
Expand Up @@ -23,7 +23,7 @@
"homepage": "https://github.com/axelarnetwork/axelar-contract-deployments#readme",
"dependencies": {
"@axelar-network/axelar-cgp-solidity": "6.3.1",
"@axelar-network/axelar-cgp-sui": "0.3.0",
"@axelar-network/axelar-cgp-sui": "0.0.0-snapshot.218635e",
"@axelar-network/axelar-gmp-sdk-solidity": "5.10.0",
"@axelar-network/interchain-token-service": "1.2.4",
"@cosmjs/cosmwasm-stargate": "^0.32.1",
Expand Down
18 changes: 18 additions & 0 deletions sui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ The syntax is `node sui/gas-service.js payGas --amount <amount> <destinationChai
node sui/gas-service.js payGas --amount 0.1 ethereum 0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05 0xba76c6980428A0b10CFC5d8ccb61949677A61233 0x1234
```

Collect gas:

Conditions:
- The `GasCollectorCap` object id is read from the chain config, under gas service objects.
```bash
# store GasCollectorCap to the Operators contract
node sui/operators.js storeCap
```
- The sender must be a whitelisted operator and hold the `OperatorCap` capability.
```bash
# execute the following command from the owner account
node sui/operators add <operator address>
```

```bash
node sui/gas-service.js collectGas --amount 0.1 --receiver <receiver address>
```

Approve messages:

If the gateway was deployed using the wallet, you can submit a message approval with it
Expand Down
13 changes: 9 additions & 4 deletions sui/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ const {
utils: { arrayify },
} = ethers;
const { saveConfig, printInfo, validateParameters, writeJSON, getDomainSeparator, loadConfig } = require('../common');
const { addBaseOptions, addOptionsToCommands } = require('./cli-utils');
const { getWallet, printWalletInfo, broadcast } = require('./sign-utils');
const { bytes32Struct, signersStruct } = require('./types-utils');
const { upgradePackage, UPGRADE_POLICIES } = require('./deploy-utils');
const {
addBaseOptions,
addOptionsToCommands,
getWallet,
printWalletInfo,
broadcast,
bytes32Struct,
signersStruct,
upgradePackage,
UPGRADE_POLICIES,
getSigners,
deployPackage,
getObjectIdsByObjectTypes,
Expand Down
75 changes: 0 additions & 75 deletions sui/deploy-test.js

This file was deleted.

Loading

0 comments on commit 26a4b00

Please sign in to comment.