From 29b8bd19d5eac0268514ba1c84d4e580bbc5a44d Mon Sep 17 00:00:00 2001 From: npty Date: Wed, 31 Jul 2024 18:09:10 +0700 Subject: [PATCH] feat: deploy Operators contract --- sui/README.md | 6 ++++++ sui/deploy-contract.js | 16 +++++++++++++++- sui/deploy-utils.js | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sui/README.md b/sui/README.md index bb6e5a78..2cc6c789 100644 --- a/sui/README.md +++ b/sui/README.md @@ -101,6 +101,12 @@ Deploy the test GMP package: node sui/deploy-contract.js deploy Test ``` +Deploy the Operators package: + +```bash +node sui/deploy-contract.js deploy Operators +``` + Call Contract: ```bash diff --git a/sui/deploy-contract.js b/sui/deploy-contract.js index 21dcc937..f48eb2d8 100644 --- a/sui/deploy-contract.js +++ b/sui/deploy-contract.js @@ -36,7 +36,7 @@ const { * 2. Ensure the corresponding folder exists in the specified path * */ -const PACKAGE_DIRS = ['gas_service', 'test', 'axelar_gateway']; +const PACKAGE_DIRS = ['gas_service', 'test', 'axelar_gateway', 'operators']; /** * Supported Move Packages @@ -92,6 +92,17 @@ async function postDeployTest(published, config, chain, options) { printInfo('Register transaction', registerTx.digest); } +async function postDeployOperators(published, chain) { + const [operatorsObjectId, ownerCapObjectId] = getObjectIdsByObjectTypes(published.publishTxn, [ + `${published.packageId}::operators::Operators`, + `${published.packageId}::operators::OwnerCap`, + ]); + chain.contracts.Operators.objects = { + Operators: operatorsObjectId, + OwnerCap: ownerCapObjectId, + }; +} + async function postDeployAxelarGateway(published, keypair, client, config, chain, options) { const { packageId, publishTxn } = published; const { minimumRotationDelay, policy, previousSigners } = options; @@ -185,6 +196,9 @@ async function deploy(keypair, client, supportedContract, config, chain, options case 'Test': await postDeployTest(published, config, chain, options); break; + case 'Operators': + await postDeployOperators(published, chain); + break; default: throw new Error(`${packageName} is not supported.`); } diff --git a/sui/deploy-utils.js b/sui/deploy-utils.js index bb06309e..e2f0f204 100644 --- a/sui/deploy-utils.js +++ b/sui/deploy-utils.js @@ -101,6 +101,7 @@ const addDeployOptions = (program) => { getDeployGatewayOptions().forEach((option) => program.addOption(option)); break; case 'GasService': + case 'Operators': case 'Test': break; default: