Trait noble_contracts::chain_extension::Ext [−][src]
An interface that provides access to the external environment in which the smart-contract is executed.
This interface is specialized to an account of the executing code, so all operations are implicitly performed on that account.
Associated Types
Loading content...Required methods
fn get_storage(&self, key: &[u8; 32]) -> Option<Vec<u8>>
[src]
Returns the storage entry of the executing account by the given key
.
Returns None
if the key
wasn’t previously set by set_storage
or
was deleted.
fn set_storage(
&mut self,
key: [u8; 32],
value: Option<Vec<u8>>
) -> DispatchResult
[src]
&mut self,
key: [u8; 32],
value: Option<Vec<u8>>
) -> DispatchResult
Sets the storage entry by the given key to the specified value. If value
is None
then
the storage entry is deleted.
fn instantiate(
&mut self,
code: &CodeHash<Self::T>,
value: BalanceOf<Self::T>,
gas_meter: &mut GasMeter<Self::T>,
input_data: Vec<u8>,
salt: &[u8]
) -> Result<(<Self::T as Config>::AccountId, ExecReturnValue), ExecError>
[src]
&mut self,
code: &CodeHash<Self::T>,
value: BalanceOf<Self::T>,
gas_meter: &mut GasMeter<Self::T>,
input_data: Vec<u8>,
salt: &[u8]
) -> Result<(<Self::T as Config>::AccountId, ExecReturnValue), ExecError>
Instantiate a contract from the given code.
The newly created account will be associated with code
. value
specifies the amount of value
transferred from this to the newly created account (also known as endowment).
fn transfer(
&mut self,
to: &<Self::T as Config>::AccountId,
value: BalanceOf<Self::T>
) -> DispatchResult
[src]
&mut self,
to: &<Self::T as Config>::AccountId,
value: BalanceOf<Self::T>
) -> DispatchResult
Transfer some amount of funds into the specified account.
fn terminate(
&mut self,
beneficiary: &<Self::T as Config>::AccountId
) -> DispatchResult
[src]
&mut self,
beneficiary: &<Self::T as Config>::AccountId
) -> DispatchResult
Transfer all funds to beneficiary
and delete the contract.
Since this function removes the self contract eagerly, if succeeded, no further actions should
be performed on this Ext
instance.
This function will fail if the same contract is present on the contract call stack.
fn call(
&mut self,
to: &<Self::T as Config>::AccountId,
value: BalanceOf<Self::T>,
gas_meter: &mut GasMeter<Self::T>,
input_data: Vec<u8>
) -> ExecResult
[src]
&mut self,
to: &<Self::T as Config>::AccountId,
value: BalanceOf<Self::T>,
gas_meter: &mut GasMeter<Self::T>,
input_data: Vec<u8>
) -> ExecResult
Call (possibly transferring some amount of funds) into the specified account.
fn restore_to(
&mut self,
dest: <Self::T as Config>::AccountId,
code_hash: CodeHash<Self::T>,
rent_allowance: BalanceOf<Self::T>,
delta: Vec<[u8; 32]>
) -> DispatchResult
[src]
&mut self,
dest: <Self::T as Config>::AccountId,
code_hash: CodeHash<Self::T>,
rent_allowance: BalanceOf<Self::T>,
delta: Vec<[u8; 32]>
) -> DispatchResult
Restores the given destination contract sacrificing the current one.
Since this function removes the self contract eagerly, if succeeded, no further actions should
be performed on this Ext
instance.
This function will fail if the same contract is present on the contract call stack.
fn caller(&self) -> &<Self::T as Config>::AccountId
[src]
Returns a reference to the account id of the caller.
fn address(&self) -> &<Self::T as Config>::AccountId
[src]
Returns a reference to the account id of the current contract.
fn balance(&self) -> BalanceOf<Self::T>
[src]
Returns the balance of the current contract.
The value_transferred
is already added.
fn value_transferred(&self) -> BalanceOf<Self::T>
[src]
Returns the value transferred along with this call or as endowment.
fn now(&self) -> &<<Self::T as Config>::Time as Time>::Moment
[src]
Returns a reference to the timestamp of the current block
fn minimum_balance(&self) -> BalanceOf<Self::T>
[src]
Returns the minimum balance that is required for creating an account.
fn tombstone_deposit(&self) -> BalanceOf<Self::T>
[src]
Returns the deposit required to create a tombstone upon contract eviction.
fn random(&self, subject: &[u8]) -> <Self::T as Config>::Hash
[src]
Returns a random number for the current block with the given subject.
fn deposit_event(
&mut self,
topics: Vec<<Self::T as Config>::Hash>,
data: Vec<u8>
)
[src]
&mut self,
topics: Vec<<Self::T as Config>::Hash>,
data: Vec<u8>
)
Deposit an event with the given topics.
There should not be any duplicates in topics
.
fn set_rent_allowance(&mut self, rent_allowance: BalanceOf<Self::T>)
[src]
Set rent allowance of the contract
fn rent_allowance(&self) -> BalanceOf<Self::T>
[src]
Rent allowance of the contract
fn block_number(&self) -> <Self::T as Config>::BlockNumber
[src]
Returns the current block number.
fn max_value_size(&self) -> u32
[src]
Returns the maximum allowed size of a storage item.
fn get_weight_price(&self, weight: Weight) -> BalanceOf<Self::T>
[src]
Returns the price for the specified amount of weight.