-
Notifications
You must be signed in to change notification settings - Fork 6
Deploy Guide
Building and deploying for sewup projects is easier by cargo sewup cli tool, however you still can get the ewasm binary and deploy with web3js or other client. Also cargo sewup cli tool provide the abi.json generator, you can use web3js to interact with ERC token contracts made with sewup.
In following sections, I will describe that how sewup project deploy on the block chain network, this method is easier and the build will automatically done be fore deployment.
Following deploy configure should provide in sewup.toml
.
Besides, you may optionally change the gas
and the gas_price
as you need.
[deploy]
url = "http://localhost:8545"
private = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
address = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# gas = 5000000 # optional
# gas_price = 1 # optional
Install deploy tool
- Install cargo-sewup
cargo install cargo-sewup
- Provide deploy section in the
Cargo.toml
of the contract - Deploy
cargo sewup
- If you are using older version cargo-sewup and want to upgrade, please update by following command
cargo install cargo-sewup --force
cargo-sewup can build a deployable ewasm without deploy with --build-only
or -b
option .
The deployable ewasm will be built as ./target/wasm32-unknown-unknown/release/{contract_name}.deploy.wasm
You can read it as binary and deploy with tool you want.
Following is the building flow of deployable ewasm.
graph TD
A[cargo sewup --build-only] -->|compile| B(Constructor wasm)
A -->|compile| C(Runtime wasm)
B --> |modified| D(Constructor ewasm)
C --> |modified| E(Runtime ewasm)
D --> |as body part| F[deployable wasm]
E --> |as return part| F
It is not required to use sewup be complied with web3.js,
and the token apis of sewup are complied with web3.js.
You may use following command to generate the abi.json for web.js client.
cargo sewup -g
or cargo sewup --generate-abi
.
Following is the flow for generating the abi.json
graph TD
A[cargo sewup --generate-abi] -->|compile| B(Runtime wasm)
B --> |expand macro and parse handlers in use| C[generator.rs]
C --> |run and print| D[abi.json]