๐นFrequently Used Messages
Transaction
Provide Liquidity / Withdraw
As the swap ratio is stated here, the size of a pool is related to its swap ratio. The ratio will get stable if the size of the pool increases, and vice versa. Otherwise, liquidity providers need more tokens to adjust the price in a bigger pool and it means that the market loses elasticity. The providers adjust their markets by providing and withdrawing liquidity within a trade-off.
Provide Liquidity
Contribute to the pool by sending a pair of tokens. The transaction increases the pool size.
Execute this message by the Pair contract address!
If you are trying to provide cw20 token, increase your allowance first. Execute IncreaseAllowance
Withdraw
Withdraw your tokens and decrease the size of the pool.
Execute the below message via the Liquidity token contract address! Not token contract, nor pair contract!
In send.msg
, you may decode this JSON string into base64 encoding.
As a result, the contract calculates the portion of your liquidity token compared to the total supply, and withdraws them.
Query
Pool
The pool query message returns the amount of the tokens in the pool from the given pair contract address.
Response:
ex) https://sentry.lcd.injective.network:443/cosmwasm/wasm/v1/contract/inj12gyq86zdaef9hafs6a6y24xqxgjyzh4m5a224tenlchj2ekgf5tsv94gwj/smart/eyJwb29sIjp7fX0=
Simulation / Reverse Simulation
Simulation works for guessing how much you will get by swapping with your token.
In case you want to know how much the target token will be given from the source token, use simulation
. Likewise, reverse_simulation
can let you derive the number of source token from the number of target token.
Simulation Request
Simulation Response
ex) https://sentry.lcd.injective.network:443/cosmwasm/wasm/v1/contract/inj12gyq86zdaef9hafs6a6y24xqxgjyzh4m5a224tenlchj2ekgf5tsv94gwj/smart/ewogICJzaW11bGF0aW9uIjogewogICAgIm9mZmVyX2Fzc2V0IjogewogICAgICAiYW1vdW50IjoiMTAwMDAwMCIsCiAgICAgICJpbmZvIjogewogICAgICAgICJuYXRpdmVfdG9rZW4iOiB7CiAgICAgICAgICAiZGVub20iOiJ1bHVuYSIKICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9Cn0=
Reverse Simulation Request
Reverse Simulation Response
ex) https://sentry.lcd.injective.network:443/cosmwasm/wasm/v1/contract/inj12gyq86zdaef9hafs6a6y24xqxgjyzh4m5a224tenlchj2ekgf5tsv94gwj/smart/ewogICJyZXZlcnNlX3NpbXVsYXRpb24iOnsKICAgICJhc2tfYXNzZXQiOiB7CiAgICAgICJhbW91bnQiOiIxMDAwMDAwIiwKICAgICAgImluZm8iOiB7CiAgICAgICAgIm5hdGl2ZV90b2tlbiI6IHsKICAgICAgICAgICJkZW5vbSI6ICJ1bHVuYSIKICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9Cn0=
Last updated