Hackathon
EVM
API
API
API
Web2 Server
Web3 Blockchain
Executor
.rs
Result
Option
operate on Bytes32
Executor
.rs
pub enum CallResult { Successful, Failure, Revert, Unknown, }
pub enum CallError { Failure, Revert, Unknown, }
fn call() -> CallResult;
fn call() -> Result<(), CallError>;
Please read things behind the wordings!
Web 2 | Web 3 | |
---|---|---|
Business level | Web application | Blockchain application |
Handler level | Rocket | SewUp |
Byte level |
hyper | ewasm-rust-api |
Rust
Contract Dev as Backend
ewasm-rust-api
Result
Option
Error
like handle KV db, RDB
.rs
Web3 Blockchain
match your function
Like develop traditional web
Rust style result
structure
bytes
string
store without touching Bytes32
Initialized project - cargo sewup init
.
├── .cargo
│ └── config.rs
├── Cargo.toml
├── sewup.toml
└── src
└── lib.rs
Set up Rust flags fro wasm
Deploy information
(git ignored)
Write the contract as library
Constructor
Handlers
Main function
(entry point)
Tests
Auto generate HELLO_SIG
will be HELLO_SIG
Learn more from Rust doc
Learn more from Rust doc
use sewup::primitives::EwasmAny
use auto mode for ewasm_main
Learn more from Rust doc
Create WasmEdge runtime,
Add _compile_runtime_test,
Add _compile_contract_test
Run test in WasmEdge runtim
Learn more from Rust doc
assert on output
assert on vec![] (no error)
assert on the unwrapped output
assert on Ok(())
The message you debug on
The message you debug on
Caller Address
Flag section preserved not used currently
There are also help want issues and good first issues