Router

Contract Info

  • Contract Name: move_fun::legacy_coin_router

  • Contract Address: [tba]


Resources


Info

Represents the global storage for managing the bonding curve metadata, and only admins can modify it.

struct Info<phantom BuyCoinType, phantom SellCoinType> has key {
    initial_price_numerator: u64,
    initial_price_denominator: u64,
    bonding_curve_goal: u64,
    dex: TypeInfo,
}
Name
Type
Description

initial_price_numerator

u64

Initial price numerator of the bonding curve.

initial_price_denominator

u64

Initial price denominator of the bonding curve.

bonding_curve_goal

u64

Total sales goal after which the liquidity pool is created.

dex

TypeInfo

The DEX where the liquidity pool will be created.


Entry Functions


Create Legacy Coin with Bonding Curve

Initializes a new bonding curve for a legacy coin. Only callable by the owner of the buy coin.

public(friend) entry fun create<BuyCoinType, DEX>(
    deployer: &signer,
    name: String,
    symbol: String,
    logo: String,
    banner: String,
    description: String,
    links: vector<String>,
    max_wallet_balance: Option<u64>,
    bundled_launch_amount_base_value: Option<u64>,
    bundled_launch_amount_exponent_value: Option<u64>
) acquires Info
Input Values
Type
Description

deployer

signer

The deployer's signer reference.

name

String

Name of the legacy coin.

symbol

String

Symbol of the legacy coin.

logo

String

URL to the logo of the coin.

banner

String

URL to the banner of the coin.

description

String

Description of the coin.

links

vector

List of links related to the coin.

max_wallet_balance

Option

Optional maximum wallet balance limit.

bundled_launch_amount_base_value

Option

Optional base value for bundled launch.

bundled_launch_amount_exponent_value

Option

Optional exponent value for bundled launch.


Buy Legacy Coin

Allows users to buy legacy coins based on the bonding curve.

public(friend) entry fun buy<BuyCoinType>(
    buyer: &signer,
    amount_base_value: u64,
    amount_exponent_value: u64
) acquires Info
Input Values
Type
Description

buyer

signer

The buyer's signer reference.

amount_base_value

u64

Base value of the amount to buy.

amount_exponent_value

u64

Exponent value of the amount to buy.


Sell Legacy Coin

Allows users to sell legacy coins back into the bonding curve.

public(friend) entry fun sell<BuyCoinType>(
    seller: &signer,
    amount_base_value: u64,
    amount_exponent_value: u64
) acquires Info
Input Values
Type
Description

seller

signer

The seller's signer reference.

amount_base_value

u64

Base value of the amount to sell.

amount_exponent_value

u64

Exponent value of the amount to sell.


View Functions


Get Bonding Curve Goal

Returns the bonding curve goal for the given coin.

#[view]
public fun bonding_curve_goal<BuyCoinType>(): u64 acquires Info
Return Values
Type
Description

bonding_curve_goal

u64

The bonding curve goal.


Get Initial Price

Returns the initial price of the bonding curve.

#[view]
public fun initial_price<BuyCoinType>(): (u64, u64) acquires Info
Return Values
Type
Description

initial_price_numerator

u64

The initial price numerator.

initial_price_denominator

u64

The initial price denominator.


Get DEX

Returns the DEX where the liquidity pool will be created.

#[view]
public fun dex<BuyCoinType>(): TypeInfo acquires Info
Return Values
Type
Description

dex

TypeInfo

The DEX where the liquidity pool will be created.

Last updated