Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change SRC-20 Example Return Type to Option #19

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions standards/src_20/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ There has also been a Fungible Token Standard and Non-Fungible Token Standard im

The following functions MUST be implemented to follow the SRC-20 standard:

### `fn name(asset: AssetId) -> Option<String>`
### `fn total_assets() -> u64`

This function MUST return the name of the asset, such as “Ether”. This function MUST return `Some` for any assets minted by the contract.
This function MUST return the total number of individual assets for a contract.

### `fn total_supply(asset: AssetId) -> Option<u64>`

This function MUST return the total supply of tokens for an asset. This function MUST return `Some` for any assets minted by the contract.

### `fn total_assets() -> u64`

This function MUST return the total number of individual assets for a contract.

### `fn decimals(asset: AssetId) -> Option<u8>`
### `fn name(asset: AssetId) -> Option<String>`

This function must return the number of decimals the asset uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation. This function MUST return `Some` for any assets minted by the contract.
This function MUST return the name of the asset, such as “Ether”. This function MUST return `Some` for any assets minted by the contract.

### `fn symbol(asset: AssetId) -> Option<String>`

This function must return the symbol of the asset, such as “ETH”. This function MUST return `Some` for any assets minted by the contract.

### `fn decimals(asset: AssetId) -> Option<u8>`

This function must return the number of decimals the asset uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation. This function MUST return `Some` for any assets minted by the contract.

## Non-Fungible Token Restrictions

Non-Fungible Tokens (NFT) on Fuel are Native Assets and thus follow the same standard as Fungible Tokens with some restrictions. For a Native Asset on Fuel to be deemed an NFT, the following must be applied:
Expand All @@ -72,16 +72,16 @@ This standard does not introduce any security concerns, as it does not call exte

```rust
abi MyToken {
#[storage(read)]
fn total_supply(asset: AssetId) -> u64;
#[storage(read)]
fn total_assets() -> u64;
#[storage(read)]
fn decimals(asset: AssetId) -> u8;
fn total_supply(asset: AssetId) -> Option<u64>;
#[storage(read)]
fn name(asset: AssetId) -> Option<String>;
#[storage(read)]
fn name(asset: AssetId) -> String;
fn symbol(asset: AssetId) -> Option<String>;
#[storage(read)]
fn symbol(asset: AssetId) -> String;
fn decimals(asset: AssetId) -> Option<u8>;
}
```

Expand Down
Loading