Lending Protocol
Panoptis DEX includes a native isolated-pair lending protocol that allows users to lend assets and earn interest, or borrow assets by depositing collateral. Each lending market is an independent pair contract with its own risk parameters, making it possible to safely support a wide range of asset types without cross-contaminating risk.
Isolated Pair Architecture
Unlike pooled lending protocols where one bad asset can affect all markets, Panoptis Lending uses isolated pair markets. Every lending market is a separate smart contract that holds its own:
- Asset supply (tokens available to borrow)
- Collateral (tokens posted by borrowers)
- Interest rate configuration
- Loan-to-value (LTV) limits and liquidation thresholds
If a single pair experiences an issue (e.g. oracle failure or bad debt), it cannot drain other pairs. This approach enables fine-grained risk management per asset class.
fTokens — ERC-4626 Vault Shares
When a user lends assets to a pair, they receive fTokens — ERC-20 tokens that represent a proportional share of the lending vault. fTokens are:
- Fully compliant with the ERC-4626 vault standard
- Freely transferable and composable with other protocols
- Automatically appreciating: as borrowers pay interest, each fToken redeems for more underlying asset over time
The exchange rate between fTokens and the underlying asset increases monotonically as interest accrues. Redeeming fTokens returns the proportional share of the pool including accumulated interest.
Interest Rate Models
Every pair deploys one of two supported rate calculators:
Linear Interest Rate
The LinearInterestRate model uses a piecewise linear curve keyed to pool utilization (borrowed / supplied). Two linear segments meet at a configurable vertex utilization point:
| Utilization Range | Rate Behavior |
|---|---|
| 0% → vertex | Rate rises linearly from minRate to vertexRate |
| vertex → 100% | Rate rises linearly from vertexRate to maxRate |
This produces predictable and auditable rates. Typical configurations set a low vertex rate for stablecoin pairs and a steep upper slope to discourage extreme utilization.
Variable Interest Rate
The VariableInterestRate model targets a utilization band (default: 75%–85%) and adjusts rates exponentially over time to drive utilization toward that range:
| Condition | Effect |
|---|---|
| Utilization < 75% | Rate decays toward MIN_RATE with a 12-hour half-life |
| 75% ≤ utilization ≤ 85% | Rate held stable |
| Utilization > 85% | Rate grows toward MAX_RATE |
The rate floor is 0.25% APY and the ceiling is 10,000% APY, ensuring rates always incentivize market rebalancing.
Loan-to-Value and Liquidations
Every pair has a maxLTV parameter (expressed with LTV_PRECISION = 1e5, so 75,000 = 75%). A borrower’s position stays healthy as long as:
Collateral value is determined via a whitelisted oracle. When a position’s LTV exceeds maxLTV, any address may liquidate it:
- Liquidator repays the borrower’s debt (partially or fully).
- Liquidator seizes the equivalent collateral value plus a liquidation fee.
- The position is reduced or closed.
Liquidation fees incentivize keepers to monitor positions actively, keeping the protocol solvent.
Borrow Share Accounting
Debt is tracked using a borrow shares system analogous to fToken shares. When a borrower takes out a loan, they receive borrow shares representing their fraction of total protocol debt. As interest accrues, the total borrow amount grows while borrow shares remain constant — meaning each share represents an increasing debt amount over time.
This design ensures proportional interest distribution without requiring per-user accrual loops.
Interest Accrual
Interest is accrued lazily on every interaction with the pair. The accrual logic:
- Computes elapsed seconds since the last interaction.
- Multiplies total outstanding borrow by
ratePerSec × elapsed. - Adds accrued interest to
totalBorrow.amount. - Splits a configurable portion to the protocol fee accumulator.
Because fToken holders collectively own the totalAsset pool, each unit of accrued interest increases the redemption value of outstanding fTokens.
PSW Liquidation Insurance
Borrowers can optionally purchase liquidation insurance denominated in PSW tokens. A policy covers a specified debt amount for a defined duration and pays out PSW if the position is liquidated during the coverage window.
Premium calculation accounts for:
- Health ratio: proximity of current LTV to maximum LTV
- Utilization ratio: how saturated the lending pool is
- Coverage duration: weekly rate multiplied by number of weeks
- Safety margin: 20% buffer added to the computed risk rate
If a covered liquidation occurs, the insurance contract automatically distributes PSW compensation to the insured borrower.
Whitelist Controls
Pairs can be configured with optional lender and borrower whitelists, enabling:
- Private lending markets restricted to vetted institutions
- KYC-gated pools for regulated asset types
- Permissioned collateral for pools backed by real-world assets
Whitelist management is controlled by the pair owner and validated through the PanoptisWhitelist contract.
Pair Deployment
New lending pairs are deployed via the PanoptisPairDeployer factory using CREATE2, which produces deterministic pair addresses from the asset configuration. After deployment, each pair is recorded in on-chain registries for discovery.
Deployment parameters include:
- Asset and collateral token addresses
- Oracle contract (must be whitelisted)
- Interest rate calculator
maxLTV, liquidation fee, and protocol fee settings
All parameter values are validated against safety bounds at deployment time.
Contract Summary
| Contract | Role |
|---|---|
PanoptisPair | Main pair — ERC-20 fToken + ERC-4626 vault interface |
PanoptisPairCore | Core lending logic, vault accounting, interest accrual |
PanoptisPairDeployer | Factory for deploying new pairs via CREATE2 |
PanoptisWhitelist | Oracle validation and participant access control |
LinearInterestRate | Piecewise linear rate model |
VariableInterestRate | Time-weighted adaptive rate model |
PswLiquidationInsurance | Optional PSW-denominated liquidation coverage |