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

Was this helpful?

  1. Sovereign Pool
  2. Interacting with Pools

Deposit Liquidity

A Liquidity Module can deposit liquidity into the sovereignVault by calling the depositLiquidity function on the Sovereign Pool. This is only true for the case where sovereignVault is the pool itself. Otherwise the sovereignVault must implement its own function for depositing liquidity.

/**
        @notice Deposit liquidity into an ALM Position.
        @dev Only callable by its respective active ALM Position.
        @param _amount0 Amount of token0 to deposit.
        @param _amount1 Amount of token1 to deposit. 
        @param _verificationContext Bytes containing verification data required in case of permissioned pool.
        @param _depositData Bytes encoded data for deposit callback.
        @return amount0Deposited Amount of token0 deposited.
        @return amount1Deposited Amount of token1 deposited.
     */
    function depositLiquidity(
        uint256 _amount0,
        uint256 _amount1,
        address _sender,
        bytes calldata _verificationContext,
        bytes calldata _depositData
    ) external override onlyALM nonReentrant returns (uint256 amount0Deposited, uint256 amount1Deposited)
  • This function can only be called by the Liquidity Module.

  • Liquidity Module is allowed to deposit any amount of token0 or token1 to the pool.

  • If the pool contains a verifierModule, _sender and _verificationContext would be checked for validity before accepting a deposit.

  • This function supports rebase tokens.

  • This function is disabled if reserves are meant to be stored outside of the pool (sovereignVault is not the pool).

  • No pool-level role can pause deposits.

Control Flow of a Withdrawal

user → Liquidity Module → Sovereign Pool’s depositLiquidity.

The Liquidity Module is free to decide how to interface with users and represent their deposits internally.

  • WARNING: If \_amount0 or \_amount1 is exactly 0, post-deposit callback checks will be skipped (to save gas in case of single token deposits). This means that if in one of these scenarios, the ALM transfers non-zero amounts, those would not be accounted in reserves and therefore permanently locked!

PreviousMulti Token SupportNextWithdraw Liquidity

Last updated 1 year ago

Was this helpful?