[]Struct srml_contract::Module

pub struct Module<T: Trait>(_);

Methods

impl<T: Trait> Module<T>

Can also be called using Call.

pub fn update_schedule(schedule: Schedule<T::Gas>) -> Result

Updates the schedule for metering contracts.

The schedule must have a greater version than the stored schedule.

pub fn put_code(
    origin: <T as Trait>::Origin,
    gas_limit: T::Gas,
    code: Vec<u8>
) -> Result

Stores the given binary Wasm code into the chains storage and returns its codehash. You can instantiate contracts only with stored code.

pub fn call(
    origin: <T as Trait>::Origin,
    dest: <T::Lookup as StaticLookup>::Source,
    value: BalanceOf<T>,
    gas_limit: T::Gas,
    data: Vec<u8>
) -> Result

Makes a call to an account, optionally transferring some balance.

  • If the account is a smart-contract account, the associated code will be executed and any value will be transferred.
  • If the account is a regular account, any value will be transferred.
  • If no account exists and the call value is not less than existential_deposit, a regular account will be created and any value will be transferred.

pub fn create(
    origin: <T as Trait>::Origin,
    endowment: BalanceOf<T>,
    gas_limit: T::Gas,
    code_hash: CodeHash<T>,
    data: Vec<u8>
) -> Result

Creates a new contract from the codehash generated by put_code, optionally transferring some balance.

Creation is executed as follows:

  • the destination address is computed based on the sender and hash of the code.
  • the smart-contract account is created at the computed address.
  • the ctor_code is executed in the context of the newly created account. Buffer returned after the execution is saved as the code of the account. That code will be invoked upon any call received by this account.
  • The contract is initialized.

impl<T: 'static + Trait> Module<T>[src]

pub fn transfer_fee() -> BalanceOf<T>[src]

The fee required to make a transfer.

pub fn creation_fee() -> BalanceOf<T>[src]

The fee required to create an account.

pub fn transaction_base_fee() -> BalanceOf<T>[src]

The fee to be paid for making a transaction; the base.

pub fn transaction_byte_fee() -> BalanceOf<T>[src]

The fee to be paid for making a transaction; the per-byte portion.

pub fn contract_fee() -> BalanceOf<T>[src]

The fee required to create a contract instance.

pub fn call_base_fee() -> T::Gas[src]

The base fee charged for calling into a contract.

pub fn create_base_fee() -> T::Gas[src]

The base fee charged for creating a contract.

pub fn gas_price() -> BalanceOf<T>[src]

The price of one unit of gas.

pub fn max_depth() -> u32[src]

The maximum nesting level of a call/create stack.

pub fn block_gas_limit() -> T::Gas[src]

The maximum amount of gas that could be expended per block.

pub fn gas_spent() -> T::Gas[src]

Gas spent so far in this block.

pub fn current_schedule() -> Schedule<T::Gas>[src]

Current cost schedule for contracts.

Trait Implementations

impl<T: Eq + Trait> Eq for Module<T>

impl<T: Clone + Trait> Clone for Module<T>

impl<T: PartialEq + Trait> PartialEq<Module<T>> for Module<T>

impl<T: Copy + Trait> Copy for Module<T>

impl<T: Debug + Trait> Debug for Module<T>

impl<T: Trait> OnFinalize<<T as Trait>::BlockNumber> for Module<T>

impl<T: Trait> OnInitialize<<T as Trait>::BlockNumber> for Module<T>

impl<T: Trait> OffchainWorker<<T as Trait>::BlockNumber> for Module<T>

impl<T: Trait> Callable for Module<T>

type Call = Call<T>

impl<T: Trait> OnFreeBalanceZero<<T as Trait>::AccountId> for Module<T>[src]

Auto Trait Implementations

impl<T> Sync for Module<T> where
    T: Sync

impl<T> Send for Module<T> where
    T: Send

impl<T> Unpin for Module<T> where
    T: Unpin

impl<T> UnwindSafe for Module<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Module<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> Member for T where
    T: 'static + MaybeDebug + Send + Sync + PartialEq<T> + Eq + Clone
[src]

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Erased for T[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]

impl<T> MaybeDebug for T where
    T: Debug
[src]