Reya
  • Start Here
    • Why Reya?
  • REYA PRODUCTS
    • Reya DEX
      • Navigating Reya DEX
        • Dashboard: getting started
          • Creating your margin account
          • Moving funds
          • Checking your account
        • The Trading Screen
          • Trade form
          • Market Data Panel
        • LP Pool
      • Trading on Reya DEX
        • Perpetual Futures
        • Margin
        • Auto-exchange and Liquidations
        • Specifications
        • Conditional Orders
        • FlashSwap
        • Collateral liquidations
        • Settlement and cross-collateralization
      • Docs: Reya DEX REST API
      • Docs: Reya DEX WebSocket
    • Reya Network
      • The structure of Reya Network
      • The Liquidity Layer
        • Reya’s pool for perpetual futures
        • Offering liquidity in the passive pool
        • Deepdive into passive perps
        • Network Owned Liquidity
      • Derivatives Clearing
        • Automatic leveraging of PnL across instruments
        • Cross-collateralization
          • Haircuts
          • Auto-exchange conditions
          • Auto-exchange mechanism
        • Cross-margining
          • The margin system
        • The liquidation engine
          • Ranked liquidations
          • Dutch auction
          • Backstop LPs
          • Insurance Funds
          • Page 1
        • Spot markets
        • Reya Governance
      • What's the roadmap
      • Who's Behind Reya Network
    • rUSD / srUSD
      • rUSD
      • srUSD
      • srUSD How to and FAQs
  • COMMUNITY
    • Join the Reya Community
    • Incentives Overview
      • Experience (XP)
        • Technical details
      • Boosts
      • Ranks and Seasons
    • x.com
  • Technical Docs
    • Reya Python SDK
    • Contract Functions
      • Core
      • Passive Perp Instrument
      • Passive Pool
      • Oracle Adapter
    • Contract Addresses
    • Smart Contract Withdrawals
    • Audits
  • REYA RESOURCES
    • Blog
    • Beginner's Guide to Better Trading with Reya
    • Block Explorer
    • Glossary (coming soon)
    • FAQ (coming soon)
Powered by GitBook
On this page
  1. Technical Docs
  2. Contract Functions

Passive Pool

Liquidity pool that acts as a counter-party for all trades on the Reya DEX.

getPoolQuoteToken

function getPoolQuoteToken(uint128 id) external view returns (address quoteToken);

Given the pool id, it returns the liquidity token address. Currently there is only 1 pool, id = 1, and its quote token is rUSD.

getPoolAccountId

function getPoolAccountId(uint128 id) external view returns (uint128 accountId);

Given the pool id, it returns the pool's margin account id registered in Core.

addLiquidity

function addLiquidity(uint128 poolId, address owner, uint256 amount, uint256 minShares) external returns (uint256);

Transfers the specified amount of liquidity from the caller to the pool and, based on the current price, mints a corresponding amount of shares to the given 'owner' address. For example, if 3 rUSD is deposited (3* 10^6 with precision) and the share per share is 1.5 (1.2 * 10^18 with precision), then the amount of shares received will be 3/1.5 = 2 shares (2 * 10^30 with precision).

removeLiquidity

function removeLiquidity(uint128 poolId, uint256 sharesAmount, uint256 minOut) external returns (uint256 tokenAmount);

Burns the specified sharesAmount of shares and, based on the current price, withdraws the corresponding amount of liquidity to the caller's address. 'minOut' is the minimum amount of quote tokens expected to be received by the caller.

removeLiquidityBySig

function removeLiquidityBySig(address owner, uint128 poolId, uint256 sharesAmount, uint256 minOut, EIP712Signature memory sig, bytes memory extraSignatureData) external returns (uint256 tokenAmount);

Additionally to removeLiquidity, this function allows liquidity removal from a user's account by validating their signature instead of validating msg.sender. It sends the funds to the given 'owner'.

getAccountBalance

function getAccountBalance(uint128 poolId, address account) external view returns (uint256);

Given the user’s address, it returns the user's share balance in the specified pool. Shares have precision 30.

getPoolMarginBalance

function getPoolMarginBalance(uint128 poolId) external view returns (uint256);

Returns the margin balance of the pool margin account in Core in the pool’s quote token.

getSharePrice

function getSharePrice(uint128 poolId) external view returns (UD60x18)

This is the margin balance of the pool divided by the share supply. Note, the precision of the margin balance is adjusted from the quote token decimals to 30 decimals precision. The price has 18 decimals precision.

getShareSupply

function getShareSupply(uint128 poolId) external view returns (uint256)

Returns the total amount of shares tracked by the pool. When adding liquidity this amount increases by the number of shares minted based on the share price and the liquidity provided. When removing liquidity, supply decreases by the amount of shares burnt. The share supply has 30 decimals precision.

PreviousPassive Perp InstrumentNextOracle Adapter

Last updated 4 months ago