Lending & Borrowing
Panoptis Lending lets you earn yield by supplying assets or take out loans against your collateral. Every market is an isolated pair, so your exposure stays scoped to the specific assets you choose.
For a concise step-by-step example that walks through borrowing DAI, depositing into the psDAI vault, and staking psDAI in the Farm to earn PSW, see the user guide: Lending & Farm — Step-by-step (DAI example).
Lending Assets
Depositing
- Select a lending pair from the Lending page.
- Approve the pair contract to spend your asset token.
- Call
deposit(assets, receiver)ormint(shares, receiver)on the pair contract. - You receive fTokens in return — ERC-20 tokens representing your share of the vault.
fTokens accrue value automatically. You don’t need to do anything — interest earned by borrowers increases the redemption rate of your fTokens over time.
Checking Your Yield
The pair contract exposes a standard ERC-4626 convertToAssets(shares) function. Call it with your fToken balance to see the current redemption value. The difference from your original deposit amount is your accrued interest.
Withdrawing
Call withdraw(assets, receiver, owner) to redeem a specific asset amount, or redeem(shares, receiver, owner) to burn a specific number of fTokens. Both operations burn the corresponding fTokens and return the underlying asset.
Note: Withdrawals require sufficient liquidity in the pair. If utilization is very high, not all assets may be available immediately. Rates will increase to incentivize new deposits and repayments.
Borrowing
Before You Borrow
Identify the lending pair for the asset you want to borrow. You will need:
- Collateral token: the token accepted as collateral in that pair.
- Collateral amount: enough to keep your LTV below the pair’s
maxLTV.
Step 1 — Deposit Collateral
Approve the pair to spend your collateral token, then call:
addCollateral(collateralAmount, borrower)Your collateral is held in the pair contract and earns no yield. It solely secures your borrow position.
Step 2 — Borrow
Call borrowAsset(borrowAmount, collateralAmount, receiver). The pair checks that your resulting LTV would be within maxLTV before disbursing the tokens. You can combine collateral deposit and borrow into a single transaction using the borrowAsset overload that accepts a collateral parameter.
Step 3 — Manage Your Position
Monitor your LTV regularly, especially for volatile collateral assets. Your debt grows continuously as interest accrues. If your LTV reaches maxLTV, your position becomes eligible for liquidation.
Useful queries:
userCollateralBalance(address)— your collateral in the pairuserBorrowShares(address)— your outstanding borrow sharestoBorrowAmount(shares, roundUp)— convert borrow shares to current debt amounttotalBorrow— total protocol borrow (amount, shares)
Step 4 — Repaying
repayAsset(shares, borrower)You repay in terms of borrow shares, not a fixed token amount. To repay your full debt, pass your exact userBorrowShares balance. The pair converts shares to the current debt amount (including accrued interest) at the moment of the call.
Partial repayments are supported — just provide fewer shares.
Step 5 — Recover Collateral
removeCollateral(collateralAmount, receiver)You can only remove collateral that keeps your position solvent (LTV ≤ maxLTV). To recover all collateral, repay the entire debt first.
Loan-to-Value and Liquidation Risk
Your position is healthy as long as:
When LTV > maxLTV, any address can liquidate your position. Liquidations:
- Repay your outstanding debt (partially or fully).
- Seize collateral equal to the repaid value plus a liquidation fee.
- Leave you with reduced (or zero) collateral and reduced (or zero) debt.
Avoiding Liquidation
- Maintain a comfortable buffer below
maxLTV— at least 10–15% margin is advisable for volatile assets. - Add collateral proactively when collateral prices fall.
- Repay debt before LTV gets too close to the threshold.
- Watch oracle prices; sudden price moves can push LTV over the limit quickly.
Liquidation Insurance (PSW)
If you want protection against liquidation losses, you can purchase a PSW-denominated insurance policy:
- Call
quotePremiumPswE18(coveredDebt, durationWeeks, ...)to get a premium quote. - Pay the quoted PSW premium to the
PswLiquidationInsurancecontract. - If your position is liquidated while covered, the contract automatically sends you a PSW payout.
Premium factors:
- How close your current LTV is to
maxLTV(health ratio) - How saturated the lending pool is (utilization ratio)
- Coverage duration (per-week rate × number of weeks)
- A 20% safety buffer
Insurance does not prevent liquidation — it compensates you in PSW tokens after the fact.
Interest Rate Reference
| Model | Behavior |
|---|---|
| Linear | Rate rises predictably with utilization. Two linear segments meet at the vertex utilization point, with minRate, vertexRate, and maxRate configuring the curve. |
| Variable | Adaptive model targeting 75%–85% utilization. Below target the rate decays (12-hour half-life); above target it grows. Floor: 0.25% APY, ceiling: 10,000% APY. |
The active model type for any pair is set at deployment and visible via rateContract().
Whitelist-Gated Markets
Some pairs enforce lender and/or borrower whitelists. If a pair has whitelisting enabled, you must be on the approved list to interact. Whitelist status is managed by the pair owner. Check forisLenderWhitelistActive() and isBorrowerWhitelistActive() on the pair contract before attempting a transaction.
Key Contract Functions Reference
Lender Functions
| Function | Description |
|---|---|
deposit(assets, receiver) | Deposit assets, receive fTokens |
mint(shares, receiver) | Mint exact fToken amount, pull required assets |
withdraw(assets, receiver, owner) | Redeem assets, burn fTokens |
redeem(shares, receiver, owner) | Burn exact fTokens, receive assets |
convertToAssets(shares) | Preview redemption value of fTokens |
convertToShares(assets) | Preview fToken amount for asset deposit |
Borrower Functions
| Function | Description |
|---|---|
addCollateral(amount, borrower) | Deposit collateral |
removeCollateral(amount, receiver) | Withdraw collateral (if position stays solvent) |
borrowAsset(amount, collateral, receiver) | Borrow assets (optionally deposit collateral atomically) |
repayAsset(shares, borrower) | Repay debt by burning borrow shares |
userCollateralBalance(address) | View collateral balance |
userBorrowShares(address) | View outstanding borrow shares |
toBorrowAmount(shares, roundUp) | Convert shares to current debt value |
Price & Health Functions
| Function | Description |
|---|---|
exchangeRateInfo() | Current collateral/asset oracle price |
updateExchangeRate() | Force oracle price refresh (public) |
totalBorrow | Struct: total borrow amount and total borrow shares |
totalAsset | Struct: total asset amount and total fToken shares |