From fd051e91f933ceb2a83bb42fa066a3c487a5d6b6 Mon Sep 17 00:00:00 2001 From: Milap Sheth Date: Fri, 24 Jan 2025 01:07:54 -0500 Subject: [PATCH] feat(evm): add transfer mintership cmd --- .github/workflows/test-evm.yaml | 3 +++ evm/its.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/test-evm.yaml b/.github/workflows/test-evm.yaml index 60a18739..7bbafc7e 100644 --- a/.github/workflows/test-evm.yaml +++ b/.github/workflows/test-evm.yaml @@ -137,6 +137,9 @@ jobs: - name: InterchainTokenFactory register custom token run: node evm/interchainTokenFactory.js --action registerCustomToken --tokenAddress 0x49c06259B42540a025A73a32eF2Fd183c0FDB1D2 --tokenManagerType 4 --operator 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --salt "salt" -y + - name: Transfer mintership of token to token manager + run: node evm/its.js --action transferMintership --tokenAddress 0x49c06259B42540a025A73a32eF2Fd183c0FDB1D2 --minter 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -y + - name: InterchainTokenFactory link token run: node evm/interchainTokenFactory.js --action linkToken --destinationChain remote --destinationTokenAddress "0x1234" --tokenManagerType 4 --linkParams "0x5678" --salt "salt" -y diff --git a/evm/its.js b/evm/its.js index c33700a5..9faa6064 100644 --- a/evm/its.js +++ b/evm/its.js @@ -24,9 +24,11 @@ const { isNonEmptyString, isValidChain, getChainConfig, + isValidAddress, } = require('./utils'); const { getWallet } = require('./sign-utils'); const IInterchainTokenService = getContractJSON('IInterchainTokenService'); +const IMinter = getContractJSON('IMinter'); const InterchainTokenService = getContractJSON('InterchainTokenService'); const InterchainTokenFactory = getContractJSON('InterchainTokenFactory'); const IInterchainTokenDeployer = getContractJSON('IInterchainTokenDeployer'); @@ -620,6 +622,19 @@ async function processCommand(config, chain, options) { break; } + case 'transferMintership': { + const { tokenAddress, minter } = options; + + validateParameters({ isValidAddress: { tokenAddress, minter } }); + + const token = new Contract(tokenAddress, IMinter.abi, wallet); + const tx = await token.transferMintership(minter); + + await handleTx(tx, chain, token, options.action, 'MintershipTransferred'); + + break; + } + default: { throw new Error(`Unknown action ${action}`); } @@ -662,6 +677,7 @@ if (require.main === module) { 'checks', 'migrateInterchainToken', 'registerTokenMetadata', + 'transferMintership', ]) .makeOptionMandatory(true), );