The ANT (Antelope) Token Standards is an unofficial token contract that seeks to replace the EOSIO.token contract on WAX, Telos, EOS + UX blockchains, and anyone else using Antelope. I've nicknamed the collection of standards ANT as it's the beginning of Antelope and after ANTioquΓa, Colombia, and ants.
This standard, by default, provides features such as token transfers, many tokens per contract, token symbols unique to the contract, control over the RAM payer, the ability to close accounts (delete rows) with zero balance (new), and, of course, the process for creating and issuing tokens. The base implementation is split into a .cpp file (token.cpp) and a header file (token.hpp), and additional standards follow the same format with different file names.
Here's more information about the eosio.token standard this is based on.
This standard, by default, provides features such as token transfers, many tokens per contract, token symbols unique to the contract, control over the RAM payer, the ability to close accounts (delete rows) with zero balance, and, of course, the process for creating and issuing tokens. The base implementation is split into a .cpp file (token.cpp) and a header file (token.hpp), and additional standards follow the same format with different file names.
Here's more information about the eosio.token standard this is based on.
- Fork of eosio.token contract
- Control over freeing RAM given to contract
This is a change from the eosio.token standard, previously only token owner with blank balance could clear their row. This feature was added so that a contract has the ability to maintain a more accurate list of holders. - Contract + owner can close accounts with zero balance, freeing up RAM
- Be aware this means the token may dissapear from the wallet in user interfaces + next transfer will require RAM to be paid again
- More explicit error messages for easier debugging
- Differences in the authorization process for creating and issuing tokens
- Ability to delete rows has been given to contract in addition to the token holder, allowing your contract to free up RAM for users.
- Find the slightly-upgraded token contract as src/token/token.cpp and src/token/token.hpp
create
: Creates a new token with a specified issuer and maximum supplyissue
: Issues a specified quantity of tokens to the issuer account with an optional memoretire
: Retires a specified quantity of tokens, reducing the supply with an optional memotransfer
: Transfers a specified quantity of tokens from one account to another with an optional memoopen
: Opens a balance row for an account with zero balance for a specified symbol, with the specified RAM payerclose
: Closes a balance row for an account with zero balance for a specified symbol
The ANT Token Standard uses two data structures: account
and currency_stats
. These data structures are stored in multi-index tables called accounts
and stats
, respectively.
The account
structure represents a token balance for a specific account. It contains a single member:
balance
: Aneosio::asset
representing the balance of tokens held by the account. Theprimary_key()
function for theaccount
structure returns the raw symbol code of thebalance
, making each balance row unique within theaccounts
table.
struct [[eosio::table]] account {
eosio::asset balance;
uint64_t primary_key()const { return balance.symbol.code().raw(); }
};
The currency_stats
structure holds information about a specific token, such as its current supply, maximum supply, and the issuer. It contains the following members:
supply
: Aneosio::asset
representing the current supply of the token.max_supply
: Aneosio::asset
representing the maximum supply of the token that can be issued.issuer
: Aneosio::name
representing the account that is allowed to issue and retire the token.
struct [[eosio::table]] currency_stats {
eosio::asset supply;
eosio::asset max_supply;
eosio::name issuer;
uint64_t primary_key()const { return supply.symbol.code().raw(); }
};
These data structures are used to store information about the token balances and token metadata. They are managed using the eosio::multi_index
class, which enables the efficient querying and modification of the data stored in the multi-index tables. The accounts
and stats
tables are instances of the eosio::multi_index
class, with the respective account
and currency_stats
structures as template arguments:
typedef eosio::multi_index< "accounts"_n, account > accounts;
typedef eosio::multi_index< "stat"_n, currency_stats > stats;
- EOSIO software installed
- EOSIO or Antelope cdt (Contract Development Toolkit) installed
- An EOSIO / Antelope account with enough resources (RAM, CPU, and NET) to deploy contract.
- Compile the contract: Using EOSIO cdt
eosio-cpp -l eosio -o src/token/deploy/token.wasm src/token/token.cpp --abigen --contract token
Using Antelope cdt
cdt-cpp -l eosio -o src/token/deploy/token.wasm src/token/token.cpp --abigen --contract token
- Deploy the contract to the EOSIO blockchain:
cleos set contract <your_account_name> <path_to_contract_directory> token.wasm token.abi
Replace <your_account_name>
with your EOSIO account name and <path_to_contract_directory>
with the path to the directory containing the compiled contract files (ant_token.wasm
and ant_token.abi
).
- Create a new token:
cleos push action <your_account_name> create '["<issuer_account_name>", "1000000000.0000 ANT"]' -p <your_account_name>
Replace <your_account_name>
with your EOSIO account name and <issuer_account_name>
with the desired issuer account name for the ANT token.
- Issue tokens to the issuer account:
cleos push action <your_account_name> issue '["<issuer_account_name>", "1000.0000 ANT", "Initial issuance"]' -p <issuer_account_name>
Replace <your_account_name>
with your EOSIO account name and <issuer_account_name>
with the issuer account name for the ANT token.
Now, the ANT token is ready to use. You can perform actions like transfer
, retire
, open
, and close
as needed.
This project is a fork from Antelope and is licensed under their original MIT License and additionally licensed under the [MIT License](LICENSE changes) by Current X Change LLC where applicable.
Please read this Disclaimer of Liability carefully before using any smart contracts located at https://github.com/currentxchange/ANT-token-standard (the "Contracts").
The Contracts are provided on an "as is" basis. Neither Douglas Butner, the original authors, Current X Change LLC, nor any other parties associated with the development and maintenance of the Contracts make any warranties or representations, express or implied, as to the suitability, completeness, quality, appropriateness, or operation of the Contracts.
The Contracts have not been audited for security vulnerabilities. As such, use of the Contracts is at your own risk. You are solely responsible for any damage, liability, or loss that you may incur as a result of or in connection with your use of the Contracts. You should make sure you understand the workings and intricacies of blockchain technologies before using the Contracts.
The Contracts contain code that has been ported from other repositories. It is your responsibility to respect any and all applicable licenses attached to that code. You must review these licenses and ensure that your use of the Contracts does not violate them.
By using the Contracts, you agree to this Disclaimer of Liability, and you waive any right to hold Douglas Butner, the original authors, Current X Change LLC, or any other parties associated with the Contracts liable for any damage, liability, or loss that you may incur in connection with your use of the Contracts.
YOUR USE OF THE CONTRACTS INCLUDING MODIFICATION AND USE CONSTITUTES YOUR AGREEMENT TO THIS DISCLAIMER OF LIABILITY.