pub struct Token {
pub id: Uuid,
pub name: String,
pub symbol: String,
pub total_supply: Decimal,
pub current_supply: Decimal,
pub initial_supply_percentage: Decimal,
pub inflation_rate: Option<Decimal>,
pub burn_rate: Option<Decimal>,
pub initial_price: Decimal,
pub airdrop_percentage: Option<Decimal>,
pub unlock_schedule: Option<Vec<UnlockEvent>>,
}
Expand description
Token.
Fields§
§id: Uuid
ID for the token.
name: String
Name of the token. The name is a human-readable identifier for the token.
symbol: String
Symbol of the token. The symbol is a short identifier for the token, usually 3-4 characters long.
total_supply: Decimal
Total supply of the token. The total supply is the maximum number of tokens that can ever exist.
current_supply: Decimal
Current supply of the token. The current supply is the number of tokens that have been minted or airdropped.
initial_supply_percentage: Decimal
Initial supply of the token, in percentage of total supply. The initial supply is the number of tokens that are minted at the start of the simulation.
inflation_rate: Option<Decimal>
Annual percentage increase in supply, if supply is inflationary. The inflation rate is the percentage by which the total supply increases each year.
burn_rate: Option<Decimal>
Percentage of tokens burned during each transaction, if deflationary. The burn rate is the percentage of tokens that are destroyed during each transaction.
initial_price: Decimal
Initial price of the token in simulation. The initial price is the price of the token at the start of the simulation.
airdrop_percentage: Option<Decimal>
Airdrop amount of the token, in percentage of total supply. The airdrop percentage is the percentage of the total supply that is airdropped at the start of the simulation.
unlock_schedule: Option<Vec<UnlockEvent>>
Unlock schedule. The unlock schedule is a list of unlock events, each with a date and amount of tokens to unlock.
Implementations§
Source§impl Token
impl Token
Sourcepub fn add_unlock_event(&mut self, date: DateTime<Utc>, amount: Decimal)
pub fn add_unlock_event(&mut self, date: DateTime<Utc>, amount: Decimal)
Add an unlock event to the schedule. The unlock event will unlock a certain amount of tokens at a certain date.
§Arguments
date
- The date and time of the unlock event.amount
- The amount of tokens to unlock.
Sourcepub fn process_unlocks(&mut self, current_date: DateTime<Utc>)
pub fn process_unlocks(&mut self, current_date: DateTime<Utc>)
Process unlock events up to the current date. Unlocks tokens and removes events that have already occurred.
§Arguments
current_date
- The current date and time.
Sourcepub fn initial_supply(&self) -> Decimal
pub fn initial_supply(&self) -> Decimal
Calculate the initial supply based on the initial supply percentage. The initial supply is the number of tokens that are minted at the start of the simulation.
§Returns
Initial supply of the token.