interchain-token-service

Solidity API

InterchainToken

This contract implements an interchain token which extends InterchainToken functionality.

This contract also inherits Minter and Implementation logic.

name

string name

Getter for the name of the token.

Return Values

| Name | Type | Description | | —- | —- | ———– |

symbol

string symbol

Getter for the symbol of the token.

Return Values

| Name | Type | Description | | —- | —- | ———– |

decimals

uint8 decimals

Getter for the decimals of the token.

Return Values

| Name | Type | Description | | —- | —- | ———– |

tokenId

bytes32 tokenId

interchainTokenService_

address interchainTokenService_

INITIALIZED_SLOT

bytes32 INITIALIZED_SLOT

constructor

constructor(address interchainTokenServiceAddress) public

Constructs the InterchainToken contract.

Makes the implementation act as if it has been setup already to disallow calls to init() (even though that would not achieve anything really).

_isInitialized

function _isInitialized() internal view returns (bool initialized)

Returns true if the contract has been setup.

Return Values

Name Type Description
initialized bool True if the contract has been setup, false otherwise.

_initialize

function _initialize() internal

Sets initialized to true, to allow only a single init.

interchainTokenService

function interchainTokenService() public view returns (address)

Returns the interchain token service

Return Values

Name Type Description
[0] address address The interchain token service contract

interchainTokenId

function interchainTokenId() public view returns (bytes32)

Returns the tokenId for this token.

Return Values

Name Type Description
[0] bytes32 bytes32 The token manager contract.

init

function init(bytes32 tokenId_, address minter, string tokenName, string tokenSymbol, uint8 tokenDecimals) external

Setup function to initialize contract parameters.

Parameters

Name Type Description
tokenId_ bytes32 The tokenId of the token.
minter address The address of the token minter.
tokenName string The name of the token.
tokenSymbol string The symbopl of the token.
tokenDecimals uint8 The decimals of the token.

mint

function mint(address account, uint256 amount) external

Function to mint new tokens.

Can only be called by the minter address.

Parameters

Name Type Description
account address The address that will receive the minted tokens.
amount uint256 The amount of tokens to mint.

burn

function burn(address account, uint256 amount) external

Function to burn tokens.

Can only be called by the minter address.

Parameters

Name Type Description
account address The address that will have its tokens burnt.
amount uint256 The amount of tokens to burn.

_spendAllowance

function _spendAllowance(address sender, address spender, uint256 amount) internal

A method to be overwritten that will decrease the allowance of the spender from sender by amount.

Needs to be overwritten. This provides flexibility for the choice of ERC20 implementation used. Must revert if allowance is not sufficient.