Manual queries against Perps contracts

You'll sometimes want to run queries or transactions directly against Perps contracts. You'll generally want to follow this process:

  1. Get the market contract address from the frontend-config endpoint for the relevant bots. You can see the different status URLs on the bot status pages list. Some common endpoints are:
  2. Open up the smart contract GUI
  3. Select the appropriate chain
  4. Connect your wallet
  5. Copy the appropriate contract address from the frontend-config page to the contract address field
  6. Select either "Execute message" to send a transaction or "Query message" to query the contract
  7. Enter the JSON content in message body (more on that below)
  8. Click "send transaction"

As you may the selections above within the smart contract GUI, the URL will update to a permalink that can be copy-pasted to keep the same configuration (chain, contract, message, etc.). This can be useful for sharing with others, and can be safely shared outside of Levana as well.

Common messages

Below are some examples of common messages you may want to use with market contracts.

Status query

The status endpoint provides lots of information on a market, such as config, liquidity, and long/short interest. Use the following message:

{"status":{}}

Sample URL for status query

Set price

This is generally only useful for QA purposes against the dragonqa contract. Other contracts use Pyth-based price updates instead.

{"set_price":{"price":"5.4","price_usd":"1.2"}}

Sample URL for setting price

price gives the price of the base asset in terms of the quote asset, and price_usd gives the price of the collateral asset in terms of USD.

Others

This page is intended to collect more samples of queries and execute messages that may be useful in the future. Ask someone on the engineering team to add more examples as needed. Also refer to the Cosmos CLI usage page.