Valantis Documentation
Valantis Website
  • Welcome to Valantis
  • Sovereign Pool
    • The Modules
      • Pool Manager
      • Liquidity Module
      • Swap Fee Module
      • Verifier Module
      • Oracle Module
      • Sovereign Vault
        • Rebase token support
      • Gauge
    • Interacting with Pools
      • Swap Parameters
      • Swap Steps
      • Multi Token Support
      • Deposit Liquidity
      • Withdraw Liquidity
      • Flash Loans
  • Hybrid Order Type (HOT)
    • Understanding HOT: A Graphical Overview
    • HOT API
      • HTTP request parameters
      • HTTP request response
      • Reasoning for Request structure
      • Solver Integration
      • Market Maker integration
    • HOT Smart Contracts
      • Interfaces
      • State variables and roles
      • AMM
      • HOT Swap
      • AMM Swap
      • Hybrid Order Type (HOT) struct parameters
      • Alternating Nonce Bitmap
      • Deposits
      • Withdrawals
      • Deployment Assumptions
    • Liquidity Manager Docs
      • Reference Oracle
      • Deposit
      • Withdraw
      • Signature
    • Swap
      • Swap Context
      • AMM Swap
      • HOT Swap
      • HOT Quote Parameters
        • Bitmap Nonce Instructions
    • Solver Docs
      • Solver Request
      • Simple HOT Swap Example
      • Partial Fill HOT Swap Example
    • Risks and Trust Assumptions
      • Roles
        • Sovereign Pool Manager
        • HOT Manager
        • HOT Signer
        • Liquidity Provider
      • Threats
        • Deposit Sandwich
        • Malicious Price Bound
        • Malicious Signer
        • Mispriced HOT Quote
  • Validly
    • Understanding Validly
    • Swap
    • Deposits and Withdrawals
    • Deployments
  • Stake Exchange (stHYPE AMM)
    • Swap
      • Instant Withdrawals (LST -> Native Token)
      • New Stake (Native Token -> LST)
    • LP Positions
      • LP Withdrawals Instant
      • LP Withdrawal Queued
    • Ratio Fee
    • Lending of Reserves
    • Smart contracts
      • STEXAMM.sol
      • StHYPEWithdrawalModule.sol
      • StexRatioSwapFeeModule.sol
      • DepositWrapper.sol
      • AaveLendingModule.sol
    • Risks and Trust Assumptions
    • Integration examples
  • Deploy and Build
  • Resources
    • Audits
    • Links
    • Get HYPE on HyperEVM
Powered by GitBook
On this page
  • HOT Request
  • Example

Was this helpful?

  1. Hybrid Order Type (HOT)
  2. Solver Docs

Solver Request

PreviousSolver DocsNextSimple HOT Swap Example

Last updated 10 months ago

Was this helpful?

HOT Request

Solvers send a request through the .

A Solver's request is structured such that it is meant to ask for a replacement for an existing route or source of liquidity.

{
  "authorized_recipient": "string",
  "authorized_sender": "string",
  "chain_id": 0,
  "token_in": "string",
  "token_out": "string",
  "expected_gas_price": "30",
  "expected_gas_units": "200000",
  "amount_in": "string",
  "amount_out_requested": "string",
  "request_expiry": 0,
  "quote_expiry": 0
}

Example

A solver is trying to replace a USDC -> WETH swap in their original path with a Valantis HOT quote.

  • amount_in is a fixed value of 1000 USDC. This is the amount that the solver wants to swap.

  • The current price of the Uniswap V3 pool is 3000, so the expected WETH from the UniV3 pool is 0.33 WETH.

  • ( This step is optional ) The gas cost of the UniV3 swap is 200,000 gas units. And the estimated gas price is 30 gwei. In case the solver wants to skip these calculations, they can just leave the gas fields empty.

  • The swap is on mainnet, and the solver is confident they can execute it in the next 2 blocks.

Solver Request

  • amount_in = 1000e6 ( token decimals of USDC is 6 )

  • amount_out_requested = 0.33e18 ( token decimals of WETH is 18 )

  • expected_gas_price = "30" gwei

  • expected_gas_units = "200000"

  • quote_expiry = block.timestamp + 24 ( in seconds )

Liquidity Manager ( Signer )

The Liquidity Manager has to calculate 3 important price fields to return a signed quote.

  1. sqrtSpotPriceX96New: This is the liquidity manager's view of the true spot price of the pair. When the HOT quote lands, the AMM spot price will be updated to this value.

  2. sqrtHotPriceX96Discounted: This is the discounted price given to solvers who cause the AMM spot price update. To get the discounted price, the swap needs to fulfil 2 important conditions: - The AMM spot price should not have been updated in the current block.

    - The spot price in the quote should be more current than the previous HOT quote. recorded on chain.

  3. sqrtHotPriceX96Base: This is the base price that a non-discounted HOT quote gets.

Note: To promise complete determinism, liquidity managers can set the base HOT price equal to the discounted HOT price.

The liquidity manager ensures that the sqrtHotPriceX96Discounted is always equal to or better than the price that the solver requested using amount_in and amount_out_requested. Gas compensation If the liquidity manager estimates that swapping through the HOT Pool costs more gas than the alternate venue, it can adjust the amount_out_requested as follows:

amount_out_requested += gas_compensation

gas_compensation = max((gas_used_hot - expected_gas_units) * (expected_gas_price * 1e9) * eth_to_token_out_conversion, 0)

Since token_out is WETH, eth_to_token_out_conversion = 1 in this example.

In the example mentioned above, If the expected gas cost of the HOT swap is 200_500. Then the liquidity manager updates the final amount_out_requested for the solver as such:

\text{amount_out_requested = 0.33e18 + (500 * 30 * 1e9)}

The Solver is given a Quote which can execute up to 1000 USDC of volume at the price of HotPriceDiscounted or HotPriceBase depending on how quickly the Quote is submitted. Liquidity Managers should be explicit in their strategy of distributing Quotes to give Solver's soft guarantees that the Discounted price is achievable in a window of a few blocks after distribution.

Expiry

A Solver's request includes the field request_expiry to allow a Solver to request a timely response. This encourages liquidity managers to respond quickly to requests which may be time-sensitive. The solver's request includes a quote_expiry field, enabling solvers to specify a deadline for executing the signed quote on-chain. Note that the quote_expiry field is not binding for liquidity managers. The signed quote provided may have a shorter expiry than requested. However, liquidity managers are strongly encouraged to sign quotes only if they can adhere to the requested quote_expiry.

Valantis HOT API