-
Patract’s mission is to accelerate the smart contract industry’s transition to Wasm technology stack.
-
Official Website: https://patract.io/
-
Documents Warehouse: https://docs.patract.io/en#
-
For the speaker's slides, please refer WASM Smart Contract with Patract Labs
-
For the speaker's transcript, please refer Transcript
Making sure you have cargo-contract setup: Please follow the guide on ink! to setup rust, cargo and cargo-contracts
Making sure you have
npx
installed
- Start your first Redspot Project using Redspot templates:
npx redspot-new erc20
remember to change the dependencies in
cargo.toml
to pull from crate.io, otherwise it will have compatible issues withpolkadot.js
ink_primitives = { version = "3.0.0-rc5", default-features = false }
ink_metadata = { version = "3.0.0-rc5", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "3.0.0-rc5", default-features = false }
ink_storage = { version = "3.0.0-rc5", default-features = false }
ink_lang = { version = "3.0.0-rc5", default-features = false }
- Download Europa-UI
Detailed release information can be found here Release v0.3.32. Currently, 3 operating systems are supportd:
- Windows 10 (21H1 and above)europa-ui-v0.3.32-x86_64-win.exe
- MacOS (10.15.7 and above)europa-ui-v0.3.32-x86_64-darwin.dmg
- Ubuntu (20.04 and above)europa-ui-v0.3.32-x86_64-linux.AppImage
For ubuntu, remember to give it permission
chmod +x europa-ui-v0.3.32-x86_64-linux.AppImage
- Start Europa-UI
-
Simply double click the icon to start it. Making sure the default port is not occupied.
-
Click start to start the node.
- Test Redspot + Europa using templated contract and config
npx redspot run scripts/deploy.ts
It will compile the contracts and update contract + metadata to Europa-UI. If the metadata does not get uploaded correctly, you can manual add that.
- open Europa-UI, you should be able to see the contract has been successfully deployed.
- you can use
back to Block
to revert the blockchain and remove the deployed test contract
-
Copy dependency in Cargo.toml and contract code in lib.rs into
erc20/contracts/Cargo.toml
anderc20/contracts/lib.rs
-
Build your contract with
cd contracts
cargo +nightly contract build --keep-debug-symbols --optimization-passes=0
then copy it to artifacts dir under erc20 directory
this will build the contract in debug mode and keeps all debug symbols.
mkdir ../artifacts
cp ./target/ink/erc20_pausable.contract ../artifacts/
cp ./target/ink/metadata.json ../artifacts/erc20_pausable.json
-
write the deployment script.
- copy the code from deploy.ts
npx redspot run scripts/deploy.ts --no-compile
- open Europa-UI to check if the contract has been successfully deployed
-
Writing tests:
- copy all the code from tests
npx redspot test ./tests/erc20_pausable_init.test.ts --no-compile
npx redspot test ./tests/erc20_pausable_ownable.test.ts --no-compile
npx redspot test ./tests/erc20_pausable_pause.test.ts --no-compile