EWasm eth interface https://github.com/ewasm/design/blob/master/eth_interface.md
Glosarry:
- pwasm - Parity Wasm
- ewasm - Ethereum Wasm
Notable differences:
| // #![feature(log_syntax)] | |
| // #![feature(trace_macros)] | |
| // trace_macros!(true); | |
| #[derive(Debug, PartialEq, Eq)] | |
| pub struct FuncInstance; | |
| pub struct MemoryInstance; |
| struct Resolver; | |
| impl<'a> Data<'a> { | |
| fn resolver() -> Resolver { | |
| Resolver | |
| } | |
| } | |
| impl ImportResolver for Resolver { | |
| fn resolve_func(&self, name: &str, _signature: &FunctionType) -> FuncRef { | |
| if name == "add" { |
| #![feature(prelude_import)] | |
| #![no_std] | |
| // Copyright 2017 Parity Technologies (UK) Ltd. | |
| // This file is part of Polkadot. | |
| // Polkadot is free software: you can redistribute it and/or modify | |
| // it under the terms of the GNU General Public License as published by | |
| // the Free Software Foundation, either version 3 of the License, or | |
| // (at your option) any later version. |
| extern crate parity_wasm; | |
| use std::env; | |
| use std::fmt; | |
| use std::rc::Rc; | |
| use parity_wasm::elements::Module; | |
| use parity_wasm::interpreter::{ | |
| Error as InterpreterError, HostModule, HostModuleBuilder, | |
| ModuleInstance, UserError, HostState, StateKey}; |
| extern crate parity_wasm; | |
| use std::env; | |
| use std::fmt; | |
| use std::rc::Rc; | |
| use parity_wasm::elements::Module; | |
| use parity_wasm::interpreter::{Error as InterpreterError, HostModule, HostModuleBuilder, | |
| ModuleInstance, UserError}; | |
| #[derive(Debug)] |
| extern crate parity_wasm; | |
| use std::env; | |
| use std::fmt; | |
| use std::rc::Rc; | |
| use parity_wasm::elements::Module; | |
| use parity_wasm::interpreter::{Error as InterpreterError, HostModule, HostModuleBuilder, | |
| ModuleInstance, UserError}; | |
| #[derive(Debug)] |
| extern crate parity_wasm; | |
| use std::rc::Rc; | |
| use parity_wasm::elements::Module; | |
| use parity_wasm::interpreter::{ | |
| ModuleInstance, HostModule, HostModuleBuilder, Error | |
| }; | |
| mod tictactoe { | |
| use std::collections::HashMap; |
| ; ModuleID = 'suicidal0-c5be23406fd320ed2cb4254d08f783fa.rs' | |
| source_filename = "suicidal0-c5be23406fd320ed2cb4254d08f783fa.rs" | |
| target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128" | |
| target triple = "asmjs-unknown-emscripten" | |
| %str_slice = type { i8*, i32 } | |
| %"core::fmt::Write::write_fmt::Adapter<string::String>" = type { %"alloc::string::String"*, [0 x i8] } | |
| %"alloc::string::String" = type { %"alloc::vec::Vec<u8>", [0 x i8] } | |
| %"alloc::vec::Vec<u8>" = type { %"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>", [0 x i8], i32, [0 x i8] } | |
| %"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>" = type { %"core::ptr::Unique<u8>", [0 x i8], i32, [0 x i8], %"alloc::heap::Heap", [0 x i8] } |
| ; ModuleID = 'suicidal.cgu-0.rs' | |
| source_filename = "suicidal.cgu-0.rs" | |
| target datalayout = "e-p:32:32-i64:64-v128:32:128-n32-S128" | |
| target triple = "asmjs-unknown-emscripten" | |
| %str_slice = type { i8*, i32 } | |
| %"core::fmt::Write::write_fmt::Adapter<string::String>" = type { %"alloc::string::String"*, [0 x i8] } | |
| %"alloc::string::String" = type { %"alloc::vec::Vec<u8>", [0 x i8] } | |
| %"alloc::vec::Vec<u8>" = type { %"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>", [0 x i8], i32, [0 x i8] } | |
| %"alloc::raw_vec::RawVec<u8, alloc::heap::Heap>" = type { %"core::ptr::Unique<u8>", [0 x i8], i32, [0 x i8], %"alloc::heap::Heap", [0 x i8] } |
EWasm eth interface https://github.com/ewasm/design/blob/master/eth_interface.md
Glosarry:
Notable differences: