Companion to the PBA ink! Smart Contrcts smodule
- Have docker and docker-compose (
1.29.2
) - Have cargo-contract (
3.2.0
) installed:
cargo install cargo-contract --vers 3.2.0
Install polkadot{.js} extension.
Add these two accounts:
- Alice (bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice)
- Bob (bottom drive obey lake curtain smoke basket hold race lonely fit walk//Bob)
make devnode
To compile:
make compile
To deploy e.g. escrow
contract:
deploy escrow
Deployed contracts write their addresses to the addresses.json
file in the root directory. You can copy the address and use it in the https://contracts-ui.substrate.io/contract
To deploy a given command run on the Azero Testnet preceed it with the name of the environment:
AZERO_ENV=testnet make <command>
- Deploy the
old_a
contract:
AZERO_ENV=testnet make deploy-old-a
- Import and query it using the https://ui.use.ink/add-contract UI dashboard.
- Upgrade the contract:
AZERO_ENV=testnet make upgrade-a
- Query the state again
- Take a look at the
set_code
call in the old contract and try to understand it.
- what is the raw cross-contract call doing?
- what happens if it fails?
- why is it important to use the
ManualKey
in contracts storage here? - Could you achieve a similar upgrade without using
Lazy
?
https://faucet.test.azero.dev/
cargo contract call --url wss://ws.test.azero.dev --contract <address> --message get_values --suri "//Alice" --skip-confirm