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§
Sourcefn deposit<C: Context>(
ctx: &C,
from: Address,
nonce: u64,
to: Address,
amount: BaseUnits,
) -> Result<(), Error>
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.
Sourcefn withdraw<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>
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.
Sourcefn delegate<C: Context>(
ctx: &C,
from: Address,
nonce: u64,
to: Address,
amount: BaseUnits,
receipt: bool,
) -> Result<(), Error>
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.
Sourcefn undelegate<C: Context>(
ctx: &C,
from: Address,
nonce: u64,
to: Address,
shares: u128,
receipt: bool,
) -> Result<(), Error>
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.
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.