Introduce substrate contracts support.

This commit is contained in:
Sergey Pepyakin
2018-09-30 18:24:36 +01:00
parent 5238b41af2
commit 836ec93008
6 changed files with 87 additions and 43 deletions

View File

@ -9,10 +9,6 @@ extern crate parity_wasm;
extern crate byteorder;
#[macro_use] extern crate log;
pub static CREATE_SYMBOL: &'static str = "deploy";
pub static CALL_SYMBOL: &'static str = "call";
pub static RET_SYMBOL: &'static str = "ret";
pub mod rules;
mod build;
@ -32,6 +28,30 @@ pub use ext::{externalize, externalize_mem, underscore_funcs, ununderscore_funcs
pub use pack::{pack_instance, Error as PackingError};
pub use runtime_type::inject_runtime_type;
pub struct TargetRuntime {
pub create_symbol: &'static str,
pub call_symbol: &'static str,
pub return_symbol: &'static str,
}
impl TargetRuntime {
pub fn substrate() -> TargetRuntime {
TargetRuntime {
create_symbol: "deploy",
call_symbol: "call",
return_symbol: "ext_return",
}
}
pub fn pwasm() -> TargetRuntime {
TargetRuntime {
create_symbol: "deploy",
call_symbol: "call",
return_symbol: "ret",
}
}
}
#[cfg(not(feature = "std"))]
mod std {
pub use core::*;