You can query the current holdings of the Hydro address in the pool
like this:
First, let's reveal how many LP tokens user has (do not forget to replace $USER_ADDRESS with your address in this command).
Command Line:
neutrond q wasm cs smart neutron1yem82r0wf837lfkwvcu2zxlyds5qrzwkz8alvmg0apyrjthk64gqeq2e98 '{"pair":{}}' --node $NEUTRON_1 -o j | jq .data.liquidity_token | sed 's/\"//g' | xargs -I {} neutrond q bank balance $USER_ADDRESS {} --node $NEUTRON_1 -o j | jq .balance.amount | sed 's/\"//g'
LCD query:
https://rest-kralum.neutron-1.neutron.org/cosmos/bank/v1beta1/balances/{address}
Second, let's take the output above and query shares from pool
Command line:
neutrond q wasm cs smart neutron1yem82r0wf837lfkwvcu2zxlyds5qrzwkz8alvmg0apyrjthk64gqeq2e98 '{"share":{"amount":"$VALUE_FROM_ABOVE"}}' --node $NEUTRON_1 -o j | jq .data
LCD query:
QUERY_MSG = b'''{
"simulate_withdraw": {
"lp_amount": "1000"
}
}'''
https://rest-kralum.neutron-1.neutron.org)/cosmwasm/wasm/v1/contract/{CONTRACT_ADDRESS}/smart/{query_b64encoded}
Example output:
[
{
"info": {
"native_token": {
"denom": "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9"
}
},
"amount": "149"
},
{
"info": {
"native_token": {
"denom": "factory/neutron1k6hr0f83e7un2wjf29cspk7j69jrnskk65k3ek2nj9dztrlzpj6q00rtsa/udatom"
}
},
"amount": "97"
}
]
The total TVL can be obtained by querying:
Command line:
neutrond query wasm contract-state smart $CONTRACT_ADDRESS {"pool": {}}
LCD query:
QUERY_MSG = b'''{
"pool": {}
}'''
https://rest-kralum.neutron-1.neutron.org)/cosmwasm/wasm/v1/contract/{CONTRACT_ADDRESS}/smart/{query_b64encoded}
Example output:
{
"data": {
"assets": [
{
"info": {
"native_token": {
"denom": "factory/neutron1ffus553eet978k024lmssw0czsxwr97mggyv85lpcsdkft8v9ufsz3sa07/astro"
}
},
"amount": "1083"
},
{
"info": {
"native_token": {
"denom": "ibc/9598CDEB7C6DB7FC21E746C8E0250B30CD5154F39CA111A9D4948A4362F638BD"
}
},
"amount": "940"
}
],
"total_share": "1000"
}
}
[More explanation can also go here. For example:] To get the total assets owned by the Hydro address, query its balance for the xyz token by querying
… To get the ATOM value of one xyz token, query …
To enter the liquidity into the pool, issue a message:
{
"type": "osmosis/cl-create-position",
"value": {
"lower_tick": "50700",
"pool_id": "2371",
"sender": "osmo14fmxw54lgvheyn7m0p9efpr82fac68ysdnlg5z",
"token_min_amount0": "85000",
"token_min_amount1": "79915",
"tokens_provided": [
{
"amount": "94018",
"denom": "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2"
},
{
"amount": "100000",
"denom": "ibc/C1B4D4804EB8F95FFB75E6395A301F0AD6D7DDE5C3A45571B70E46A368DD353E"
}
],
"upper_tick": "83600"
}
}
lower_tick and upper_tick correspond to the lower and upper limit of the liquidity position.
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing