# 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

```rust
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,
}
```

2. FungibleStore，the storage location for a specific account's token balance:

```rust
struct FungibleStore has key {
    /// Address of the metadata object
    metadata: Object<Metadata>,
    /// Token balance
    balance: Aggregator<u128>,
    /// Freeze option
    frozen: bool,
}
```

3. FungibleAsset(FA), the memory representation of a fungible token in VM enviroment:

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

{% hint style="warning" %}
FungibleAsset's `maximum_supply` and FungibleStore's `amount` are all **u128** type.
{% endhint %}

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:

```json
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 \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:

{% stepper %}
{% step %}
**Withdraw**

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

{% step %}
**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.
{% endstep %}

{% step %}
**Deposit**

Call the system function deposit to store the token in Alice's FungibleStore.
{% endstep %}
{% endstepper %}

## System Function Calls Related

For more details on system functions related to EDS, refer to the [source code](https://github.com/endless-labs/endless-move-framework/tree/main/endless-framework/sources/endless_coin.move)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.endless.link/endless/devbuild/technical-documentation/endless-native-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
