A fungible token is a Native Asset on the Fuel Network.
In this project, there are a maximum of 100,000,000 tokens for each asset that may be minted. There is no limit on the total individual assets a user may mint.
The project implements and follows the SRC-20; Token and SRC-3; Mint and Burn standards. It also uses the Token Library to implement the basic functionality behind the standards.
Set functions for name, symbol, and decimals have been provided to the user. While traditionally name, symbol, and decimals are written into the contract rather than storage, this contract is open to mint new types of assets. This means that every asset minted by this contract may contain a different name and symbol.
The SRC-20 ABI defined below has also been implemented.
abi SRC20 {
#[storage(read)]
fn total_assets() -> u64;
#[storage(read)]
fn total_supply(asset: AssetId) -> Option<u64>;
#[storage(read)]
fn name(asset: AssetId) -> Option<String>;
#[storage(read)]
fn symbol(asset: AssetId) -> Option<String>;
#[storage(read)]
fn decimals(asset: AssetId) -> Option<u8>;
}
The SRC-3 standard defines the ABI for minting and burning. This has been properly implemented.
abi SRC3 {
#[storage(read, write)]
fn mint(recipient: Identity, sub_id: SubId, amount: u64);
#[storage(read, write)]
fn burn(sub_id: SubId, amount: u64);
}
The project consists of a smart contract.
token
├── project
│ ├── contracts
│ │ └── token-contract
│ │ └──src/main.sw
│ └── SPECIFICATION.md
├── ui
│ └── SPECIFICATION.md
└── README.md
TODO: The user interface does not currently exist therefore its SPECIFICATION.md is empty.
In order to run the subsequent commands change into the following directory /path/to/token/project/<here>
.
forc build
Before running the tests the programs must be compiled with the command above.
forc test