Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

đŸ“œ Smart Contracts

The EVM side of Surge is a focused set of contracts that implement the debt ledger, liquidity accounting, and liquidation auctions that back Vault collateral on Bitcoin. These contracts do not custody BTC. BTC stays on Bitcoin and moves only through committed Taproot spend paths.

Debt Ledger

The Debt Ledger is the canonical ledger for BTC-backed liabilities. Every active credit line corresponds to a position and a row in manager state.

Key properties:

  • Tick-based position tracking. Positions are grouped by interest-rate tick rather than carried as per-position compounding values. This makes interest accrual O(1) per interaction per position and avoids per-block writes across the active set.
  • Collateral is attested, not custodied. The manager records satoshi collateral amounts reported by the Relayer after BTC deposit confirmation. Moving BTC on Bitcoin requires a Taproot spend authorized by the DCN - the manager cannot move BTC directly.
  • Health checks are callable by relayers or anyone. checkHealth(positionId) evaluates CR against policy thresholds and opens an auction when liquidation conditions are met.
  • EIP-712 + EIP-3009 repayment. repayWithERC3009 accepts a pre-signed USDC transferWithAuthorization so repayments are gasless from the borrower's perspective.

The manager enforces risk parameters per position: a Minimum Collateral Ratio below which new borrow is blocked, a liquidation threshold at 90% LTV at or above which a position becomes fully liquidatable, and a liquidation penalty applied during auction settlement. When LTV hits 90%, the entire credit line is liquidated in one event. Delinquency at term end triggers partial liquidation instead—proportional debt retirement with surplus BTC re-locked into the vault.

Position Representation

Each credit line is represented by an ERC-721 position token. Token ownership represents borrower-side control of that position and is used for borrower-authorized actions.

Liquidity Pool

The pool uses a unified share-based accounting model across all markets, where LP positions are represented as shares whose value increases via exchange rate updates. Interest accrues at the market level without per-position state changes. Fixed-rate markets reuse this accounting model but depend on liquidity allocated from the variable market, introducing cross-market liquidity coupling.

Market registry:

  • Each market has configurable rate logic, a stablecoin token (e.g. USDC), an active flag, and share-based accounting state.
  • The variable market is the primary destination for liquidity.
  • Fixed-rate markets hold no liquidity at rest. When a borrower takes a fixed-rate loan, liquidity is moved from the variable pool into the originating fixed market for the duration of the loan; on repay it is moved back. There is no duplication or rehypothecation.
  • Lenders can opt in to fixed markets and configure allocation limits (see LP page).

Liquidation Auctions

Liquidation proceeds via a Dutch auction with fixed-price buyout semantics: the first buyer who pays the current price wins the collateral. The auction runs for a fixed duration, the clearing price drops in regular intervals, and a minimum price floor caps the worst-case loss if no buyer emerges.

Auction lifecycle:

  1. Undercollateralization (90% LTV): checkHealth(positionId) opens a full liquidation auction. Proceeds retire the full debt on the originating market (variable or fixed), apply the penalty, and close the position.
  2. Delinquency (term ended, unpaid): the coordination layer opens a partial liquidation auction with a sized lot. Proceeds retire proportional debt and the penalty; surplus BTC is re-locked into the vault and the position continues.
  3. Buyers monitor the price curve and buy the auction at the current price.
  4. If the auction expires without a buyer at the floor, the protocol exercises the floor price itself.

Why Dutch. Dutch auctions on a declining curve do not require active bidding to discover price; they surface the market-clearing price passively, which is what a liquidation needs under time pressure. The first buyer to see the price as favourable clears the auction.

Market-segregated proceeds. Auction proceeds always flow back into the specific market (variable or fixed) that issued the liquidated credit line - risk is per-market, not socialized across the protocol.

References