Skip to content
BorrowX

How a BorrowX loan works

One example throughout: 2,000 tUSDC against 1.2 tETH at $3,200.

Two people reading and taking notes at a wooden picnic table in the sun

A loan's life

  1. Allow

    Let the contract move your collateral (ERC-20 allowance).

  2. Lock and borrow

    One transaction locks collateral and sends the loan.

  3. Accrue

    Interest adds up every second.

  4. Repay

    In parts or at once, interest first.

  5. Unlock

    Debt at zero: withdraw your collateral.

Price falls too far, or the grace period ends: a liquidator closes the loan.

Collateral and limits

Borrow up to the max LTV. Past the liquidation threshold, collateral can be sold.

CollateralReference priceMax LTVLiquidation threshold
tETH$3,200.0075%82%
tWBTC$64,000.0070%78%
tLINK$14.5055%65%

Health factor and the safety runway

health = collateral value × liquidation threshold ÷ debt

  1. 1.2 tETH × $3,200 = $3,840 of collateral
  2. $3,840 × 0.82 = $3,148.80 of borrowing power
  3. $3,148.80 ÷ 2,000 = health 1.57, Safe
Today$3,200.00
Sold below
$2,032.52
At risk below
$3,048.78
tETH can fall 36% before your collateral can be sold.

Liquidation price: 2,000 ÷ (1.2 × 0.82) = $2,032.52, a 36% fall.

Interest, fixed or variable

Simple interest on what you still owe, every second.

interest = principal owed × APR × time ÷ 365 days

  • Fixed: today's variable rate + 1.25 points, locked.
  • Variable: tUSDC 5.40%, tDAI 5.10%, +2.00 points when the pool is busy.
  • 2,000 × 5.15% × 90 ÷ 365 ≈ 25.40 tUSDC (90 days, Steady discount).

Due dates are enforced

30, 90 or 180 days, then a 3-day grace period. After that, a liquidator can close the loan.

Liquidation, step by step

tETH falls to $1,900: health 1,900 × 1.2 × 0.82 ÷ 2,000 = 0.93.

  1. A liquidator repays your 2,000 tUSDC debt.
  2. It receives the debt + 5% in tETH: 2,100 ÷ 1,900 = 1.105 tETH.
  3. The other 0.095 tETH is yours, and you keep the 2,000 tUSDC.

The demo closes the whole loan at once; real protocols often liquidate part.

Borrower levels

A simulated credit score, built from your loans in this demo.

  1. New

    Standard rates.

  2. Steady

    1 on-time repayment: 0.25 points off.

  3. Trusted

    3 on-time repayments: 0.50 points off, +5 points max LTV.

A liquidation sends you back to New.

For developers

The demo's data layer (src/lib/demo) mirrors the contract interface, so wagmi and viem can replace it. Runs standalone or plugs into a pool such as VaultLend.

Show the contract interface
interface IBorrowX {
  function openLoan(address collateral, uint256 collateralAmount,
                    address asset, uint256 amount,
                    uint32 termDays, bool fixedRate) external returns (uint256 loanId);
  function repay(uint256 loanId, uint256 amount) external;   // interest first
  function addCollateral(uint256 loanId, uint256 amount) external;
  function withdrawCollateral(uint256 loanId) external;      // after full repayment
  function healthFactor(uint256 loanId) external view returns (uint256); // 1e18 = 1.00
  function liquidate(uint256 loanId) external;               // health < 1e18 or grace over
}

See it move

Start a demo loan