Skip to content

Commit

Permalink
Update readme & version
Browse files Browse the repository at this point in the history
  • Loading branch information
yanganto committed Aug 5, 2021
1 parent a13e2b4 commit 84c2edb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
24 changes: 22 additions & 2 deletions README.md
Expand Up @@ -53,6 +53,20 @@ opt-level = "z"
[profile.release.package.hello-contract] # package name
incremental = false
opt-level = "z"

# Following section including the parameters to deploy the contract
[deploy]
url = "http://localhost:8545" # url for rpc node
private = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # private key
address = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # account address
# gas = 5000000 # optional
# gas_price = 1 # optional


# Following features helps are used when building or testing a contract
[features]
constructor = [] # required
constructor-test = [] # required
```
Place [.cargo/config](./examples/hello-contract/.cargo/config) file in your project to specify the flags for build.

Expand All @@ -62,7 +76,12 @@ Here is minimize example for writing a contract with sewup
use anyhow::Result;

use sewup::primitives::Contract;
use sewup_derive::{ewasm_fn, ewasm_fn_sig, ewasm_main, ewasm_test};
use sewup_derive::{ewasm_constructor, ewasm_fn, ewasm_fn_sig, ewasm_main, ewasm_test};

#[ewasm_constructor]
fn constructor() {
# do something you want when the contract deploy on chain
}

#[ewasm_fn]
fn hello() -> Result<String> {
Expand Down Expand Up @@ -95,7 +114,8 @@ mod tests {

### Testing
Run `cargo build --release --target=wasm32-unknown-unknown`, then the contract will build in `target/wasm32-unknown-unknown/release/*.wasm`
Besides, you can run deploy the ewasm contract on [WasmEdge](https://github.com/WasmEdge/WasmEdge) and run tests on it with `cargo test`.
Besides, you can run deploy the ewasm contract on [WasmEdge](https://github.com/WasmEdge/WasmEdge) and run tests on it with `cargo test`,
furthermore the constructor will also run when the contract deploying on [WasmEdge](https://github.com/WasmEdge/WasmEdge).

### Debugging
Furthermore, you can debug your ewasm contract with debug macro `sewup::ewasm_dbg!`, and run the contract with message output by `cargo test -- --nocapture`.
Expand Down
2 changes: 1 addition & 1 deletion cargo-sewup/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cargo-sewup"
version = "0.0.7"
version = "0.0.8"
edition = "2018"
description = "A cli tool build sewup project to a deploy wasm"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion sewup-derive/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sewup-derive"
version = "0.0.7"
version = "0.0.8"
authors = ["Antonio Yang <yanganto@gmail.com>"]
edition = "2018"
description = "Macros implementation for SewUp"
Expand Down
4 changes: 2 additions & 2 deletions sewup/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sewup"
version = "0.0.7"
version = "0.0.8"
authors = ["Antonio Yang <yanganto@gmail.com>"]
edition = "2018"
build="build.rs"
Expand All @@ -18,7 +18,7 @@ serde-value = "0.7.0"
toml = "0.5.8"
ewasm_api = { version = "0.11.0", default-features = false, features = ["std", "qimalloc"], package = "ss_ewasm_api" }
tiny-keccak = { version = "2.0.2", features = ["sha3", "keccak"] }
sewup-derive = { version = "0.0.7", path = "../sewup-derive" }
sewup-derive = { version = "0.0.8" }
bincode = "1.3"
cryptoxide = "0.3.3"

Expand Down

0 comments on commit 84c2edb

Please sign in to comment.