Skip to content

05 / 14 · Docs

Lines

Opening, adding to, repaying and withdrawing a Line, and the health formula.

A Line is a borrower's position in one Market. You deposit the Market's token as collateral and borrow HYPE against it, up to 70% of its applied Depth Value.

The four actions

Each Market exposes four Line functions:

deposit(amount)   // first deposit opens the Line
withdraw(amount)  // take collateral back
borrow(amount)    // receive native HYPE
repay()           // payable; send HYPE, any excess is refunded

Open and add

Your first deposit(amount) opens the Line. Later deposits add to it.

New collateral does not count toward your limit straight away. It sits in a pending bucket for 50 blocks, about 5 s on Elysium (block count uses the Elysium ArbOS L2 block number, about 0.1 s per block). A new deposit restarts the 50-block count for the whole pending bucket. Once the count completes, the pending collateral becomes matured collateral.

Borrow

borrow(amount) pays you native HYPE from the Market's vault. The borrow succeeds only if your debt after the borrow is at most your limit, and only if the Market has enough idle HYPE.

Repay

repay() is payable. Send HYPE with the call and it is applied to your debt. Anything you send above the debt is refunded. Interest accrues per second at the Market's borrow rate, so repay slightly more than the displayed debt if you want to close the Line in full.

Withdraw

withdraw(amount) returns collateral to you. Like a borrow, it requires your debt afterwards to be at most your limit. With no debt, you can withdraw everything.

Your limit

limit = 0.70 × applied DV of matured collateral
applied DV = min(15-minute minimum sounding, qty × TWAP30 × 0.9)

The limit is deliberately slow to rise. It uses only matured collateral, the lowest sounding over the last 15 minutes, and a cap at 90% of the 30-minute TWAP. A sudden pump in the pool does not raise it. See Anti-manipulation.

Your health

health = (0.85 × DV) / debt

For health, DV is the live value of all your collateral, pending and matured:

live value = min(live sounding, qty × TWAP30 × 0.9)

Health is deliberately quick to fall. It uses the live sounding, not the 15-minute minimum, so a drop in depth shows up immediately. The TWAP cap still applies, so a pump does not raise health either. If the pool cannot be read, live value is 0.

HealthMeaning
1.00 or aboveSafe. The Line cannot be trawled.
below 1.00The Line can be trawled by anyone. See Trawl.

Worked example

Take an example pool with 1,000,000 tokens and 100 HYPE, spot 0.0001 HYPE per token, with the 30-minute TWAP steady at spot. You deposit 20,000 tokens.

  1. The live sounding of 20,000 tokens is about 1.955 HYPE. The price cap is 20,000 × 0.0001 × 0.9 = 1.8 HYPE. Applied DV is the smaller: 1.8 HYPE.
  2. After 50 blocks the collateral matures. Your limit is 0.70 × 1.8 = 1.26 HYPE.
  3. You borrow 1.26 HYPE. Health is (0.85 × 1.8) / 1.26 ≈ 1.21.
  4. Health reaches 1.00 when live value falls to 1.26 / 0.85 ≈ 1.482 HYPE. That is about 17.6% below 1.8 HYPE. Interest accrued on the debt moves this point closer over time.

The gap between the 70% limit and the 85% threshold is your buffer. Borrowing less than the full limit widens it.

Practical notes

  • Borrowing at the full limit leaves only the 70% to 85% buffer. Thin books move fast.
  • A pending deposit does not raise your limit, but it does count toward health.
  • If you add collateral to protect a Line, it helps health at once and the limit after 50 blocks.
  • Lines live inside one Market. Collateral in one Market never backs debt in another.

Open a Line on testnet in the app.

Official announcements: @BythosDepth