Module-level declarations
Types
Represents the cross-chain movement of an asset on the origin or target chain. No intermediate chain will store this information.
Details about a transfer. It contains a limited set of information that can be used to describe a transfer_history_entry
and a crosschain_transfer_history_entry
.
Represents the movement of an asset in or out of an account.
The type of a transfer, used for filtering in queries
Properties
The type of fungible assets. By default, assets created with this library will have this asset type. Other libraries that handle assets might have their own types.
The maximum value that should ever be represented when talking about assets. No balance, transfer, nor total_supply should ever exceed this to maintain compatibility with EVM's int256
Functions
Extendable function that allows the developer to add more functionality to the burn
function, after the burn happens.
This allows, for example, to check that any given condition is present after the tokens have been burned.
If this function throws an exception, the asset will not be burned.
Throws if any extension of this function throws.
Extendable function that allows the developer to add more functionality to the mint
function, after the mint happens.
This allows, for example, to check that any given condition is present after the tokens have been minted.
If this function throws an exception, the asset will not be minted.
Throws if any extension of this function throws.
Extendable function that allows the developer to add more functionality to the transfer
function, after the transfer happens.
This allows, for example, to add fees on transfer or check that any given condition is present after the transfer is completed.
If this function throws an exception, the assets will not be transferred.
Throws if any extension of this function throws.
Returns the asset with the specified id as an entity. Throws "MISSING ASSET"
if the asset is not found.
Extendable function that allows the developer to add more functionality to the burn
function, before the burn happens.
This allows, for example, to check that any given condition is present before burning is allowed.
If this function throws an exception, the asset will not be burned.
Throws if any extension of this function throws.
Extendable function that allows the developer to add more functionality to the mint
function, before the mint happens.
This allows, for example, to check that any given condition is present before minting is allowed.
If this function throws an exception, the asset will not be minted.
Throws if any extension of this function throws.
Extendable function that allows the developer to add more functionality to the transfer
function, before the transfer happens.
This allows, for example, to add fees on transfer or check that any given condition is present before the transfer can be completed.
If this function throws an exception, the assets will not be transferred.
Throws if any extension of this function throws.
Extendable function that defines how to create an account when an on-chain transfer to a non-existing account happens.
Developers should not generally extend this function, as it is handled by the account registration module. Importing the corresponding module should be enough.
Removes a certain amount of money from an account. It does NOT update total supply, extra care is needed to either decrease it or add the assets to another account.
Only supposed to be called internally, use functions like burn
or transfer
whenever possible.
Throws "INSUFFICIENT BALANCE"
if the amount to be removed is higher than the amount the account holds, or if there's no balance connected to the account and asset given, which means the account has 0 of this asset.
Can only be called from an operation.
Maps an entry's info into a readable format for the frontend
Takes a list of transfer history entries and builds a page that can be returned from paginated queries with it.
Maps a crosschain_transfer_history_entry
to a transfer_detail
object. This allows some functions to handle both transfer_history_entry
s and crosschain_transfer_history_entry
s as the same thing.
Maps a transfer_history_entry
to a transfer_detail
object. This allows some functions to handle both transfer_history_entry
s and crosschain_transfer_history_entry
s as the same thing.
Extracts the name of the operation that caused the transfer to happen.
Creates a readable string representing the amount of tokens, given the raw representation of its amount and the decimals.
For example, format_amount_with_decimals(11, 2)
will return "0.11"
Throws "INVALID DECIMALS"
if decimals is negative.
Retrieves all registered assets, paginated.
Returns how much of an asset the account holds.
Retrieves all asset balances for a certain account.
Outputs the details of an asset in a format that is used by other chains to register it as a crosschain asset.
Throws "MISSING ASSET"
if the asset does not exist on this chain.
Retrieves all assets of a specified type, paginated.
Retrieves all the balances of a certain account, paginated.
Retrieves all assets with the given name, paginated.
Retrieves all assets with the given symbol, paginated.
Fetches all transfers, allowing filtering in multiple ways. Paginated.
Returns a transfer_detail
object for each transfer_entry
that was registered during the operation specified.
Same as get_transfer_details
, but restricts the results to transfer entries related to the asset specified.
Adds a certain amount of money to an account. It does NOT update total supply, extra care is needed to either increase it or remove the assets from another account.
Only supposed to be called internally, use functions like mint
or transfer
whenever possible.
Can only be called from an operation.
Extendable function that defines whether on-chain transfers towards an account that doesn't exist should be allowed. False by default, can be set to true to allow account registration on transfer.
Developers should not generally extend this function, as it is handled by the account registration module. Importing the corresponding module should be enough.
However, if a custom transfer strategy is going to be implemented, this function could be extended to allow it to work.
Maps an asset's info into a readable format for the frontend.
Tests whether an asset icon URL is invalid. It will not try to resolve the URL, but it will remove trailing and leading whitespace and check that the string looks like an URL.
Throws "INVALID ASSET URL"
if the URL is over 2048 characters or it does not match this regex pattern: ^\S+:\/\/[^\s$.?#].[^\s]*$
Extendable function that defines how to recall a transfer that was erroneously made toward to a non-existing account, if that account should not be registered.
Developers should not generally extend this function, as it is handled by the account registration module. Importing the corresponding module should be enough.
Ensures that an asset amount is in the interval (0; 2^256) (exclusive)
Throws "INVALID AMOUNT"
if value is too high
Throws "INVALID AMOUNT"
if value is too low
Should be used inside other functions, and the name
parameter should be passed in a way that the error message is understood by the end users.
Example: require_zero_exclusive_asset_amount_limits(-1, "Amount to mint")
will throw this error: "INVALID AMOUNT: Amount to mint: value must be non-zero positive, actual: -1"
Ensures that decimals are in the interval 0; 78 (inclusive)
Throws "INVALID DECIMALS"
otherwise.
Ensures that the ID has exactly 32 bytes
Throws "INVALID ID"
otherwise.
Ensures that the text input is at most 1024 characters long.
Throws "INVALID TEXT"
otherwise.
Ensures that the text input is at most 1024 characters long.
Throws "INVALID TEXT"
otherwise.
Ensures that the text input is not empty and at most 1024 characters long.
Throws "INVALID TYPE"
if type
is empty or too long.
Ensures that the asset uniqueness resolver is at most 1024 bytes long.
Throws "INVALID RESOLVER"
otherwise.