[−][src]Struct pallet_contracts::Module
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]
origin: <T as Trait>::Origin,
schedule: Schedule
) -> DispatchResult
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]
origin: <T as Trait>::Origin,
dest: <T::Lookup as StaticLookup>::Source,
value: BalanceOf<T>,
gas_limit: Gas,
data: Vec<u8>
) -> DispatchResultWithPostInfo
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]
origin: <T as Trait>::Origin,
endowment: BalanceOf<T>,
gas_limit: Gas,
code_hash: CodeHash<T>,
data: Vec<u8>
) -> DispatchResultWithPostInfo
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 thecode
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]
origin: T::AccountId,
dest: T::AccountId,
value: BalanceOf<T>,
gas_limit: Gas,
input_data: Vec<u8>
) -> (ExecResult, Gas)
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]
address: T::AccountId,
key: [u8; 32]
) -> Result<Option<Vec<u8>>, ContractAccessError>
Query storage of a specified contract under a specified key.
pub fn rent_projection(
address: T::AccountId
) -> Result<RentProjection<T::BlockNumber>, ContractAccessError>
[src]
address: T::AccountId
) -> Result<RentProjection<T::BlockNumber>, ContractAccessError>
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]
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]
T: Debug,
impl<T: Eq + Trait> Eq for Module<T>
[src]
impl<T: Trait> IntegrityTest for Module<T>
[src]
pub fn integrity_test()
[src]
impl<T: Trait> ModuleErrorMetadata for Module<T>
[src]
pub fn metadata() -> &'static [ErrorMetadata]
[src]
impl<T: Trait + Trait> OffchainWorker<<T as Trait>::BlockNumber> for Module<T>
[src]
pub fn offchain_worker(_n: BlockNumber)
[src]
impl<T: Trait + Trait> OnFinalize<<T as Trait>::BlockNumber> for Module<T>
[src]
pub fn on_finalize(_n: BlockNumber)
[src]
impl<T: Trait + Trait> OnInitialize<<T as Trait>::BlockNumber> for Module<T>
[src]
pub fn on_initialize(_n: BlockNumber) -> u64
[src]
impl<T: Trait> OnRuntimeUpgrade for Module<T>
[src]
pub fn on_runtime_upgrade() -> u64
[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]
T: RefUnwindSafe,
impl<T> Send for Module<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Module<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Module<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Module<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
pub fn from_ref(t: &T) -> &T
[src]
pub fn into_ref(&self) -> &T
[src]
pub fn from_mut(t: &mut T) -> &mut T
[src]
pub fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
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,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
[src]
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,