Satay Finance
  • Overview
    • Introduction
  • Our Three Pillars
    • Blocks
    • Strategies
    • Vaults
  • Technical Overview
    • Protocol Module
    • Wrapper Module (Legacy)
    • Asset Module
    • Vault Module
    • Base Strategy Module
    • Satay Module
  • Blocks
    • Echelon Block
    • Layerbank Block
    • MovePosition Block
  • Strategy Implementations
    • Leveraged Liquid Staking
    • Liquid Staking + LP Farming
    • Borrow Optimization
    • Echelon Simple
    • Layerbank Simple
    • MovePosition Simple
    • MovePosition Ticket
Powered by GitBook
On this page
  • Overview
  • Structs
  • AssetController
  • Error Codes
  • Public Functions
  • Helper Functions
  • Access Control
  1. Technical Overview

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.

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.

PreviousWrapper Module (Legacy)NextVault Module

Last updated 3 months ago