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

docs: docs for cosmwasm native module queries and msgs #2076

Merged
merged 5 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ func New(

// The last arguments can contain custom message handlers, and custom query handlers,
// if we want to allow any custom callbacks
availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1,umee"
// default available capabilities https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md
availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,umee"

// Register umee custom plugin to wasm
wasmOpts = append(uwasm.RegisterCustomPlugins(app.LeverageKeeper, app.OracleKeeper), wasmOpts...)
Expand Down
63 changes: 63 additions & 0 deletions docs/cosmwasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Cosmwasm

## Example smart contract to interact with umee native modules (leverage and oracle)

- [umee-cosmwasm](https://github.com/umee-network/umee-cosmwasm)

## Cosmwasm Built-in capabilities

- [Built-in capabilities](https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md) - iterator, staking, stargate, cosmwasm_1_1, cosmwasm_1_2
- Custom capability of umee chain: `umee`

## Allowed native module queries

Queries for all native Umee modules:

- [ugov](https://github.com/umee-network/umee/blob/main/proto/umee/ugov/v1/query.proto)
- [leverage](https://github.com/umee-network/umee/blob/main/proto/umee/leverage/v1/query.proto)
- [oracle](https://github.com/umee-network/umee/blob/main/proto/umee/oracle/v1/query.proto)
- [uibc](https://github.com/umee-network/umee/blob/main/proto/umee/uibc/v1/quota.proto)

```json
{
"chain": {
"custom": {
"leverage_parameters": {}
}
}
}
```

Example command to execute a query:

```bash
$ umeed q wasm contract-state smart ${json_input}
$ umeed q wasm contract-state smart umee14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9scsdqqx '{"chain":{"custom":{"leverage_params":{}}}}'
```

## Allowed native module transactions

Only [leverage module transactions](https://github.com/umee-network/umee/blob/main/proto/umee/leverage/v1/tx.proto) are allowed. Example JSON input for Umee native module:

```json
{
"umee": {
"leverage": {
"supply": {
"supplier": "",
"asset": {
"denom": "uumee",
"amount": "123123123"
}
}
}
}
}
```

Example commands to execute a transaction:

```bash
$ umeed tx wasm execute ${contract_id} ${json_input}
$ umeed tx wasm execute umee14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9scsdqqx '{"umee":{"leverage":{"supply_collateral":{"supplier":"umee1s84d29zk3k20xk9f0hvczkax90l9t94g72n6wm","asset":{"denom":"uumee","amount":"1234"}}}}}'
```