CompliFi
  • Overview
  • FAQ: Perpetual x5 Tokens
  • FAQ: Covered Call Options (CCOs)
  • FAQ: Investing / Providing Liquidity
  • Key Concepts
    • Protocol Architecture
    • No Counterparty Risk
    • Perpetual Derivatives
    • Providing Liquidity
    • Investment Returns
    • Additional Materials
  • Community
    • COMFI Token
  • Developers
    • Introduction
    • Pool Data
    • Trading
    • Liquidity Operations
    • Protocol TVL & Pool APYs
    • Smart Contract Addresses
    • ABIs
Powered by GitBook
On this page
  • Adding Liquidity
  • Removing Liquidity
  1. Developers

Liquidity Operations

In all structures below, rollover_hints_list can be left empty

Adding Liquidity

join method is used to add collateral to a pool in exchange for pool share ERC20 tokens.

seth send $POOL "joinSimple(uint256,uint256)" $COLLATERAL_AMOUNT $MIN_POOL_SHARE_AMOUNT_OUT
seth send $POOL "join(uint256,uint256,tuple[])" $COLLATERAL_AMOUNT $MIN_POOL_SHARE_AMOUNT_OUT $ROLLOVER_HINTS_LIST

Removing Liquidity

Removing liquidity from a pool is a two-step process. First, exit method creates a redemption request and adds it to Redemption Queue. The queue is processed automatically when users interact with the protocol and free collateral becomes available. Once that happens, the queued request is converted to Released Liquidity - an amount of collateral available to withdraw at any time. This can be done using withdrawReleasedLiquidity method.

Note: if enough free collateral is available when the request is made, then the entire process above happens atomically.

seth send $POOL "exitSimple(uint256)" $POOL_SHARE_AMOUNT
seth send $POOL "join(uint256,tuple[])" $POOL_SHARE_AMOUNT $ROLLOVER_HINTS_LIST
    
seth send $POOL "withdrawReleasedLiquidity(uint256)" $COLLATERAL_AMOUNT
PreviousTradingNextProtocol TVL & Pool APYs

Last updated 2 years ago