Skip to content

Commit be14265

Browse files
docs: docs for cosmwasm native module queries and msgs (#2076)
* add docs for cosmwasm * fix: fix the lint issue * add example smart contract repo * lint * docs --------- Co-authored-by: Robert Zaremba <robert@zaremba.ch>
1 parent b0bc405 commit be14265

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

app/app.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,8 @@ func New(
649649

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

654655
// Register umee custom plugin to wasm
655656
wasmOpts = append(uwasm.RegisterCustomPlugins(app.LeverageKeeper, app.OracleKeeper), wasmOpts...)

docs/cosmwasm.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Cosmwasm
2+
3+
## Example smart contract to interact with umee native modules (leverage and oracle)
4+
5+
- [umee-cosmwasm](https://github.com/umee-network/umee-cosmwasm)
6+
7+
## Cosmwasm Built-in capabilities
8+
9+
- [Built-in capabilities](https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md) - iterator, staking, stargate, cosmwasm_1_1, cosmwasm_1_2
10+
- Custom capability of umee chain: `umee`
11+
12+
## Allowed native module queries
13+
14+
Queries for all native Umee modules:
15+
16+
- [ugov](https://github.com/umee-network/umee/blob/main/proto/umee/ugov/v1/query.proto)
17+
- [leverage](https://github.com/umee-network/umee/blob/main/proto/umee/leverage/v1/query.proto)
18+
- [oracle](https://github.com/umee-network/umee/blob/main/proto/umee/oracle/v1/query.proto)
19+
- [uibc](https://github.com/umee-network/umee/blob/main/proto/umee/uibc/v1/quota.proto)
20+
21+
```json
22+
{
23+
"chain": {
24+
"custom": {
25+
"leverage_parameters": {}
26+
}
27+
}
28+
}
29+
```
30+
31+
Example command to execute a query:
32+
33+
```bash
34+
$ umeed q wasm contract-state smart ${json_input}
35+
$ umeed q wasm contract-state smart umee14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9scsdqqx '{"chain":{"custom":{"leverage_params":{}}}}'
36+
```
37+
38+
## Allowed native module transactions
39+
40+
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:
41+
42+
```json
43+
{
44+
"umee": {
45+
"leverage": {
46+
"supply": {
47+
"supplier": "",
48+
"asset": {
49+
"denom": "uumee",
50+
"amount": "123123123"
51+
}
52+
}
53+
}
54+
}
55+
}
56+
```
57+
58+
Example commands to execute a transaction:
59+
60+
```bash
61+
$ umeed tx wasm execute ${contract_id} ${json_input}
62+
$ umeed tx wasm execute umee14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9scsdqqx '{"umee":{"leverage":{"supply_collateral":{"supplier":"umee1s84d29zk3k20xk9f0hvczkax90l9t94g72n6wm","asset":{"denom":"uumee","amount":"1234"}}}}}'
63+
```

0 commit comments

Comments
 (0)