Limitless
  • Intro
    • Why Limitless
    • Vision: A Unified Liquidity Market For Every Digital Asset
    • Participants
      • Liquidity Providers
        • Rehypothecation of Liquidity
        • Withdrawal Limits
        • Covered Call Strategy
      • Leverage Traders
    • Premium Model
    • limWETH
    • Example Trade
    • ❓FAQ
    • Audits & Security
  • User Guide
    • Liquidity Providers
      • Advanced LP
      • Simple LP
    • Leverage Traders
      • Adding and Opening Positions
      • Managing Positions
    • Fees
  • Incentives and Tokenomics
    • LMT(Points)
    • Arbitrum Launch Campaign
    • Referrals
    • $NZT
    • $LIMIT
  • Advanced
    • Providing Liquidity
    • Determining which ticks to borrow from
    • Borrowing/Repaying Liquidity
    • Rebalancer Incentives
    • Premiums
    • Oracle Free
    • Applications
Powered by GitBook
On this page
  • Borrowing
  • Repaying
  • Loan Info
  1. Advanced

Borrowing/Repaying Liquidity

PreviousDetermining which ticks to borrow fromNextRebalancer Incentives

Last updated 1 year ago

Borrowing

Borrowers can borrow from discretized bins chosen by the , and this is illustrated in the diagram below. Once the liquidity is lowered in the borrowed tick ranges it won't be used for trading until they are repaid.

For a given x_b amount of token_x the borrower is borrowing from bin i, the liquidity subsequently lowered in that bin is

Lb=xbPi+1PiPi+1−PiL_b =x_b \frac{\sqrt{P_{{i+1}}} \sqrt{P_{i}} } {\sqrt{P_{{i+1}}} -\sqrt{P_{i}} } Lb​=xb​Pi+1​​−Pi​​Pi+1​​Pi​​​

where P_i+1 and P_i is the starting price of the next bin and bin i, respectively.

The system ensures that bins that are lent out are always either fully in token0 or token1, which means the current tick is always outside the borrowed ranges.

Repaying

Loan Info

A position's loan info is stored inside an array of struct LiquidityLoan.

struct LiquidityLoan {
    int24 tick; // the first tick of the bin borrowed from 
    uint128 liquidity; // amount of borrowed liquidity
    uint256 lastGrowth; // accumulated growth at last premium payment 
}

The following diagrams depict the evolution of a position's loan. Data for each bin is contained in the LiquidityLoan struct.

When a position is added to, the array can grow in length and the bins can grow in size. This means a trader can borrow from bins other than the currently borrowed bins.

When a position is reduced, the bins can shrink in size, with the same proportion among all borrowed bins. If reducePercentage is 50% in the example above, all three bins' liquidity will be reduced by 50%.

Repaying will simply revert the changes made to the liquidity distribution made from borrowing. Unlike when in borrowing where the current price is always outside the borrowed ranges, .

when a trader or a borrower repays the current tick can be anywhere
indexer
First two bins of the position is borrowed. Liquidity subsequently reduced in those regions
Drawing
Drawing
Drawing