Lending
How Nolus lending pools work, how lenders earn the fixed-rate interest Spot Margin positions pay, and how to find and query each pool on chain.
Lenders fund the loans behind every Spot Margin position. Each protocol has one lending pool, the Liquidity Providers' Pool or LPP, which holds a single currency known as its LPN, the pool's native currency. Lenders deposit the LPN, the pool lends it to new positions at a fixed rate, and the interest that positions pay raises the value of every lender's share.
How a pool works
A pool records each lender's stake as nLPN, the lender's pool share, which a deposit credits and a withdrawal burns. Because nLPN is a balance that the pool contract keeps rather than a token, it cannot be transferred and exists only to be redeemed.
The pool tracks a price for nLPN in LPN, which starts at 1 and rises as positions pay loan interest into the pool, so a lender's LPN value grows without any action. When the lender withdraws, the pool burns the nLPN and pays out LPN at the current price, which returns the principal and the earned interest together.
The rate of each loan follows the pool's utilization curve, which The loan rate gives with a worked example, and because positions keep the rate they opened with, lenders earn the rates of the loans that are currently outstanding. Of the interest a position pays, only loan interest reaches the pool, since margin interest, the part of a position's rate charged on top of the loan rate, goes to the protocol's Profit contract. On top of the loan interest, the treasury distributes NLS rewards to the pools, which lenders claim separately as NLS rewards describes.
Pools and currencies
Each protocol's pool lends its own currency, and that currency is what the
pool's lenders deposit and earn. The SOLANA-METIS-USDC pool lends USDC to
long positions, while the pool of each short market, such as
SOLANA-METIS-SOL, lends the shorted token, so its lenders deposit that token
and earn interest in it.
A pool holds its currency as receipts for tokens that stay on Solana in the escrow of Solray, the Nolus program on Solana, which is why depositing and withdrawing are Nolus transactions. The app at app.nolus.io shows the current pools and their yields.
Find and query a pool
Every pool query runs against the pool's contract address, which the platform
admin contract returns for each protocol. The following commands resolve the
address of the SOLANA-METIS-USDC pool and then read its currency:
ADMIN=nolus1gurgpv8savnfw66lckwzn4zk7fp394lpe667dhu7aw48u40lj6jsqxf8nd
LPP=$(nolusd q wasm contract-state smart $ADMIN '{"protocol":"SOLANA-METIS-USDC"}' -o json \
| jq -r .data.contracts.lpp)
nolusd q wasm contract-state smart $LPP '{"lpn":[]}'ADMIN is the address of the platform admin contract, and LPP receives the
pool address. With that address, the pool answers the following queries:
| Query | Returns |
|---|---|
{"lpn":[]} | The pool currency ticker, for example "USDC". |
{"config":[]} | The borrow rate curve (base_interest_rate, utilization_optimal, addon_optimal_interest_rate, in permille) and min_utilization. |
{"lpp_balance":[]} | balance (idle funds), total_principal_due and total_interest_due (lent out), balance_nlpn (all nLPN issued). |
{"price":[]} | The nLPN price as a pair of amounts: amount in nLPN and amount_quote in LPN. Price = amount_quote / amount. |
{"deposit_capacity":[]} | The most the pool accepts now, or null when deposits are uncapped. |
{"quote":{"amount":{"amount":"<n>","ticker":"<LPN>"}}} | The rate a new loan of that size would get, {"quote_interest_rate":<permille>}, or "no_liquidity". |
{"balance":{"address":"<account>"}} | The account's nLPN balance. |
{"rewards":{"address":"<account>"}} | The account's NLS rewards ready to claim. |
Risks to understand
Lending into a pool comes with three limits that lenders should understand before they deposit:
- A withdrawal pays out from the pool's idle balance, so when most of the pool
is lent out, a withdrawal larger than the idle balance fails with
NoLiquidityuntil positions repay or new deposits arrive. - Because nLPN cannot be transferred, the pool share stays with the depositing account until it is withdrawn.
- When a closed or liquidated position does not cover its debt, the protocol's reserve covers the shortfall, as Liquidations and risk explains.
Where to go next
Repaying and closing
Repay a Spot Margin position, close it in full or in part, and set take profit and stop loss, with the order in which payments and liquidations apply.
Deposit and withdraw
How to deposit the pool currency into a Nolus lending pool, read the value of an nLPN pool share, and withdraw principal and interest with burn.