Endless Coin(EDS)

On the Endless chain, all types of tokens adhere to the FungibleAsset(FA) standard. This concept is equivalent to "fungible tokens" on other blockchains, such as Ethereum. For simplicity, in the following sections, "token" and "asset" are used interchangeably.

Digital Assets

In simple terms, every token corresponds to:

  1. Token Metadata

struct Metadata has key {
    /// Token name, e.g., "US Dollar Tether"
    name: String,
    /// More commonly used token symbol, e.g., "USDT"
    symbol: String,
    /// Token precision, e.g., EDS or Ether
    decimals: u8,
    /// Token icon URI
    icon_uri: String,
    /// Project URI
    project_uri: String,
}
  1. FungibleStore,the storage location for a specific account's token balance:

struct FungibleStore has key {
    /// Address of the metadata object
    metadata: Object<Metadata>,
    /// Token balance
    balance: Aggregator<u128>,
    /// Freeze option
    frozen: bool,
}
  1. FungibleAsset(FA), the memory representation of a fungible token in VM enviroment:

struct FungibleAsset {
    // Associated token metadata
    metadata: Object<Metadata>,
    // Token amount
    amount: u128,
}

FungibleAsset only exists in VM memory; at the end of transaction, any FA needs be merged into FungibleStore of corrsponding Account, otherwise FA is burned or dropped.

Endless provides move functions to handle token operations, such as:

  • public entry fun transfer<T: key>(sender: & signer, from: Object<T>, to: Object<T>, amount: u128)

  • public fun withdraw<T: key>(owner: & signer, store: Object<T>, amount: u64): FungibleAsset

  • public fun deposit<T: key>(store: Object<T>, fa: FungibleAsset)

  • public fun mint_to<T: key>( ref: & MintRef, store: Object<T>, amount: u128)

  • public fun burn_from<T: key>( ref: & BurnRef, store: Object<T>, amount: u128)

  • ...

These functions enable token minting, transferring, and burning between accounts.

EDS Native Token

The metadata for the native token EDS is as follows:

name: string::utf8(b"Endless Coin"),
symbol: string::utf8(EDS_SYMBOL)
decimals: 8,
icon_uri: "https://www.endless.link/eds-icon.svg"
project_uri: "https://www.endless.link"

The smallest denomination of EDS is Vein; 1 EDS is equivalent to 1×1081 \times 10^{8} veins.

Assume Alice has an account on the Endless Chain but does not currently hold any EDS tokens.

If Bob transfers 1 EDS to Alice, the transaction will involve the following steps:

1

Withdraw

Deduct 1 EDS from Bob's account and create a corresponding FungibleAsset with an amount of 1 EDS.

2

CreateFungibleStore

Check if Alice's account has an associated storage location for FungibleStore. If not, create a new storage location and link it to Alice's account.

3

Deposit

Call the system function deposit to store the token in Alice's FungibleStore.

For more details on system functions related to EDS, refer to the source code

Last updated