pub trait ContractAPI {
type T: Config;
// Required methods
fn map_account(
&mut self,
account: OriginFor<Self::T>,
) -> Result<(), DispatchError>;
fn deploy_contract(
&mut self,
contract_bytes: Vec<u8>,
value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
data: Vec<u8>,
salt: Option<[u8; 32]>,
origin: OriginFor<Self::T>,
gas_limit: Weight,
storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>,
) -> ContractResultInstantiate<Self::T>;
fn instantiate_contract(
&mut self,
code_hash: H256,
value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
data: Vec<u8>,
salt: Option<[u8; 32]>,
origin: OriginFor<Self::T>,
gas_limit: Weight,
storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>,
) -> ContractResultInstantiate<Self::T>;
fn upload_contract(
&mut self,
contract_bytes: Vec<u8>,
origin: OriginFor<Self::T>,
storage_deposit_limit: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
) -> CodeUploadResult<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>;
fn call_contract(
&mut self,
address: H160,
value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
data: Vec<u8>,
origin: OriginFor<Self::T>,
gas_limit: Weight,
storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>,
) -> ContractExecResultFor<Self::T>;
}
Expand description
Contract API used to interact with pallet-revive
.
Required Associated Types§
Required Methods§
Sourcefn map_account(
&mut self,
account: OriginFor<Self::T>,
) -> Result<(), DispatchError>
fn map_account( &mut self, account: OriginFor<Self::T>, ) -> Result<(), DispatchError>
Interface for bare_instantiate
contract call with a simultaneous upload.
§Arguments
contract_bytes
- The contract code.value
- The number of tokens to be transferred to the contract.data
- The input data to be passed to the contract (including constructor name).salt
- The salt to be used for contract address derivation.origin
- The sender of the contract call.gas_limit
- The gas limit for the contract call.storage_deposit_limit
- The storage deposit limit for the contract call.
Sourcefn deploy_contract(
&mut self,
contract_bytes: Vec<u8>,
value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
data: Vec<u8>,
salt: Option<[u8; 32]>,
origin: OriginFor<Self::T>,
gas_limit: Weight,
storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>,
) -> ContractResultInstantiate<Self::T>
fn deploy_contract( &mut self, contract_bytes: Vec<u8>, value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance, data: Vec<u8>, salt: Option<[u8; 32]>, origin: OriginFor<Self::T>, gas_limit: Weight, storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>, ) -> ContractResultInstantiate<Self::T>
Interface for bare_instantiate
contract call with a simultaneous upload.
§Arguments
contract_bytes
- The contract code.value
- The number of tokens to be transferred to the contract.data
- The input data to be passed to the contract (including constructor name).salt
- The salt to be used for contract address derivation.origin
- The sender of the contract call.gas_limit
- The gas limit for the contract call.storage_deposit_limit
- The storage deposit limit for the contract call.
Sourcefn instantiate_contract(
&mut self,
code_hash: H256,
value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
data: Vec<u8>,
salt: Option<[u8; 32]>,
origin: OriginFor<Self::T>,
gas_limit: Weight,
storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>,
) -> ContractResultInstantiate<Self::T>
fn instantiate_contract( &mut self, code_hash: H256, value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance, data: Vec<u8>, salt: Option<[u8; 32]>, origin: OriginFor<Self::T>, gas_limit: Weight, storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>, ) -> ContractResultInstantiate<Self::T>
Interface for bare_instantiate
contract call for a previously uploaded contract.
§Arguments
code_hash
- The code hash of the contract to instantiate.value
- The number of tokens to be transferred to the contract.data
- The input data to be passed to the contract (including constructor name).salt
- The salt to be used for contract address derivation.origin
- The sender of the contract call.gas_limit
- The gas limit for the contract call.storage_deposit_limit
- The storage deposit limit for the contract call.
Sourcefn upload_contract(
&mut self,
contract_bytes: Vec<u8>,
origin: OriginFor<Self::T>,
storage_deposit_limit: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
) -> CodeUploadResult<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>
fn upload_contract( &mut self, contract_bytes: Vec<u8>, origin: OriginFor<Self::T>, storage_deposit_limit: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance, ) -> CodeUploadResult<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>
Interface for bare_upload_code
contract call.
§Arguments
contract_bytes
- The contract code.origin
- The sender of the contract call.storage_deposit_limit
- The storage deposit limit for the contract call.
Sourcefn call_contract(
&mut self,
address: H160,
value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance,
data: Vec<u8>,
origin: OriginFor<Self::T>,
gas_limit: Weight,
storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>,
) -> ContractExecResultFor<Self::T>
fn call_contract( &mut self, address: H160, value: <<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance, data: Vec<u8>, origin: OriginFor<Self::T>, gas_limit: Weight, storage_deposit_limit: DepositLimit<<<Self::T as Config>::Currency as Inspect<AccountIdFor<Self::T>>>::Balance>, ) -> ContractExecResultFor<Self::T>
Interface for bare_call
contract call.
§Arguments
address
- The address of the contract to be called.value
- The number of tokens to be transferred to the contract.data
- The input data to be passed to the contract (including message name).origin
- The sender of the contract call.gas_limit
- The gas limit for the contract call.storage_deposit_limit
- The storage deposit limit for the contract call.