contracts: Refactor the runtime API in order to simplify node integration (#7409)

* contracts: Make use of existing type aliases for runtime API types

* contracts: Refactor the contracts call runtime API

* review: Fix comment typo

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* Update frame/contracts/common/src/lib.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* Update frame/contracts/common/src/lib.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* Update frame/contracts/common/src/lib.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* Update frame/contracts/common/src/lib.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* Update frame/contracts/common/src/lib.rs

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>

* Update lib.rs

* review: Group crate imports

Co-authored-by: Andrew Jones <ascjones@gmail.com>
Co-authored-by: Addie Wagenknecht <addie@nortd.com>
Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
Alexander Theißen
2020-10-29 15:57:56 +01:00
committed by GitHub
parent bd450c24ff
commit a5ec7e5c4e
14 changed files with 143 additions and 161 deletions
@@ -23,31 +23,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Codec, Decode, Encode};
use pallet_contracts_primitives::{GetStorageResult, RentProjectionResult};
use sp_runtime::RuntimeDebug;
use codec::Codec;
use sp_std::vec::Vec;
/// A result of execution of a contract.
#[derive(Eq, PartialEq, Encode, Decode, RuntimeDebug)]
pub enum ContractExecResult {
/// The contract returned successfully.
///
/// There is a status code and, optionally, some data returned by the contract.
Success {
/// Flags that the contract passed along on returning to alter its exit behaviour.
/// Described in `pallet_contracts::exec::ReturnFlags`.
flags: u32,
/// Output data returned by the contract.
///
/// Can be empty.
data: Vec<u8>,
/// How much gas was consumed by the call.
gas_consumed: u64,
},
/// The contract execution either trapped or returned an error.
Error,
}
use pallet_contracts_primitives::{ContractExecResult, GetStorageResult, RentProjectionResult};
sp_api::decl_runtime_apis! {
/// The API to interact with contracts without using executive.