> For the complete documentation index, see [llms.txt](https://docs.satay.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.satay.finance/technical-overview/asset-module.md).

# Asset Module

## Overview

The `satay::asset` module manages the creation and handling of fungible assets. It provides functions for creating assets, minting tokens and burning tokens.

## Structs

### **AssetController**

The `AssetController` struct contains the references required to mint, burn, and transfer fungible assets. It is associated with the asset's metadata and controls the management of assets of the associated metadata.

```rust
struct AssetController has key {
    mint_ref: MintRef,
    burn_ref: BurnRef,
    transfer_ref: TransferRef
}
```

## Error Codes

* **ENOT\_ASSET\_OWNER**: `u64 = 0` – Error indicating that the signer is not the owner of the asset.
* **EASSET\_CONTROLLER\_NOT\_FOUND**: `u64 = 1` – Error indicating that the `AssetController` could not be found.
* **EASSET\_META\_NOT\_FOUND**: `u64 = 2` – Error indicating that the metadata for the asset was not found.

## Public Functions

1. **Asset Creation**
   * `create(owner: &signer, name: String, symbol: String, decimals: u8, icon_uri: String, project_uri: String): Object<Metadata>`: Creates a new fungible asset with the given name, symbol, decimals, and URIs. The asset's `AssetController` is also created to manage minting and burning.
   * `create_with_seed(owner: &signer, seed: vector<u8>, name: String, symbol: String, decimals: u8, icon_uri: String, project_uri: String): Object<Metadata>`: Creates a fungible asset using a seed for the address generation.
2. **Minting and Burning**
   * `safe_mint(signer: &signer, metadata: Object<Metadata>, amount: u64): FungibleAsset`: Mints new tokens for the given asset metadata if the signer is the owner of the asset. Calls the internal `mint` function.
   * `mint(metadata: Object<Metadata>, amount: u64): FungibleAsset`: Internally mints new tokens for the given asset metadata. Requires an `AssetController` reference.
   * `safe_burn(signer: &signer, asset: FungibleAsset): u64`: Burns the given fungible asset if the signer is the owner of the asset. Calls the internal `burn` function.
   * `burn(asset: FungibleAsset): u64`: Internally burns the specified fungible asset. Requires an `AssetController` reference.

## Helper Functions

* `create_internal(constructor_ref: &ConstructorRef, name: String, symbol: String, decimals: u8, icon_uri: String, project_uri: String): Object<Metadata>`: Internal function to handle the asset creation process, including setting up minting, burning, and transferring capabilities.

### Access Control

* **Friend Functions**: The `satay::base_strategy`, and `satay::vault` modules are friends of `satay::asset`, giving them access to certain internal protocol functions.
