Token
The Token library allows contracts to create and transfer fungible tokens. While some of the methods here also work for non-fungible tokens, see also the NFT library.
Method | Return type | Description |
---|---|---|
Token.create(from:Address, symbol:String, name:String, maxSupply:Number, decimals:Number, flags:Number, script:Bytes, abi:Bytes) | None | Method used to create a new token. Note, as an exception, NFT are also created with this method. |
Token.exists(symbol:String) | Bool | Returns true if the token exists and false otherwise. Also works for NFTs. |
Token.getDecimals(symbol:String) | Number | Returns the number of decimals of the token. For NFTs returns zero. |
Token.getFlags(symbol:String) | Enum | Returns an Enum with the TokenFlag of the token. |
Token.transfer(from:Address, to:Address, symbol:String, amount:Number) | None | Transfers tokens from one Address, to another address with a specific symbol and the desired amount. |
Token.transferAll(from:Address, to:Address, symbol:String) | None | Transfer all tokens from one Address, to another address with a specific symbol. |
Token.mint(from:Address, to:Address, symbol:String, amount:Number) | None | Mints tokens from one Address, to another address with a specific symbol and the desired amount. |
Token.write(from:Address, symbol:String, tokenID:Number, ram:Any) | None | Updates the Token/NFT RAM with the given RAM. |
Token.burn(from:Address, symbol:String, amount:Number) | None | Burn tokens from the given address, given symbol and the desired amount. |
Token.swap(targetChain:String, source:Address, destination:Address, symbol:String, amount:Number) | Number | Converts the specified amount of a token into other token. The returned value is the new amount, which is calculated based on current monetary values of both tokens (if available). |
Token.getBalance(from:Address, symbol:String) | Number | Returns the token balance of the specified address. |
Token.isMinter(address:Address, symbol:String) | Bool | Returns true if the address has Minter permissions for the specified toen symbol, returns false otherwise. |
Last updated