Trait oasis_runtime_sdk::modules::consensus_accounts::API

source ·
pub trait API {
    // Required methods
    fn deposit<C: Context>(
        ctx: &C,
        from: Address,
        nonce: u64,
        to: Address,
        amount: BaseUnits,
    ) -> Result<(), Error>;
    fn withdraw<C: Context>(
        ctx: &C,
        from: Address,
        nonce: u64,
        to: Address,
        amount: BaseUnits,
    ) -> Result<(), Error>;
    fn delegate<C: Context>(
        ctx: &C,
        from: Address,
        nonce: u64,
        to: Address,
        amount: BaseUnits,
        receipt: bool,
    ) -> Result<(), Error>;
    fn undelegate<C: Context>(
        ctx: &C,
        from: Address,
        nonce: u64,
        to: Address,
        shares: u128,
        receipt: bool,
    ) -> Result<(), Error>;
}
Expand description

Interface that can be called from other modules.

Required Methods§

source

fn deposit<C: Context>( ctx: &C, from: Address, nonce: u64, to: Address, amount: BaseUnits, ) -> Result<(), Error>

Transfer from consensus staking account to runtime account.

§Arguments
  • nonce: A caller-provided sequence number that will help identify the success/fail events. When called from a deposit transaction, we use the signer nonce.
source

fn withdraw<C: Context>( ctx: &C, from: Address, nonce: u64, to: Address, amount: BaseUnits, ) -> Result<(), Error>

Transfer from runtime account to consensus staking account.

§Arguments
  • nonce: A caller-provided sequence number that will help identify the success/fail events. When called from a withdraw transaction, we use the signer nonce.
source

fn delegate<C: Context>( ctx: &C, from: Address, nonce: u64, to: Address, amount: BaseUnits, receipt: bool, ) -> Result<(), Error>

Delegate from runtime account to consensus staking account.

§Arguments
  • nonce: A caller-provided sequence number that will help identify the success/fail events. When called from a delegate transaction, we use the signer nonce.
source

fn undelegate<C: Context>( ctx: &C, from: Address, nonce: u64, to: Address, shares: u128, receipt: bool, ) -> Result<(), Error>

Start the undelegation process of the given number of shares from consensus staking account to runtime account.

§Arguments
  • nonce: A caller-provided sequence number that will help identify the success/fail events. When called from an undelegate transaction, we use the signer nonce.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Consensus: API> API for Module<Consensus>