Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cosmwasm): Enable CosmWasm #1007

Closed
jgimeno opened this issue Oct 18, 2022 · 3 comments · Fixed by #1044
Closed

feat(cosmwasm): Enable CosmWasm #1007

jgimeno opened this issue Oct 18, 2022 · 3 comments · Fixed by #1044
Assignees
Labels
x: wasm Relates to the wasm module or CosmWasm
Milestone

Comments

@jgimeno
Copy link
Contributor

jgimeno commented Oct 18, 2022

No description provided.

@jgimeno jgimeno added this to the Testnet V2 - NibiSwap + Wasm milestone Oct 18, 2022
@jgimeno jgimeno added the x: wasm Relates to the wasm module or CosmWasm label Oct 18, 2022
@testinginprod
Copy link
Collaborator

:O

@NibiruHeisenberg NibiruHeisenberg changed the title Enable CosmWasm feat: Enable CosmWasm Oct 18, 2022
@NibiruHeisenberg NibiruHeisenberg changed the title feat: Enable CosmWasm feat(cosmwasm): Enable CosmWasm Oct 18, 2022
@NibiruHeisenberg
Copy link
Contributor

NibiruHeisenberg commented Oct 31, 2022

10/31: @onikonychev will wire in CosmWasm

Docs: https://docs.cosmwasm.com/docs/1.0/

@onikonychev
Copy link
Contributor

onikonychev commented Nov 2, 2022

Exersizes with Nibiru CosmWasm

Test contract I used is: https://docs.cosmwasm.com/docs/1.0/getting-started/interact-with-contract

RES=$(nibid tx wasm store cw_nameservice.wasm --from validator --gas 3000000 --gas-adjustment 1.3 -y -b block)

CODE_ID=$(echo $RES | jq -r '.logs[0].events[-1].attributes[0].value')
echo $CODE_ID
1

INIT='{"purchase_price":{"amount":"100","denom":"unibi"},"transfer_price":{"amount":"999","denom":"unibi"}}'
nibid tx wasm instantiate $CODE_ID "$INIT" --from validator --label "name service" -y --no-admin | jq


CONTRACT=$(nibid query wasm list-contract-by-code $CODE_ID --output json | jq -r '.contracts[-1]')
echo $CONTRACT
nibi14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssa9gcs


nibid query wasm contract $CONTRACT | jq
{
  "address": "nibi14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9ssa9gcs",
  "contract_info": {
    "code_id": "1",
    "creator": "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl",
    "admin": "",
    "label": "name service",
    "created": null,
    "ibc_port_id": "",
    "extension": null
  }
}


nibid query bank balances $CONTRACT | jq
{
  "balances": [],
  "pagination": {
    "next_key": null,
    "total": "0"
  }
}

nibid query wasm contract-state all $CONTRACT | jq
{
  "models": [
    {
      "key": "636F6E666967",
      "value": "eyJwdXJjaGFzZV9wcmljZSI6eyJkZW5vbSI6InVuaWJpIiwiYW1vdW50IjoiMTAwIn0sInRyYW5zZmVyX3ByaWNlIjp7ImRlbm9tIjoidW5pYmkiLCJhbW91bnQiOiI5OTkifX0="
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "0"
  }
}


CONFIG_QUERY='{"config": {}}'
nibid query wasm contract-state smart $CONTRACT "$CONFIG_QUERY"
{"data":{"purchase_price":{"denom":"unibi","amount":"100"},"transfer_price":{"denom":"unibi","amount":"999"}}}


REGISTER='{"register":{"name":"fred"}}'
nibid tx wasm execute $CONTRACT "$REGISTER" --amount 100unibi --from validator --gas 3000000 --gas-adjustment 1.3 -y -b block | jq

NAME_QUERY='{"resolve_record": {"name": "fred"}}'

nibid query wasm contract-state smart $CONTRACT "$NAME_QUERY"
{"data":{"address":"nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl"}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x: wasm Relates to the wasm module or CosmWasm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants