


Utility Token
with SewUp
Hackathon


Intro

SewUp
- Rust crate
- Open source at Github
- Utilize Ethereum WebAssembly
- Contract Dev as Backend (CDAB)
- Rusty api
- Learn more with previous slides



Token Feature
Token Feature


Let's SewUp

Your ERC-20 in 5min
- Copy the ERC-20 example of Sewup project
- Modify name, symbol, total_supply...
- Complete `sewup.toml`
- Deploy by `cargo sewup`
Your ERC-20 in 5min

Your ERC-20 in 5min

Just `cargo sewup`
You create a your own ERC-20 token



And More

Utility Token
Rules
- Admin can check the balance of any user
- Admin can charge the balance for any user
- User can check the remaining balance of heself
- User can spend some his balance to others
- Admin can reduce the balance of a user
Init project
- Install Rust
curl --proto '=https' --tlsv1.2 -sSf \ https://sh.rustup.rs | sh
- Install cargo sewup
cargo install cargo-sewup
- Initialize project
cargo sewup init
- Add kv feature
features = [ "token" ]
How to debug
- Use cargo test to validate you code
- If _compile_runtime_test fail,
run cargo build --target=wasm32-unknown-unknown - If _compile_constructor_test fail,
run cargo build --features=constructor --target=wasm32-unknown-unknown
Tips for development
Reuse API from ERC20
Objective
- Use mint to setup default tokens
- Reuse transfer, balance_of
- Setup test case
Balance_of Wrapper
Check out Commit 0919bae
Objective
- Reuse ERC-20 standard balance_of
- Add access control for balance_of
- Setup test case
Mint for admin
Objective
- Admin can mint for his self
- Admin can transfer to other user (Origin ERC-20)
- Admin can charge balance for other user
Reduce user balance
Objective
- Admin can reduce the balance of user
Well Done
Hack with SewUp





It's Your Turn

Refactor Caller Validation
Deploy & Test Rule 5


Summary

Blockchain bring TRUST to the world
Rust is the stem of TRUST
SewUp base on Rust and Ewasm helps you build great blockchain applications
Thanks for listening
Star the project if you like it
There are also help want issues and good first issues
Interested in VM?
WasmEdge is welcom to contribute
Q&A
Sewup sew your ethereum project up to the world
"8 - Sew up the sides" by LaMenta3 is licensed under CC BY-SA 2.0 Rust Engineer Antonio yanganto @ Github 2021/11/12 Hackthon @ OnAir Utility Token with SewUp Hackathon
Writing Ethereum WebAssembly in Rust III - Utility Token with SewUp
By Antonio Yang
Writing Ethereum WebAssembly in Rust III - Utility Token with SewUp
Secondstate EWasm Utility Program, a library to help you to write Ethereum WebAssmbly in Rust
- 1,077