Prosopo Protocol smart contract repository.
Created with ink!
and the official Substrate Contracts Workshop.
Follow the Substrate Develop a smart contract guide guide to install pre-requisites.
These are the steps for Ubuntu:
-
Install Substrate dependencies
-
Add Rust packages and dependencies
rustup default stable
rustup update
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
-
Setup a contracts compatible node. For example, install the Substrate Contracts Node.
Note: Use the --release
flag to minimise contract size if the contract is too large to put on-chain.
Build the contract from within the contracts/<contract_name>
folder.
cargo +nightly contract build
Run the tests using the following command from within the contracts/<contract_name>
folder.
cargo +nightly test --no-default-features --features std --verbose -- --nocapture
Install tarpaulin if you wish to see code coverage.
cargo install cargo-tarpaulin
Run with the following command to see code coverage metrics.
cargo +nightly tarpaulin --no-default-features --features std --verbose -- --nocapture
The contract can be deployed from the command line using cargo-contract
:
cargo contract instantiate $WASM --args "$ARGS_OWNER $ARGS_PROVIDER_STAKE_DEFAULT" --constructor $CONSTRUCTOR --suri $SURI --value $ENDOWMENT --url '$ENDPOINT:$PORT'
Example values for the variables are given below
ENDPOINT=ws://0.0.0.0
PORT=9944
SURI=//Alice
WASM=./target/ink/prosopo.wasm
CONSTRUCTOR=default
ARGS_OWNER=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice's account
ARGS_PROVIDER_STAKE_DEFAULT=2000000000000
ENDOWMENT=1000000000000