TokenBuilder

Struct TokenBuilder 

Source
pub struct TokenBuilder {
    pub name: Option<String>,
    pub symbol: Option<String>,
    pub total_supply: Option<i64>,
    pub current_supply: Option<f64>,
    pub initial_supply_percentage: Option<f64>,
    pub inflation_rate: Option<f64>,
    pub burn_rate: Option<f64>,
    pub initial_price: Option<f64>,
    pub airdrop_percentage: Option<f64>,
    pub unlock_schedule: Option<Vec<UnlockEvent>>,
}
Expand description

Builder for creating a new token. The builder allows to configure the token with the following parameters.

Fields§

§name: Option<String>

Name of the token. Required field.

§symbol: Option<String>

Symbol of the token. Default value: “TKN”.

§total_supply: Option<i64>

Total supply of the token. Default value: 1,000,000.

§current_supply: Option<f64>

Current supply of the token. Default value: 0.

§initial_supply_percentage: Option<f64>

Initial supply of the token, in percentage of total supply. Default value: 100%.

§inflation_rate: Option<f64>

Annual percentage increase in supply, if supply is inflationary. Optional field.

§burn_rate: Option<f64>

Percentage of tokens burned during each transaction, if deflationary. Optional field.

§initial_price: Option<f64>

Initial price of the token in simulation. Default value: 1.

§airdrop_percentage: Option<f64>

Airdrop amount of the token, in percentage of total supply. Optional field.

§unlock_schedule: Option<Vec<UnlockEvent>>

Unlock schedule. Optional field.

Implementations§

Source§

impl TokenBuilder

Source

pub fn new() -> Self

Create a new token builder to configure the token.

§Returns

New token builder.

Source

pub fn name(self, name: String) -> Self

Set the name of the token.

§Arguments
  • name - Name of the token.
§Returns

The token builder.

Source

pub fn symbol(self, symbol: String) -> Self

Set the symbol of the token.

§Arguments
  • symbol - Symbol of the token.
§Returns

The token builder.

Source

pub fn total_supply(self, total_supply: i64) -> Self

Set the total supply of the token.

§Arguments
  • total_supply - Total supply of the token.
§Returns

The token builder.

Source

pub fn current_supply(self, current_supply: f64) -> Self

Set the current supply of the token.

§Arguments
  • current_supply - Current supply of the token.
§Returns

The token builder.

Source

pub fn initial_supply_percentage(self, initial_supply_percentage: f64) -> Self

Set the initial supply of the token, in percentage of total supply.

§Arguments
  • initial_supply_percentage - Initial supply of the token.
§Returns

The token builder.

Source

pub fn inflation_rate(self, inflation_rate: f64) -> Self

Set the annual percentage increase in supply, if supply is inflationary.

§Arguments
  • inflation_rate - Annual percentage increase in supply.
§Returns

The token builder.

Source

pub fn burn_rate(self, burn_rate: f64) -> Self

Set the percentage of tokens burned during each transaction, if deflationary.

§Arguments
  • burn_rate - Percentage of tokens burned during each transaction.
§Returns

The token builder.

Source

pub fn initial_price(self, initial_price: f64) -> Self

Set the initial price of the token in simulation.

§Arguments
  • initial_price - Initial price of the token.
§Returns

The token builder.

Source

pub fn airdrop_percentage(self, airdrop_percentage: f64) -> Self

Set the airdrop amount of the token, in percentage of total supply.

§Arguments
  • airdrop_percentage - Airdrop amount of the token.
§Returns

The token builder.

Source

pub fn unlock_schedule(self, unlock_schedule: Vec<UnlockEvent>) -> Self

Set the unlock schedule.

§Arguments
  • unlock_schedule - List of unlock events.
§Returns

The token builder.

Source

pub fn build(self) -> Result<Token, SimulationError>

Build the token.

§Returns

Token with the configured parameters.

Trait Implementations§

Source§

impl Debug for TokenBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TokenBuilder

Source§

fn default() -> TokenBuilder

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TokenBuilder

Source§

fn eq(&self, other: &TokenBuilder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TokenBuilder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V