pub struct Token {
pub id: Uuid,
pub name: String,
pub symbol: Option<String>,
pub maximum_supply: Decimal,
pub current_supply: Decimal,
pub initial_supply_percentage: Decimal,
pub inflation_rate: Option<Decimal>,
pub burn_rate: Option<Decimal>,
pub initial_price: Option<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.
symbol: Option<String>
Symbol of the token.
maximum_supply: Decimal
Maximum supply of the token.
current_supply: Decimal
Current supply of the token.
initial_supply_percentage: Decimal
Initial supply of the token, in percentage of maximum supply.
inflation_rate: Option<Decimal>
Annual percentage increase in supply, if supply is inflationary.
burn_rate: Option<Decimal>
Percentage of tokens burned during each transaction, if deflationary.
initial_price: Option<Decimal>
Initial price of the token in simulation
airdrop_percentage: Option<Decimal>
Airdrop amount of the token, in percentage of maximum supply.
unlock_schedule: Option<Vec<UnlockEvent>>
Unlock schedule.
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.
§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>)
Sourcepub fn initial_supply(&self) -> Decimal
pub fn initial_supply(&self) -> Decimal
Calculate the initial supply based on the initial supply percentage.
§Returns
Initial supply of the token.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Token
impl<'de> Deserialize<'de> for Token
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more