Yuzu Documentation
  • General Information
    • Introduction
    • Get MOVE Coins
  • Products
    • CLMM
      • Fee Tiers
      • Price Ranges
      • Active & Inactive Liquidity
      • LP Position NFTs
    • Glossary
  • Socials
    • Contacts
    • Brand & Logos
  • Technical
    • Smart Contracts
      • Yuzu CLMM
        • Liquidity Pool
        • Router
        • Scripts
        • Example Usage
          • Liquidity Pool
          • Position NFT Manager Module
          • Tick Math Module
      • Move.Fun
        • Smart Contracts
    • Ecosystem Participants of Yuzu
  • Legal
    • Terms of Use
    • Legal Disclaimer
Powered by GitBook
On this page
  • 1. Module: move_fun::bonding_curve
  • Module Info
  • Resources
  • Public Functions
  • Errors
  • 2. Module: move_fun::fungible_asset
  • Module Info
  • Resources
  • Events
  • Public Functions
  • View Functions
  • Errors
  • 3. Module: move_fun::fungible_asset_router
  • Module Info
  • Events
  • Entry Functions
  • View Functions
  • Internal Functions
  • Errors
  1. Technical
  2. Smart Contracts
  3. Move.Fun

Smart Contracts

1. Module: move_fun::bonding_curve

Module Info

  • Description: Core logic for managing bonding curves used in fungible asset pricing.

Resources

BondingCurves

struct BondingCurves has key {
    table: table::Table<String, BondingCurve>
}

BondingCurve

struct BondingCurve has key, drop, store, copy {
    initial_price_numerator: u128,
    initial_price_denominator: u128,
    growth_constant: u128
}

Public Functions

Function

Description

initialize<CoinType>

Initialize bonding curve for a token.

initialize_fa

Initialize bonding curve for a fungible asset object.

calculate_k

Calculate the growth constant k.

calculate_buy_amount_out

Get amount out when buying with given input.

calculate_buy_amount_in

Get amount needed to buy specific output.

calculate_sell_amount_out

Get amount received when selling tokens.

calculate_sell_amount_in

Calculate tokens needed to get a specific return when selling.

calculate_price

Calculate token price based on supply.

set_market_cap_goal

Adjust bonding curve's growth constant k.

calculate_price_by_amounts

Quick price calculation helper.

bonding_curve<CoinType>

Access bonding curve for a token type.

fa_bonding_curve

Access bonding curve for a fungible asset.

initial_price

Return initial price components (numerator, denominator).

growth_constant

Return the growth constant k.

Errors

Code

Description

1

Same growth constant as existing.

2

Amount out exceeds limits.


2. Module: move_fun::fungible_asset

Module Info

  • Description: Defines a fungible asset backed by a bonding curve with mechanisms for buying, selling, and tracking supply.

Resources

Registry

Manages fungible asset info per address.

Info

Stores details for an asset's bonding curve.

Store

Manages virtual balances for wallets.

FaMetadata

Stores additional metadata: logo, banner, description, links.

Events

Event

Description

FaDeployed

Emitted after deploying a FA.

FaBought

Emitted after a successful FA buy.

FaSold

Emitted after a successful FA sale.

BundleBuy

Emitted after bundled buy distribution.

FeeExtracted

Emitted after fee extraction.

Public Functions

Function

Description

initialize_registry

Setup registry.

initialize<DEX>

Initialize a fungible asset.

buy_exact_out

Buy exact token amount, paying MOVE.

buy_exact_in

Buy as much token as possible with given MOVE.

sell_exact_in

Sell tokens for MOVE.

sell_exact_out

Sell exact MOVE amount worth of tokens.

quote_buy_exact_in

Quote tokens for exact MOVE input.

quote_buy_exact_out

Quote MOVE for exact token output.

quote_sell_exact_in

Quote MOVE for selling tokens.

quote_sell_exact_out

Quote tokens needed to sell for MOVE.

retrieve_accumulated_supply

Retrieve all sold MOVE funds.

claim

Claim tokens post-bonding curve.

retrieve_liquidity_supply

Retrieve liquidity-bound tokens.

distribute_virtual_balances

Distribute tokens to wallets from virtual balances.

target_price

Get target price of a FA.

transfer_from_virtual_balance

Move virtual tokens to wallet.

batch_transfer

Batch transfer virtual balances.

set_bonding_curve_goal_reached

Finalize bonding curve.

View Functions

  • price_denominator

  • total_bound_supply

  • available_supply

  • accumulated_sell_supply

  • price_at_supply

  • virtual_balance

  • virtual_balances

  • has_virtual_balance

  • icon_uri

  • banner_uri

  • project_uri

  • misc_metadata

  • bonding_curve_goal

  • initial_price

  • dex

  • max_wallet_balance

  • is_registered

Errors

Code

Description

1

Wallet balance exceeds max.

2

FA not registered.

3

No virtual balance owned.

4

No virtual balance exists.


3. Module: move_fun::fungible_asset_router

Module Info

  • Description: Entry point module to interact with fungible assets on bonding curves: buying, selling, launching, airdropping.

Events

Event

Description

FeeExtracted

Fee event (deprecated).

FaMigrated

Token migration after bonding curve ends.

Airdropped

Virtual balance airdrop event.

Entry Functions

Function

Description

create<DEX>

Initialize bonding curve for existing FA.

buy_exact_out

Buy exact FA amount for MOVE.

buy_exact_move

Spend fixed MOVE amount to buy FA.

sell_exact_in

Sell FA tokens for MOVE.

sell_exact_move

Sell FA for exact MOVE amount.

claim_virtual_balance

Claim post-bonding curve tokens.

airdrop

Airdrop remaining tokens to holders.

View Functions

Function

Description

quote_buy_exact_out

Get MOVE cost for exact FA.

quote_buy_exact_move

Get FA for MOVE input.

quote_sell_exact_in

Get MOVE for selling FA.

quote_sell_exact_move

Get FA needed to sell for MOVE.

Internal Functions

  • launch: Finalize bonding curve and create liquidity pool.

Errors

Code

Description

1

Not owner of FA.

2

Bonding curve already completed.

3

Slippage exceeded.

4

Invalid total supply.

PreviousMove.FunNextEcosystem Participants of Yuzu

Last updated 21 days ago