Trait Mint

Source
pub trait Mint:
    RuntimeProvider
    + StorageProvider
    + SystemProvider {
    // Required method
    fn purse_exists(&mut self, uref: URef) -> Result<bool, Error>;

    // Provided methods
    fn mint(&mut self, initial_balance: U512) -> Result<URef, Error> { ... }
    fn burn(&mut self, purse: URef, amount: U512) -> Result<(), Error> { ... }
    fn reduce_total_supply(&mut self, amount: U512) -> Result<(), Error> { ... }
    fn balance(&mut self, purse: URef) -> Result<Option<U512>, Error> { ... }
    fn transfer(
        &mut self,
        maybe_to: Option<AccountHash>,
        source: URef,
        target: URef,
        amount: U512,
        id: Option<u64>,
    ) -> Result<(), Error> { ... }
    fn read_base_round_reward(&mut self) -> Result<U512, Error> { ... }
    fn mint_into_existing_purse(
        &mut self,
        existing_purse: URef,
        amount: U512,
    ) -> Result<(), Error> { ... }
}
Expand description

Mint trait.

Required Methods§

Source

fn purse_exists(&mut self, uref: URef) -> Result<bool, Error>

Check if a purse exists.

Provided Methods§

Source

fn mint(&mut self, initial_balance: U512) -> Result<URef, Error>

Mint new token with given initial_balance balance. Returns new purse on success, otherwise an error.

Source

fn burn(&mut self, purse: URef, amount: U512) -> Result<(), Error>

Burns native tokens.

Source

fn reduce_total_supply(&mut self, amount: U512) -> Result<(), Error>

Reduce total supply by amount. Returns unit on success, otherwise an error.

Source

fn balance(&mut self, purse: URef) -> Result<Option<U512>, Error>

Read balance of given purse.

Source

fn transfer( &mut self, maybe_to: Option<AccountHash>, source: URef, target: URef, amount: U512, id: Option<u64>, ) -> Result<(), Error>

Transfers amount of tokens from source purse to a target purse.

Source

fn read_base_round_reward(&mut self) -> Result<U512, Error>

Retrieves the base round reward.

Source

fn mint_into_existing_purse( &mut self, existing_purse: URef, amount: U512, ) -> Result<(), Error>

Mint amount new token into existing_purse. Returns unit on success, otherwise an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S> Mint for RuntimeNative<S>
where S: StateReader<Key, StoredValue, Error = Error>,