cycles-quartz/bisenzone-cw-mvp
2023-11-29 08:34:24 -08:00
..
.cargo Initial Commit 2023-11-14 07:30:48 -08:00
.github/workflows Fix CI (use newer rustc) 2023-11-15 14:46:48 -08:00
scripts Fix deploy script 2023-11-15 07:16:57 -08:00
src Fix tests 2023-11-15 14:35:54 -08:00
.gitignore Add arrtifacts/ to .gitignore 2023-11-14 16:16:58 -08:00
README.md Update README.md 2023-11-29 08:34:24 -08:00

Bisenzone CosmWasm MVP

CosmWasm smart contracts used in the Bisenzone MVP.

Testing instructions

  • Deploy the smart contract on a local wasmd instance (see Obligation Clearing Mvp: Local setup)
    • Should normally be as simple as running the following scripts ->
    # terminal-1
    ./scripts/keygen.sh
    ./scripts/init-node.sh
    ./scripts/run-node.sh
    
    # terminal-2
    ./scripts/build-contract.sh
    ./scripts/deploy-contract.sh artifacts/cw_mtcs.wasm
    
  • Set contract env var (using the output of the deploy.sh script) -
export CONTRACT="wasm13we0myxwzlpx8l5ark8elw5gj5d59dl6cjkzmt80c5q5cv5rt54qhmta7s"
  • Upload a cycle of obligations -
export EXECUTE='{
  "upload_obligation": {
    "creditor": "wasm19u72czh0w4jraan8esalv48nrwemh8kgax69yw",
    "amount": "100",
    "memo": "alice -> bob"
  }
}'
wasmd tx wasm execute "$CONTRACT" "$EXECUTE" --from alice --chain-id testing -y

export EXECUTE='{
  "upload_obligation": {
    "creditor": "wasm12r9t5wmre89rwakr0e5nyhfmaf4kdleyltsm9f",
    "amount": "80",
    "memo": "bob -> charlie"
  }
}'
wasmd tx wasm execute "$CONTRACT" "$EXECUTE" --from bob --chain-id testing -y

export EXECUTE='{
  "upload_obligation": {
    "creditor": "wasm19xlctyn7ha6pqg7pk9lnk8y60rk8646dm86qgv",
    "amount": "70",
    "memo": "charlie -> alice"
  }
}'
wasmd tx wasm execute "$CONTRACT" "$EXECUTE" --from charlie --chain-id testing -y
  • Clear cycle -
export EXECUTE='{
  "apply_cycle": {
    "path": ["wasm19xlctyn7ha6pqg7pk9lnk8y60rk8646dm86qgv", "wasm19u72czh0w4jraan8esalv48nrwemh8kgax69yw", "wasm12r9t5wmre89rwakr0e5nyhfmaf4kdleyltsm9f", "wasm19xlctyn7ha6pqg7pk9lnk8y60rk8646dm86qgv"],
    "amount": "70"
  }
}'
wasmd tx wasm execute "$CONTRACT" "$EXECUTE" --from alice --chain-id testing -y
  • Query obligations -
* wasmd query wasm contract-state smart "$CONTRACT" '{
  "get_obligations": {
    "creditor": "wasm19u72czh0w4jraan8esalv48nrwemh8kgax69yw"
  }
}'
  • Check balance of the solver (to confirm increase in karma) -
wasmd query wasm contract-state smart "$CONTRACT" '{
  "balance": {
    "address": "wasm19xlctyn7ha6pqg7pk9lnk8y60rk8646dm86qgv"
  }
}'