Skip to content

Commit

Permalink
fix: changed minter type, updated its version, and added customMinter…
Browse files Browse the repository at this point in the history
… for custom token ex
  • Loading branch information
benjamin852 committed Jun 4, 2024
1 parent 8766358 commit 047cb61
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
7 changes: 5 additions & 2 deletions examples/evm/its-custom-token/CustomToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ contract CustomToken is InterchainTokenStandard, ERC20, Minter {
decimals_ = decimalsValue;
interchainTokenService_ = interchainTokenServiceAddress;

_addMinter(interchainTokenService_);
_addMinter(msg.sender);
}

Expand Down Expand Up @@ -75,6 +74,10 @@ contract CustomToken is InterchainTokenStandard, ERC20, Minter {
_burn(account, amount);
}

function addMinter(address minter) external {
_addMinter(minter);
}

/**
* @notice A method to be overwritten that will decrease the allowance of the `spender` from `sender` by `amount`.
* @dev Needs to be overwritten. This provides flexibility for the choice of ERC20 implementation used. Must revert if allowance is not sufficient.
Expand All @@ -86,4 +89,4 @@ contract CustomToken is InterchainTokenStandard, ERC20, Minter {
_approve(sender, spender, _allowance - amount);
}
}
}
}
10 changes: 5 additions & 5 deletions examples/evm/its-custom-token/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { interchainTransfer } = require('../../../scripts/libs/its-utils');

const CustomToken = rootRequire('./artifacts/examples/evm/its-custom-token/CustomToken.sol/CustomToken.json');
const ITokenManager = rootRequire('./artifacts/@axelar-network/interchain-token-service/contracts/interfaces/ITokenManager.sol/ITokenManager.json');
const MINT_BURN = 0;
const CUSTOM_MINT_BURN = 4;

async function deploy(chain, wallet) {
console.log(`Deploying CustomToken for ${chain.name}.`);
Expand All @@ -36,13 +36,14 @@ async function execute(chains, wallet, options) {

const params = defaultAbiCoder.encode(['bytes', 'address'], [wallet.address, chain.customToken.address]);
const its = new Contract(chain.interchainTokenService, IInterchainTokenService.abi, wallet.connect(chain.provider));
await (await its.deployTokenManager(salt, '', MINT_BURN, params, 0)).wait();
await (await its.deployTokenManager(salt, '', CUSTOM_MINT_BURN, params, 0)).wait();
const tokenId = await its.interchainTokenId(wallet.address, salt);
const tokenManagerAddress = await its.tokenManagerAddress(tokenId);
const tokenManager = new Contract(tokenManagerAddress, ITokenManager.abi, wallet.connect(chain.provider));
await (await chain.customToken.addMinter(tokenManagerAddress)).wait();
return tokenManager;
}

const tokenManager = await deployTokenManager(source, salt);
await deployTokenManager(destination, salt);

Expand All @@ -57,5 +58,4 @@ async function execute(chains, wallet, options) {
module.exports = {
deploy,
execute,
};

};
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"license": "ISC",
"dependencies": {
"@axelar-network/axelar-chains-config": "^1.2.0",
"@axelar-network/axelar-gmp-sdk-solidity": "5.8.0",
"@axelar-network/axelar-local-dev": "^2.3.2",
"@axelar-network/axelar-gmp-sdk-solidity": "^5.9.0",
"@axelar-network/axelar-local-dev": "2.3.2",
"@axelar-network/axelar-local-dev-cosmos": "^2.3.0",
"@axelar-network/axelar-local-dev-multiversx": "^2.3.0",
"@axelar-network/axelarjs-sdk": "^0.15.0",
"@axelar-network/interchain-token-service": "^1.0.0",
"@axelar-network/interchain-token-service": "1.2.4",
"@grpc/grpc-js": "^1.10.3",
"@grpc/proto-loader": "^0.7.10",
"@multiversx/sdk-core": "^12.19.0",
Expand Down

0 comments on commit 047cb61

Please sign in to comment.