pub struct Module<Cfg: Config> { /* private fields */ }

Implementations§

source§

impl<Cfg: Config> Module<Cfg>

source

pub fn init(genesis: Genesis)

source§

impl<Cfg: Config> Module<Cfg>

source

pub fn query_estimate_gas<C: Context>( ctx: &C, args: EstimateGasQuery ) -> Result<u64, Error>

Run a transaction in simulation and return how much gas it uses. This looks up the method in the context’s method registry. Transactions that fail still use gas, and this query will estimate that and return successfully, so do not use this query to see if a transaction will succeed.

Trait Implementations§

source§

impl<Cfg: Config> API for Module<Cfg>

§

type Config = Cfg

Module configuration.
source§

fn use_batch_gas(gas: u64) -> Result<(), Error>

Attempt to use gas. If the gas specified would cause either total used to exceed its limit, fails with Error::OutOfGas or Error::BatchOutOfGas, and neither gas usage is increased.
source§

fn use_tx_gas(gas: u64) -> Result<(), Error>

Attempt to use gas. If the gas specified would cause either total used to exceed its limit, fails with Error::OutOfGas or Error::BatchOutOfGas, and neither gas usage is increased.
source§

fn remaining_batch_gas() -> u64

Returns the remaining batch-wide gas.
source§

fn used_batch_gas() -> u64

Returns the total batch-wide gas used.
source§

fn remaining_tx_gas() -> u64

Return the remaining tx-wide gas.
source§

fn used_tx_gas() -> u64

Return the used tx-wide gas.
source§

fn max_batch_gas() -> u64

Configured maximum amount of gas that can be used in a batch.
source§

fn min_gas_price<C: Context>(ctx: &C, denom: &Denomination) -> Option<u128>

Configured minimum gas price.
source§

fn set_priority(priority: u64)

Sets the transaction priority to the provided amount.
source§

fn take_priority() -> u64

Takes and returns the stored transaction priority.
source§

fn set_sender_meta(meta: SenderMeta)

Set transaction sender metadata.
source§

fn take_sender_meta() -> SenderMeta

Takes and returns the stored transaction sender metadata.
source§

fn estimate_gas_search_max_iters<C: Context>(ctx: &C) -> u64

Returns the configured max iterations in the binary search for the estimate gas.
source§

fn has_epoch_changed() -> bool

Check whether the epoch has changed since last processed block.
source§

impl<Cfg: Config> BlockHandler for Module<Cfg>

source§

fn begin_block<C: Context>(ctx: &C)

Perform any common actions at the start of the block (before any transactions have been executed).
source§

fn end_block<C: Context>(ctx: &C)

Perform any common actions at the end of the block (after all transactions have been executed).
source§

impl<Cfg: Config> InvariantHandler for Module<Cfg>

source§

fn check_invariants<C: Context>(_ctx: &C) -> Result<(), Error>

Check invariants.
source§

impl<Cfg: Config> MethodHandler for Module<Cfg>

source§

fn dispatch_query<C: Context>( ctx: &C, method: &str, args: Value ) -> DispatchResult<Value, Result<Value, RuntimeError>>

Dispatch a query.
source§

fn supported_methods() -> Vec<MethodHandlerInfo>

Lists the names of all RPC methods exposed by this module. The result is informational only. An empty return vector means that the implementor does not care to list the methods, or the implementor is a tuple of modules.
source§

fn is_expensive_query(method: &str) -> bool

Checks whether the given query method is tagged as expensive.
source§

fn is_allowed_private_km_query(method: &str) -> bool

Checks whether the given query is allowed to access private key manager state.
source§

fn prefetch( _prefixes: &mut BTreeSet<Prefix>, _method: &str, body: Value, _auth_info: &AuthInfo ) -> DispatchResult<Value, Result<(), RuntimeError>>

Add storage prefixes to prefetch.
source§

fn dispatch_call<C: Context>( _ctx: &C, _method: &str, body: Value ) -> DispatchResult<Value, CallResult>

Dispatch a call.
source§

fn dispatch_message_result<C: Context>( _ctx: &C, _handler_name: &str, result: MessageResult ) -> DispatchResult<MessageResult, ()>

Dispatch a message result.
source§

fn is_allowed_interactive_call(_method: &str) -> bool

Checks whether the given call is allowed to be called interactively via read-only transactions.
source§

impl<Cfg: Config> MigrationHandler for Module<Cfg>

§

type Genesis = Genesis

Genesis state type. Read more
source§

fn init_or_migrate<C: Context>( _ctx: &C, meta: &mut Metadata, genesis: Self::Genesis ) -> bool

Initialize state from genesis or perform a migration. Read more
source§

impl<Cfg: Config> Module for Module<Cfg>

source§

const NAME: &'static str = MODULE_NAME

Module name.
§

type Error = Error

Module error type.
§

type Event = Event

Module event type.
§

type Parameters = Parameters

Module parameters.
source§

const VERSION: u32 = 1u32

Module version.
source§

fn params() -> Self::Parameters

Return the module’s parameters.
source§

fn set_params(params: Self::Parameters)

Set the module’s parameters.
source§

impl<Cfg: Config> TransactionHandler for Module<Cfg>

source§

fn approve_raw_tx<C: Context>(_ctx: &C, tx: &[u8]) -> Result<(), Error>

Judge if a raw transaction is good enough to undergo decoding. This takes place before even decoding the transaction.
source§

fn approve_unverified_tx<C: Context>( _ctx: &C, utx: &UnverifiedTransaction ) -> Result<(), Error>

Judge if an unverified transaction is good enough to undergo verification. This takes place before even verifying signatures.
source§

fn before_handle_call<C: Context>(ctx: &C, call: &Call) -> Result<(), Error>

Perform any action after authentication, within the transaction context. Read more
source§

fn after_handle_call<C: Context>( ctx: &C, result: CallResult ) -> Result<CallResult, Error>

Perform any action after call, within the transaction context. Read more
source§

fn decode_tx<C: Context>( _ctx: &C, _scheme: &str, _body: &[u8] ) -> Result<Option<Transaction>, Error>

Decode a transaction that was sent with module-controlled decoding and verify any signatures. Read more
source§

fn authenticate_tx<C: Context>(_ctx: &C, _tx: &Transaction) -> Result<(), Error>

Authenticate a transaction. Read more
source§

fn after_dispatch_tx<C: Context>( _ctx: &C, _tx_auth_info: &AuthInfo, _result: &CallResult )

Perform any action after dispatching the transaction, in batch context.

Auto Trait Implementations§

§

impl<Cfg> RefUnwindSafe for Module<Cfg>
where Cfg: RefUnwindSafe,

§

impl<Cfg> Send for Module<Cfg>
where Cfg: Send,

§

impl<Cfg> Sync for Module<Cfg>
where Cfg: Sync,

§

impl<Cfg> Unpin for Module<Cfg>
where Cfg: Unpin,

§

impl<Cfg> UnwindSafe for Module<Cfg>
where Cfg: UnwindSafe,

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

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<M> ModuleInfoHandler for M
where M: Module + MethodHandler,

source§

fn module_info<C>(_ctx: &C) -> BTreeMap<String, ModuleInfo>
where C: Context,

Reports info about the module (or modules, if Self is a tuple).
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,