An upgradable wrapper around the Polymesh Runtime API.
This allows contracts to use a stable API that can be updated to support each major Polymesh release.
Build the wrapped API contract.
Install cargo-contract
.
cargo install cargo-contract --force
Build the contract:
cargo contract build --release
Contract file needed for upload ./target/ink/polymesh_ink.contract
.
Example contract that uses the Polymesh Ink! API
Cargo.toml:
[]
= "example_contract"
= "1.0.0"
= ["<author>"]
= "2021"
= false
[]
= { = "4.3", = false }
= { = "parity-scale-codec", = "3", = false, = ["derive"] }
= { = "2", = false, = ["derive"], = true }
= { = "3.0", = false, = ["as-library"] }
[]
= "lib.rs"
[]
= ["std"]
= [
"ink/std",
"scale/std",
"scale-info/std",
"polymesh-ink/std",
]
= []
lib.rs:
//! Example contract for upgradable `polymesh-ink` API.
extern crate alloc;
use *;
Setup.
- Build and upload (don't deploy) the wrapped API contract
./target/ink/polymesh_ink.contract
. - Build and deploy an example contract from
./examples/
.
Usable
The update_polymesh_ink
calls can be used to update the code hash for the Polymesh Ink! API.