Download, Compile, Store
Walking before we can run...
First, we need to download the code from cosmwasm-plus.

Download

Run the following to download the v0.6.2 tag and extract it. ls should show you the folder is present once it's unpacked. You can also use git instead of wget if you prefer.
1
git clone https://github.com/CosmWasm/cw-plus.git
2
3
git fetch --tags
4
5
git checkout v0.10.1
6
7
cd contracts/cw1-subkeys
Copied!

Compile

Unlike before, where we compiled just the one contract, we'll compile all of them, since we may want to experiment with others. Run this at the root of the cosmwasm-plus folder:
1
sudo docker run --rm -v "$(pwd)":/code \
2
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
3
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
4
cosmwasm/workspace-optimizer:0.11.3
Copied!

Store

When compiling is complete (it will take a while) cd into the artifacts directory. ls should show you binaries for each of the contracts have been created. The one we care about is cw1_subkeys.wasm.
To store this on-chain, we use a similar command to last time:
1
junod tx wasm store cw1_subkeys.wasm --from <your-key> --chain-id <chain-id> --gas auto
Copied!
Also like last time, look in the JSON output for the code_id value. If you would prefer to capture this as a shell variable, for the previous step you can instead do:
1
cd artifacts
2
TX=$(junod tx wasm store cw1_subkeys.wasm --from <your-key> --chain-id=<chain-id> --gas auto --output json -y | jq -r '.txhash')
3
CODE_ID=$(junod query tx $TX --output json | jq -r '.logs[0].events[-1].attributes[0].value')
Copied!
Last modified 4d ago
Copy link