Solend Instructions
InitLendingMarket
SetLendingMarketOwner
InitReserve: Initial amount of liquidity to deposit into the new reserve
RefreshReserve: Accrue interest and update market price of liquidity on a reserve
DepositReserveLiquidity: Deposit liquidity into a reserve in exchange for collateral. Collateral represents a share of the reserve liquidity pool
RedeemReserveCollateral: Redeem collateral from a reserve in exchange for liquidity
InitObligation: Initializes a new lending market obligation.
RefreshObligation: Refresh an obligation's accrued interest and collateral and liquidity prices.
DepositObligationCollateral: Deposit collateral to an obligation.
WithdrawObligationCollateral
BorrowObligationLiquidity: Borrow liquidity from a reserve by depositing collateral tokens
RepayObligationLiquidity: Repay borrowed liquidity to a reserve
LiquidateObligation: Repay borrowed liquidity to a reserve to receive collateral at a discount from an unhealthy obligation
FlashLoan: Make a flash loan
DepositReserveLiquidityAndObligationCollateral: Combines DepositReserveLiquidity and DepositObligationCollateral
WithdrawObligationCollateralAndRedeemReserveCollateral
UpdateReserveConfig: Updates a reserves config and a reserve price oracle pubkeys
LiquidateObligationAndRedeemReserveCollateral: Repay borrowed liquidity to a reserve to receive collateral at a discount from an unhealthy obligation
Solend States
LendingMarket
Obligation
Reserve
version
version
last_update
lending_market
liquidity
collateral
config
version
last_update
lending_market
owner
deposits: Vec<ObligationCollateral>,
borrows: Vec<ObligationLiquidity>,
deposited_value
borrowed_value
allowed_borrow_value
unhealthy_borrow_value
bump_seed
owner
quote_currency
token_program_id
oracle_program_id
switchboard_oracle_program_id
Isolated lending protocol strategy
Isolated market
Kashi’s fragmented markets: Kashi creates a money market for any pair imaginable. For Dai alone, Kashi has over 30 markets. This implementation achieves high security through extreme isolation of markets. Markets are spread too thin; they cannot perform efficiently.
Isolated pools
Rari’s Fuse pools: To solve for efficiency, a Fuse pool functions like Aave or Compound; it can consist of many tokens rather than a pair. Fuse allows “pool creators” to spin up customized, isolated pools for lending and borrowing assets of their choice.
Silo: permissionless & non-custodial lending protocol. By isolating the lending market as a trading pair, it is able to provide lending liquidity for any long-tail asset while also connecting trading pairs’ liquidity via the concept of Bridge Asset
SiloBridgePool manages the bridge asset (e.g. ETH). SiloBridge contract is an unlimited set of ETH silos that store ETH liquidity and manage borrowing and lending ETH between the bridge pool and each silo.
Silo Factory deploys Silos (money markets.)
Silo contract holds liquidity for a given asset and manages its borrowing and lending functions.
SiloOracle is the source of prices for the protocol. It enables oracle extensions. Silo will support Uniswap V3 TWAP oracle among others.
Router contracts allow for action batching. For example, if a user creates 2 lending positions, the router turns 4 transactions into one atomic execution.
Interest Rate Model implements dynamic interest rate using PID controller.
Multi-level isolation
Euler: isolates lending risks by dividing the security level of tokens
Asset isolation
Risk coefficient: Set a risk coefficient for both collateral and lent assets, so that assets with different risks have different coefficients
Dutch Auction Liquidation(MEV defense mechanism): Liquidation Discount Auctions with TWAP Smoothed Price Changes. Discount gradually increase as the value of the position decreases
Responsive interest rates: Adjust interest rates through market feedback
TWAP oracle:
Resistant to price manipulation
Avoid unnecessary liquidation:
Reduce MEV attacks:
Isolation-tier: cannot be used as collateral, and this asset can only be lent alone, not mixed with other assets
Cross-tier: cannot be used as collateral, but can be lent together with other assets
Collateral-tier
Solend pools: One global cross-collateral pool and mutliple isolated pools for riskier assets
Comptroller — risk management layer
Asset Configuration Panel
SPL token is unlike ERC20 which is a loose standard with countless “ERC20” tokens not properly conforming to the spec
Rari Safety Scores
Assets score
Money market score
Market Cap
Liquidity
Volatility
Swap Count
Critical variables: minimum asset score, relative liquidity, and liquidator incentive
Liquidity
Asset score
Collateral Factor
Reserve Factor
Utilization
Simple example
User deposits Token A in the A/ETH market to lend ETH,
The ETH that has been lent is deposited in the B/ETH market,
Lend Token B in the B/ETH market and transfer it to the user’s wallet.
Features
- it determines how much collateral a user is required to maintain, and
- whether (and by how much) a user can be liquidated.
- Each time a user interacts with a fToken, the Comptroller is asked to approve or deny the transactions
- The Comptroller maps user balances to prices (via the Price Oracle) to risk weights (called Collateral Factors) to make its determinations.
- Users explicitly list which assets they would like included in their risk scoring, by calling Enter Markets and Exit Market.
click to edit
Global Main pool Tokens can be listed in the main pool if they do not represent an increase in risk, mainly having reliable oracles or thick liquidity to assist in liquidations.
Isolated Pools are smaller pools, that are used to list slightly more risky tokens such as Locked Staked IN (lsIN) or future tokens like xSTEP or SAMO.
Kashi separates markets into pairs
allow any token to be listed
elastic interest rate is used to incentivize liquidity in a certain range. utilization is below the minimum target utilization, the interest rate halves every 8 hours. It is capped at a minimum utilization. If the utilization goes above the maximum target utilization, the interest rate doubles every eight hours
Uses BentoBox: token vault that generates yield