Skip to main content

Deploy and manage contracts

Deployment uses safrochaind tx wasm. Full flag lists live in wasm module.

Store code

safrochaind tx wasm store ./artifacts/my_contract.wasm \
--from deployer \
--chain-id safro-testnet-1 \
--node https://rpc.testnet.safrochain.com:443 \
--gas auto --gas-adjustment 1.3 \
--gas-prices 0.05usaf \
-y

Note upload fees (chain params). Query with safrochaind query wasm params.

Instantiate

CODE_ID=1
INIT='{"count":0}'

safrochaind tx wasm instantiate "$CODE_ID" "$INIT" \
--label "my-contract-v1" \
--admin addr_safro1admin... \
--from deployer \
--chain-id safro-testnet-1 \
--node https://rpc.testnet.safrochain.com:443 \
--gas auto --gas-adjustment 1.3 --gas-prices 0.05usaf \
-y

Use instantiate2 for predictable contract addresses (salt + code id).

Admin operations

CommandPurpose
set-contract-adminTransfer admin
clear-contract-adminMake immutable
migrateUpgrade contract logic

Chain IDs

NetworkChain ID
Testnetsafro-testnet-1
Mainnetsafrochain-1

Next