This contract implements an interchain token which extends InterchainToken functionality.
This contract also inherits Minter and Implementation logic.
string name
Getter for the name of the token.
| Name | Type | Description | | —- | —- | ———– |
string symbol
Getter for the symbol of the token.
| Name | Type | Description | | —- | —- | ———– |
uint8 decimals
Getter for the decimals of the token.
| Name | Type | Description | | —- | —- | ———– |
bytes32 tokenId
address interchainTokenService_
bytes32 INITIALIZED_SLOT
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).
function _isInitialized() internal view returns (bool initialized)
Returns true if the contract has been setup.
Name | Type | Description |
---|---|---|
initialized | bool | True if the contract has been setup, false otherwise. |
function _initialize() internal
Sets initialized to true, to allow only a single init.
function interchainTokenService() public view returns (address)
Returns the interchain token service
Name | Type | Description |
---|---|---|
[0] | address | address The interchain token service contract |
function interchainTokenId() public view returns (bytes32)
Returns the tokenId for this token.
Name | Type | Description |
---|---|---|
[0] | bytes32 | bytes32 The token manager contract. |
function init(bytes32 tokenId_, address minter, string tokenName, string tokenSymbol, uint8 tokenDecimals) external
Setup function to initialize contract 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. |
function mint(address account, uint256 amount) external
Function to mint new tokens.
Can only be called by the minter address.
Name | Type | Description |
---|---|---|
account | address | The address that will receive the minted tokens. |
amount | uint256 | The amount of tokens to mint. |
function burn(address account, uint256 amount) external
Function to burn tokens.
Can only be called by the minter address.
Name | Type | Description |
---|---|---|
account | address | The address that will have its tokens burnt. |
amount | uint256 | The amount of tokens to burn. |
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.