[][src]Struct pallet_contracts::Module

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

Contracts module.

Implementations

impl<T: Trait> Module<T>[src]

Can also be called using Call.

pub fn update_schedule(
    origin: <T as Trait>::Origin,
    schedule: Schedule
) -> DispatchResult
[src]

Updates the schedule for metering contracts.

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

NOTE: Calling this function will bypass origin filters.

pub fn put_code(origin: <T as Trait>::Origin, code: Vec<u8>) -> DispatchResult[src]

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

NOTE: Calling this function will bypass origin filters.

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

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.

NOTE: Calling this function will bypass origin filters.

pub fn instantiate(
    origin: <T as Trait>::Origin,
    endowment: BalanceOf<T>,
    gas_limit: Gas,
    code_hash: CodeHash<T>,
    data: Vec<u8>
) -> DispatchResultWithPostInfo
[src]

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

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

NOTE: Calling this function will bypass origin filters.

impl<T: Trait> Module<T>[src]

Public APIs provided by the contracts module.

pub fn bare_call(
    origin: T::AccountId,
    dest: T::AccountId,
    value: BalanceOf<T>,
    gas_limit: Gas,
    input_data: Vec<u8>
) -> (ExecResult, Gas)
[src]

Perform a call to a specified contract.

This function is similar to Self::call, but doesn't perform any address lookups and better suitable for calling directly from Rust.

It returns the exection result and the amount of used weight.

pub fn get_storage(
    address: T::AccountId,
    key: [u8; 32]
) -> Result<Option<Vec<u8>>, ContractAccessError>
[src]

Query storage of a specified contract under a specified key.

pub fn rent_projection(
    address: T::AccountId
) -> Result<RentProjection<T::BlockNumber>, ContractAccessError>
[src]

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

pub fn current_schedule() -> Schedule[src]

Current cost schedule for contracts.

Trait Implementations

impl<T: Trait> Callable<T> for Module<T>[src]

type Call = Call<T>

impl<T: Clone + Trait> Clone for Module<T>[src]

impl<T: Copy + Trait> Copy for Module<T>[src]

impl<T: Trait> Debug for Module<T> where
    T: Debug
[src]

impl<T: Eq + Trait> Eq for Module<T>[src]

impl<T: Trait> IntegrityTest for Module<T>[src]

impl<T: Trait> ModuleErrorMetadata for Module<T>[src]

impl<T: Trait + Trait> OffchainWorker<<T as Trait>::BlockNumber> for Module<T>[src]

impl<T: Trait + Trait> OnFinalize<<T as Trait>::BlockNumber> for Module<T>[src]

impl<T: Trait + Trait> OnInitialize<<T as Trait>::BlockNumber> for Module<T>[src]

impl<T: Trait> OnRuntimeUpgrade for Module<T>[src]

impl<T: PartialEq + Trait> PartialEq<Module<T>> for Module<T>[src]

impl<T: Trait> StructuralEq for Module<T>[src]

impl<T: Trait> StructuralPartialEq for Module<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Module<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Module<T> where
    T: Send
[src]

impl<T> Sync for Module<T> where
    T: Sync
[src]

impl<T> Unpin for Module<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Module<T> where
    T: UnwindSafe
[src]

Blanket Implementations

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

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

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

impl<T> CheckedConversion for T[src]

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

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

impl<T> Instrument for T[src]

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

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

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

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

type Owned = T

The resulting type after obtaining ownership.

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<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

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