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

chore(sui): updateMoveToml when upgrade #381

Merged
merged 7 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 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 @@ -24,7 +24,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.6.3",
"@axelar-network/axelar-cgp-sui": "^0.6.4",
"@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
24 changes: 20 additions & 4 deletions sui/deploy-contract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Command, Option } = require('commander');
const { TxBuilder, bcsStructs } = require('@axelar-network/axelar-cgp-sui');
const { getLocalDependencies, updateMoveToml, TxBuilder, bcsStructs } = require('@axelar-network/axelar-cgp-sui');
const { ethers } = require('hardhat');
const { toB64 } = require('@mysten/sui/utils');
const { bcs } = require('@mysten/sui/bcs');
Expand All @@ -26,6 +26,7 @@ const {
getItsChannelId,
getSquidChannelId,
checkSuiVersionMatch,
moveDir,
} = require('./utils');

/**
Expand All @@ -41,7 +42,18 @@ const {
* 2. Ensure the corresponding folder exists in the specified path
*
*/
const PACKAGE_DIRS = ['utils', 'gas_service', 'example', 'axelar_gateway', 'operators', 'abi', 'governance', 'its', 'squid'];
const PACKAGE_DIRS = [
'version_control',
'utils',
'gas_service',
'example',
'axelar_gateway',
'operators',
'abi',
'governance',
'its',
'squid',
];

/**
* Package Mapping Object for Command Options and Post-Deployment Functions
Expand Down Expand Up @@ -251,7 +263,7 @@ async function deploy(keypair, client, supportedContract, config, chain, options
}

async function upgrade(keypair, client, supportedPackage, policy, config, chain, options) {
const { packageName } = supportedPackage;
const { packageName, packageDir } = supportedPackage;
options.policy = policy;

if (!chain.contracts[packageName]) {
Expand All @@ -263,7 +275,11 @@ async function upgrade(keypair, client, supportedPackage, policy, config, chain,

validateParameters({ isNonEmptyString: { packageName } });

// TODO: Synchronize dependencies with `sui/move` folder and update `published-at` field if necessary
const packageDependencies = getLocalDependencies(packageDir, moveDir);
for (const { name } of packageDependencies) {
const packageAddress = contractsConfig[name]?.address;
updateMoveToml(packageDir, packageAddress, moveDir);
}

const builder = new TxBuilder(client);
await upgradePackage(client, keypair, supportedPackage, contractConfig, builder, options);
Expand Down
Loading