Skip to main content

Protocol Constants

This page is a comprehensive reference of all constants, parameters, and configuration values used across PredMart's smart contract and backend systems. These values define the protocol's risk model, interest rate behavior, liquidation mechanics, oracle constraints, and operational parameters.

All on-chain constants are defined in the PredmartLendingPool.sol smart contract. Backend constants are defined in lending/constants.py and config.py.


Interest Rate Model Parameters

These constants define PredMart's kinked (two-slope) interest rate model. They determine how borrowing costs and lending yields respond to pool utilization.

ConstantOn-Chain NameValueUnitDescription
Base RateBASE_RATE0.05e18WAD (5%)The minimum annual borrow rate at 0% utilization. This is the floor rate — even when nobody is borrowing, this rate applies.
Kink UtilizationKINK0.80e18WAD (80%)The target utilization point where the rate curve changes slope. Below this level, rates increase gently. Above this level, rates increase steeply.
Rate at KinkRATE_AT_KINK0.25e18WAD (25%)The annual borrow rate exactly at the kink point (80% utilization).
Maximum RateMAX_RATE3.00e18WAD (300%)The theoretical maximum annual borrow rate at 100% utilization.
Slope 1 (Below Kink)SLOPE10.25e18WAD (25%)The rate of interest increase per unit of utilization below the kink. Formula: (RATE_AT_KINK - BASE_RATE) / KINK.
Slope 2 (Above Kink)SLOPE213.75e18WAD (1375%)The rate of interest increase per unit of utilization above the kink. Formula: (MAX_RATE - RATE_AT_KINK) / (1 - KINK). Deliberately very steep.
Reserve FactorRESERVE_FACTOR0.05e18WAD (5%)The percentage of interest income that goes to protocol reserves rather than lenders.
Seconds Per YearSECONDS_PER_YEAR31,557,600seconds365.25 days × 86,400 seconds. Used for converting annual rates to per-second rates.

Interest Rate at Various Utilizations

UtilizationBorrow APRSupply APY*
0%5.00%0.00%
10%7.50%0.71%
20%10.00%1.90%
30%12.50%3.56%
40%15.00%5.70%
50%17.50%8.31%
60%20.00%11.40%
70%22.50%14.96%
80%25.00%19.00%
85%93.75%75.70%
90%162.50%138.94%
95%231.25%208.69%
100%300.00%285.00%

*Supply APY = Borrow APR × Utilization × (1 - Reserve Factor)


Risk Parameters

These constants govern the protocol's risk management — how much users can borrow, when liquidation triggers, and how liquidation is executed.

ConstantOn-Chain NameValueUnitDescription
Liquidation BufferLIQUIDATION_BUFFER0.10e18WAD (10%)Added to the LTV ratio to determine the liquidation threshold. Creates a safety gap between the maximum borrowing limit and the liquidation trigger.
Close FactorCLOSE_FACTOR0.50e18WAD (50%)The maximum fraction of a borrower's debt that can be repaid in a single liquidation, when the health factor is between 0.95 and 1.0.
Full Close Health FactorFULL_CLOSE_HF0.95e18WAD (0.95)When a position's health factor drops below this threshold, the close factor increases to 100%, allowing the entire debt to be repaid in a single liquidation.
Liquidation BonusLIQUIDATION_BONUS0.05e18WAD (5%)The bonus collateral awarded to the liquidator in above-water liquidations. Liquidators receive collateral worth repayAmount × (1 + 5%).
Liquidation DiscountLIQUIDATION_DISCOUNT0.10e18WAD (10%)For underwater liquidations, the discount applied to the collateral value. The liquidator pays 90% of the collateral's value and receives all collateral.
Minimum BorrowMIN_BORROW1,000,000USDC units ($1.00)The minimum loan size in USDC's 6-decimal representation. Prevents dust positions.
Number of AnchorsNUM_ANCHORS7countThe number of price/LTV anchor points in the LTV curve.

LTV Curve Anchors

The LTV (Loan-to-Value) curve is defined by 7 anchor points. Between anchors, the LTV is linearly interpolated. The liquidation threshold at each price point is LTV + 10% (the liquidation buffer).

Anchor IndexPrice AnchorLTV AnchorLiquidation ThresholdMax Theoretical Leverage
0$0.00 (0)2% (0.02e18)12%1.02x
1$0.10 (0.10e18)8% (0.08e18)18%1.09x
2$0.20 (0.20e18)30% (0.30e18)40%1.43x
3$0.40 (0.40e18)45% (0.45e18)55%1.82x
4$0.60 (0.60e18)60% (0.60e18)70%2.50x
5$0.80 (0.80e18)70% (0.70e18)80%3.33x
6$1.00 (1.00e18)75% (0.75e18)85%4.00x

Interpolated LTV at Common Prices

PriceLTVLiquidation Threshold
$0.055.0%15.0%
$0.1519.0%29.0%
$0.2537.5%47.5%
$0.3037.5%47.5%
$0.3541.25%51.25%
$0.4548.75%58.75%
$0.5052.50%62.50%
$0.5556.25%66.25%
$0.6562.50%72.50%
$0.7065.00%75.00%
$0.7567.50%77.50%
$0.8571.25%81.25%
$0.9072.50%82.50%
$0.9573.75%83.75%

