This a CosmWasm smart contract that provides payment distribution for provenance
markers
.
make
git clone git@github.com:provenance-io/provenance.git
git clone git@github.com:provenance-io/payment-distribution-contracts.git
cp payment-distribution-contracts/examples/payment-dist.sh payment-distribution-contracts/examples/create-base.sh provenance
cd payment-distribution-contracts
make
cp artifacts/payment-distribution-contracts.wasm ../provenance
cd ../provenance
./create-base.sh
./payment-dist.sh
NOTE: Address bech32 values and other generated params may vary.
-
Configure the following:
- Accounts:
- Asker
- Buyer
- Markers:
- Base
- Quote
- Accounts:
-
Store the
payment-distribution-contracts
WASM:build/provenanced tx wasm store payment-distribution-contracts.wasm \ --from validator \ --keyring-backend test \ --home build/run/provenanced \ --chain-id testing \ --gas auto --gas-prices 1905nhash --gas-adjustment 2 \ --broadcast-mode block \ --yes \ --testnet
-
Instantiate the contract, binding the name
payment-dist.sc.pb
to the contract address:build/provenanced tx wasm instantiate 1 '{"bind_name":"payment-dist.sc","contract_name":"payment-dist"}' \ --admin "$(build/provenanced keys show -ta validator --home build/run/provenanced --keyring-backend test)" \ --from validator \ --keyring-backend test \ --home build/run/provenanced \ --chain-id testing \ --label ats-gme-usd \ --gas auto --gas-prices 1905nhash --gas-adjustment 2 \ --broadcast-mode block \ --yes \ --testnet
-
Create an
ask
order:NOTE: Replace
M2
with theask
base marker. ReplaceM1_AMT
andM1_DENOM
with quote markerNOTE++: The json data '{"create_ask":{}}' represents the action and additional data to pass into the smart contract. The actual coin with the transaction is the
--amount
option.build/provenanced tx wasm execute "$(provenanced q name resolve payment-dist.sc --testnet | awk '{print $2}')" \ '{"create_ask":{"id":"ask_id", "quote":[{"amount":"M1_AMT", "denom":"M1_DENOM"}]}}' \ --amount M2 \ --from (build/provenanced keys show -ta seller --home build/run/provenanced --keyring-backend test) \ --keyring-backend test \ --home build/run/provenanced \ --chain-id testing \ --gas auto --gas-prices 1905nhash --gas-adjustment 2 \ --broadcast-mode block \ --yes \ --testnet
-
Create a
bid
order:NOTE: Replace
M1
with thebid
quote marker. ReplaceM2_AMT
andM2_DENOM
with base markerNOTE++: The json data '{"create_bid":{}}' represents the action and additional data to pass into the smart contract. The actual coin with the transaction is the
--amount
option.build/provenanced tx wasm execute "$(provenanced q name resolve payment-dist.sc --testnet | awk '{print $2}')" \ '{"create_bid":{"id":"bid_id", "base":[{"amount":"M2_AMT", "denom":"M2_DENOM"}]}}' \ --amount M1 \ --from (build/provenanced keys show -ta buyer --home build/run/provenanced --keyring-backend test) \ --keyring-backend test \ --home build/run/provenanced \ --chain-id testing \ --gas auto --gas-prices 1905nhash --gas-adjustment 2 \ --broadcast-mode block \ --yes \ --testnet
-
Match and execute the ask and bid orders.
build/provenanced tx wasm execute "$(provenanced q name resolve payment-dist.sc --testnet | awk '{print $2}')" \ '{"execute_match":{"ask_id":"ask_id", "bid_id":"bid_id"}}' \ --from validator \ --keyring-backend test \ --home build/run/provenanced \ --chain-id testing \ --gas auto --gas-prices 1905nhash --gas-adjustment 2 \ --broadcast-mode block \ --yes \ --testnet
Cancel the contract.
build/provenanced tx wasm execute "$(provenanced q name resolve payment-dist.sc --testnet | awk '{print $2}')" \
'{"cancel_ask":{"id":"ask_id"}}' \
--from (build/provenanced keys show -ta seller --home build/run/provenanced --keyring-backend test) \
--keyring-backend test \
--home build/run/provenanced \
--chain-id testing \
--gas auto --gas-prices 1905nhash --gas-adjustment 2 \
--broadcast-mode block \
--yes \
--testnet
Query for ask order information:
provenanced query wasm contract-state smart "$(provenanced q name resolve payment-dist.sc --testnet | awk '{print $2}')" \
'{"get_ask":{"id":"ask_id"}}' \
--testnet
Query for bid order information:
provenanced query wasm contract-state smart "$(provenanced q name resolve payment-dist.sc --testnet | awk '{print $2}')" \
'{"get_bid":{"id":"bid_id"}}' \
--testnet
Query for contract instance information
provenanced query wasm contract-state smart "$(provenanced q name resolve payment-dist.sc --testnet | awk '{print $2}')" \
'{"get_contract_info":{}}' \
--testnet