![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676320/Sew.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676339/ParaState.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676339/ParaState.png)
Utility Token
with SewUp
Hackathon
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8698512/1200px-WebAssembly_Logo_black.svg.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/7307209/flat_750x_075_f-pad_750x1000_f8f8f8.jpg)
Intro
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676320/Sew.jpg)
SewUp
- Rust crate
- Open source at Github
- Utilize Ethereum WebAssembly
- Contract Dev as Backend (CDAB)
- Rusty api
- Learn more with previous slides
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676469/Rustacean.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8698512/1200px-WebAssembly_Logo_black.svg.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/7307209/flat_750x_075_f-pad_750x1000_f8f8f8.jpg)
Token Feature
Token Feature
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8698512/1200px-WebAssembly_Logo_black.svg.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/7307209/flat_750x_075_f-pad_750x1000_f8f8f8.jpg)
Let's SewUp
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676320/Sew.jpg)
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
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/9082498/ERC20.png)
Your ERC-20 in 5min
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/9082576/sewup_toml.png)
Just `cargo sewup`
You create a your own ERC-20 token
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676469/Rustacean.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8698512/1200px-WebAssembly_Logo_black.svg.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/7307209/flat_750x_075_f-pad_750x1000_f8f8f8.jpg)
And More
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676320/Sew.jpg)
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
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676469/Rustacean.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/7811171/glass.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676469/Rustacean.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8698512/1200px-WebAssembly_Logo_black.svg.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/7307209/flat_750x_075_f-pad_750x1000_f8f8f8.jpg)
It's Your Turn
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676320/Sew.jpg)
Refactor Caller Validation
Deploy & Test Rule 5
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8698512/1200px-WebAssembly_Logo_black.svg.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/7307209/flat_750x_075_f-pad_750x1000_f8f8f8.jpg)
Summary
![](https://s3.amazonaws.com/media-p.slid.es/uploads/831034/images/8676320/Sew.jpg)
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
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
- 888