Core
Contract Info
Contract Name:
move_fun::legacy_coin
Contract Address: [tba]
Resources
Info
Represents the global storage for managing the legacy coin supply and details.
struct Info<phantom BuyCoinType, phantom SellCoinType> has key {
total_bound_supply: u64,
liquidity_supply: Coin<BuyCoinType>,
target_price_numerator: u64,
target_price_denominator: u64,
buy_coin_store: Coin<BuyCoinType>,
sell_coin_store: Coin<SellCoinType>,
virtual_balance_store: smart_table::SmartTable<address, Coin<BuyCoinType>>,
max_wallet_balance: Option<u64>,
}
total_bound_supply
u64
Total supply bound to the bonding curve.
liquidity_supply
Coin
Supply allocated for liquidity.
target_price_numerator
u64
Target price numerator for the buy coin.
target_price_denominator
u64
Target price denominator for the buy coin.
buy_coin_store
Coin
Coin supply available for selling.
sell_coin_store
Coin
Coin supply held for selling.
virtual_balance_store
smart_table::SmartTable<address, Coin>
Virtual balance for storing coins during buy/sell.
max_wallet_balance
Option
Maximum allowed balance per wallet (optional).
CoinMetadata
Stores metadata for the legacy coin.
struct CoinMetadata<phantom CoinType> has key, store {
name: String,
symbol: String,
decimals: u8,
max_supply: u64,
logo: String,
banner: String,
description: String,
links: vector<String>
}
name
String
Name of the coin.
symbol
String
Symbol of the coin.
decimals
u8
Number of decimal places for the coin.
max_supply
u64
Maximum supply of the coin.
logo
String
URL to the coin's logo.
banner
String
URL to the coin's banner.
description
String
Description of the coin.
links
vector
List of links related to the coin.
Events
CoinDeployed
Emitted when the coin is deployed.
#[event]
struct CoinDeployed has drop, store {
coin_address: String,
name: String,
symbol: String,
decimals: u8,
max_supply: u64,
logo: String,
banner: String,
description: String,
links: vector<String>
}
CoinBought
Emitted when coins are bought.
#[event]
struct CoinBought has drop, store {
buyer: address,
coin: String,
amount_base_value: u64,
amount_exponent_value: u64,
at_price_numerator: u64,
at_price_denominator: u64,
paid: u64,
paid_coin: String,
accumulated_sell_supply: u64,
remaining_supply: u64,
}
CoinSold
Emitted when coins are sold.
#[event]
struct CoinSold has drop, store {
seller: address,
coin: String,
amount_base_value: u64,
amount_exponent_value: u64,
at_price_numerator: u64,
at_price_denominator: u64,
received: u64,
received_coin: String,
accumulated_sell_supply: u64,
remaining_supply: u64,
}
Public Functions
Initialize Legacy Coin
Initializes the legacy coin with bonding curve parameters and metadata.
public(friend) fun initialize<BuyCoinType, SellCoinType>(
signer_ref: &signer,
max_supply: u64,
initial_price_numerator: u64,
initial_price_denominator: u64,
target_price_numerator: u64,
target_price_denominator: u64,
bound_supply_percentage: u8,
logo: String,
banner: String,
description: String,
links: vector<String>,
max_wallet_balance: Option<u64>
)
signer_ref
signer
The signer's reference.
max_supply
u64
Maximum supply of the coin.
initial_price_numerator
u64
Initial price numerator for the coin.
initial_price_denominator
u64
Initial price denominator for the coin.
target_price_numerator
u64
Target price numerator for the coin.
target_price_denominator
u64
Target price denominator for the coin.
bound_supply_percentage
u8
Percentage of the total supply bound to the bonding curve.
logo
String
URL to the coin's logo.
banner
String
URL to the coin's banner.
description
String
Description of the coin.
links
vector
List of links related to the coin.
max_wallet_balance
Option
Optional max wallet balance.
Buy Legacy Coin
Allows users to buy coins based on the bonding curve.
public(friend) fun buy<BuyCoinType, SellCoinType>(
buyer: &signer,
amount_base_value: u64,
amount_exponent_value: u64
) acquires Info
buyer
signer
The buyer's 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 coins back into the bonding curve.
public(friend) fun sell<BuyCoinType, SellCoinType>(
seller: &signer,
amount_base_value: u64,
amount_exponent_value: u64
) acquires Info
seller
signer
The seller's 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 Metadata
Retrieves the metadata for the legacy coin.
#[view]
public fun metadata<CoinType>(): (String, String, u8, u64, String, String, String, vector<String>) acquires CoinMetadata
name
String
Name of the coin.
symbol
String
Symbol of the coin.
decimals
u8
Number of decimal places for the coin.
max_supply
u64
Maximum supply of the coin.
logo
String
URL to the coin's logo.
banner
String
URL to the coin's banner.
description
String
Description of the coin.
links
vector
List of links related to the coin.
Last updated