Oracle and Timing Parameters

These constants control the oracle system — how price and resolution data is validated.

ConstantOn-Chain NameValueUnitDescription
Max Price AgeMAX_RELAY_PRICE_AGE10secondsMaximum age of oracle-signed price data. Transactions with older price data are rejected.
Max Resolution AgeMAX_RESOLUTION_AGE3,600seconds (1 hour)Maximum age of oracle-signed resolution data. Market resolution calls with older data are rejected.

Pool Configuration

ConstantOn-Chain NameValueUnitDescription
Pool CappoolCapBps500basis points (5%)Maximum total borrowing against any single token as a percentage of the pool's total assets. Prevents concentration risk. Adjustable by admin.

ERC-4626 Vault Parameters

ParameterValueDescription
Underlying AssetUSDC.eThe token lenders deposit and borrowers receive
Vault Share NamepUSDCThe ERC-20 token lenders receive
Decimal Offset6pUSDC has 12 decimals (USDC's 6 + offset of 6). Prevents inflation attacks.

Backend Constants

These constants are defined in PredMart's backend code and govern operational behavior. They are not on-chain but affect the oracle, liquidation bot, and borrow limits.

Depth Gate Parameters

ConstantVariable NameValueDescription
Lookback PeriodDEPTH_GATE_LOOKBACK_DAYS7 daysHow far back depth snapshots are considered for cap calculation.
Sample IntervalDEPTH_GATE_SAMPLE_INTERVAL_MIN60 minutesHow often orderbook depth is sampled.
PercentileDEPTH_GATE_PERCENTILE25The percentile used from the depth snapshot distribution (conservative).
Ask BandDEPTH_GATE_ASK_BAND$0.10Only count asks within this range of the best ask price.
Minimum UptimeDEPTH_GATE_MIN_UPTIME0.8 (80%)Require at least 80% of expected samples to exist; otherwise borrowing is blocked.
Pretrack VolumeDEPTH_GATE_PRETRACK_VOLUME_MIN$1,000Pre-sample depth for markets with at least this cumulative trading volume.
Pretrack Cache TTLDEPTH_GATE_PRETRACK_CACHE_TTL1,800 seconds (30 min)How often the high-volume market list is refreshed from Gamma API.

Depth Gate Graduated Scaling

History AgeDivisorEffective Cap vs. Pool Cap
7+ days1.0100% (full pool cap)
6 days1.567%
5 days2.050%
4 days2.540%
3 days3.033%
2 days5.020%
1 day7.014%
12 hours10.010%
6 hours15.07%
2+ hours20.05%
Less than 2 hoursBorrowing blocked

Price Drop Guard Parameters

ConstantVariable NameValueDescription
WindowPRICE_DROP_WINDOW180 seconds (3 minutes)Rolling time window for crash detection.
Relative ThresholdPRICE_DROP_THRESHOLD_PCT0.35 (35%)Minimum relative price drop to trigger the guard.
Absolute ThresholdPRICE_DROP_THRESHOLD_ABS0.08 ($0.08)Minimum absolute price drop to trigger the guard. Both thresholds must be met.

Borrow Haircut

ConstantVariable NameValueDescription
Borrow HaircutBORROW_HAIRCUT995 (99.5%)Backend reduces the theoretical max borrow by 0.5% to account for rounding and timing differences between the API call and on-chain execution.

Precision Constants

ConstantVariable NameValueDescription
WADWAD10^18Standard 18-decimal precision for fixed-point arithmetic. Used for prices, rates, ratios.
USDC DecimalsUSDC_DECIMALS6USDC has 6 decimal places.
USDC UnitUSDC_UNIT10^6 (1,000,000)One USDC in its smallest unit.
pUSDC DecimalsPUSDC_DECIMALS12pUSDC has 12 decimal places (6 from USDC + 6 offset).

Worker Task Intervals

These intervals define how frequently PredMart's background tasks run.

TaskIntervalQueueDescription
Event Indexer2 secondsindexerIndexes new blockchain events from the lending pool contract.
Position Scanner5 secondsindexerRefreshes the Redis cache of all active positions.
Liquidation Fallback5 secondsindexerREST-based health factor check for all positions (backup for WebSocket).
Unsold Shares Sweep10 secondsindexerRetries selling seized collateral that failed to sell previously.
Resolution Fallback60 secondsindexerPolls Polymarket's API for newly resolved markets.
Pool Stats Snapshot30 secondsdefaultRecords utilization, rates, and TVL for historical charts.
Depth Sampling60 minutesdefaultSamples orderbook depth for each active collateral token.

Contract Addresses

ContractNetworkAddress
PredMart Lending Pool (Proxy)Polygon Mainnet0xD90D012990F0245cAD29823bdf0B4C9AF207d9ee
USDC.ePolygon Mainnet0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
CTF (Conditional Token Framework)Polygon Mainnet0x4D97DCd97eC945f40cF65F87097ACe5EA0476045

Next Steps