Paboxo

Notation and units

How the Math pages write numbers, and which way every rounding goes.

The pages in this section write down what the contracts compute, formula by formula, with the source line each one comes from and a worked example in both raw integers and human units. The narrative pages — interest rates, liquidations, Earn vault — explain why; these explain exactly how much.

Each formula names the contract that computes it, with its mainnet address — for example IsHealthy · 0x9259…F9a1. Contracts deployed once per market (LendingPool, LendingPoolRouter) link to the markets table; a Position is deployed per borrower.

Live values are read from mainnet (chainId 4663), and each names the block it was read at; the parameters page lists them. Mainnet's only debt when these pages were written was about 50 USDG on WETH/USDG, too small to show the rounding, so the worked examples that need a market with debt or a position are illustrative: they use mainnet's parameters and a mainnet price, with round amounts chosen to exercise the formulas. Each says which of its inputs are illustrative.

Scales

WAD101810^{18}. Every ratio, rate and percentage is stored as an integer scaled by it: 100% is 1e18, 65% is 650000000000000000, 0.1% is 1e15
USDG6 decimals. 1 USDG is 1000000 base units
WETH and every Stock Token (NVDA, SPY, SPCX, TSLA, MSFT, AAPL, QQQ, GOOGL, AMD)18 decimals
Oracle prices8 decimals. $250 is 25000000000
USD valuesHealth checks convert everything to USD scaled by 101810^{18}
peUSDGThe Earn vault's share, 18 decimals

USDG having 6 decimals, not 18, is the single most common integration mistake — a factor of 101210^{12}.

Time

Y=365×86,400=31,536,000 secondsY = 365 \times 86{,}400 = 31{,}536{,}000 \text{ seconds}

Every annual rate is converted to per-second with this constant (InterestRateModel · 0x8390…D741). There is no leap-year handling: a year is 365 days exactly.

Symbols

SymbolMeaningWhere it lives
SSSupply assets: what the Earn vault has in a markettotalSupplyAssets on the router
BBBorrow assets: total debt, including booked interesttotalBorrowAssets
TBS\text{TBS}Total borrow sharestotalBorrowShares
RRReserves: the protocol's accrued share of interesttotalReserveAssets
AAThe vault's assets: idle USDG plus ∑S\sum S over its markets (totalAssets() adds pending interest)vault.utilizationTotals()
UUVault-wide utilisation, ∑B/A\sum B / A; one figure for every market of the vaultvault.utilization()
rrBorrow rate, an annual rate (APR) in WADcalculateBorrowRate(router)
RfR_fReserve factorinterest rate model
LTV\text{LTV}, LT\text{LT}, bbLoan-to-value, liquidation threshold, liquidation bonusrouter, IsHealthy
qqCollateral in a Position, in base unitsPosition.totalCollateral()
ddA borrower's debt in USDG base unitsfrom their shares
CVCV, BVBVCollateral value and borrow value, USD × 101810^{18}IsHealthy

Rounding

Solidity division rounds down. The pages write that as ⌊⋅⌋\lfloor \cdot \rfloor, and a round-up (Math.mulDiv(…, Math.Rounding.Ceil)) as ⌈⋅⌉\lceil \cdot \rceil. Each rounding moves at most one base unit, but the direction is fixed, and it is worth knowing who each one favours.

OperationRoundsWho it favoursSource
Utilisation UUdownborrowers (rate slightly lower)PaboxoEarnVault · 0xaF5a…c634
Each slope of the rate curvedownborrowersInterestRateModel · 0x8390…D741
Interest per accrualdown, onceborrowers, by under one base unit per bookingInterestRateModel · 0x8390…D741
Reserve share of interestdownlenders (they take the remainder)InterestRateModel · 0x8390…D741
Borrow shares minteddownthe borrower (up to one share's worth)LendingPoolRouter
Debt for health checksdownthe borrowerIsHealthy · 0x9259…F9a1
Repay: assets pulled for sharesdownthe repayerLendingPoolRouter
Close factor: restoring fraction and share capupthe liquidator, by at most one share (the position lands on 1.05, never below)LendingPoolRouter
Liquidation: assets paid for sharesuplendersLendingPoolRouter
Bad debt written offuprecorded in fullLendingPoolRouter
Seize fractiondownthe borrowerLendingPoolRouter
Protocol's cut of the seizedownthe liquidatorLendingPoolRouter
Borrow feesdownthe borrowerLendingPoolRouter
Vault deposit / redeemdownthe vaultERC-4626
Vault mint / withdrawupthe vaultERC-4626
Vault preview*as the call it quotes— previews equal executionPaboxoEarnVault · 0xaF5a…c634
Fee: assets at the high-water mark AMA_Mupdepositors (a gain must be real before it is charged)PaboxoEarnVault · 0xaF5a…c634
Fee: amount FF and shares sFs_FdowndepositorsPaboxoEarnVault · 0xaF5a…c634

Two asymmetries follow from the table. Repayment rounds in the repayer's favour while liquidation rounds in the lenders'; the repayer's gain is at most one base unit per repayment (under 0.000001 USDG), and it is carried by the remaining borrowers' shares. And a new borrow's shares round down, so the borrower's recorded debt can start up to one share's worth below what they borrowed — again carried by the other borrowers.

APR and APY

Every rate stored or returned on-chain is an APR. Where these pages show an APY it is derived, and they say so — see APR and APY.

On this page