LendingPair is a masterContract for BentoBox that provides functionality for supplying an asset, borrowing that asset by supplying collateral, and links to an oracle for the exchange rate.


Supplying Assets

Anyone may supply assets to a Lending Pair and will receive an ERC20 token representing their stake in the total liquidity. The balanceOf function corresponds to the fraction a user has of the liquidity.

Supplying Collateral and Borrowing

Elastic Interest Rate

The interest rate optimizes for utilization (borrowed assets divided by total assets). If the 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.

Many Oracle Options

Any Oracle may be implemented that conforms to the IOracle interface. The data integrity of an Oracle has to be evaluated by the user and is not validated by the LendingPair in any way or form. An oracle returns the amount of collateral needed to buy 10e18 of asset.

Short and Leverage

To use a leveraged position, one can short by using the cook function to swap asset for collateral, in the same call as borrowing. The position only has to be solvent at the end of the transaction.


A user may be liquidated if their collateralization drops below 133%. Two liquidation options are available. In a range from 129 - 133% of collateralization, only a closed liquidation is available. In this case, a pre-approved swapper may be called by the SushiSwap team or liquidity providers to swap collateral to asset. The liquidation proceeds are distributed amongst liquidity providers and xSushi holders. If this range passes without a position being liquidated, it goes into open liquidation. At this point, anyone may liquidate a position by providing the borrowed amount directly or using a swapper of their choosing.

Liquidity Tokens

As you provide assets to the LendingPair, it will mint liquidity tokens in return. These tokens represent your share of the asset pool. As interest is paid by borrowers, these tokens will return more of the asset when you remove your liquidity.
LendingPair allows supplying assets and borrowing the same asset, but because the asset does NOT count as collateral it's just silly (as you lose funds) and no UI should allow this.

TVL vs Fees

The LendingPair contract is actually designed to minimize TVL and maximize fees and therefore maximize capital efficiency. This is done through the elastic interest rates, which will optimize each pair to have between 70% and 80% utilization, so most assets will be borrowed. If there is no demand for an asset, it will be counterproductive to supply it, as this will make the interest rate very low.



The batchfunction allows to efficiently group contract calls


The swipe function allows the owner of the master contract to swipe funds accidentally send to a lending pair.


The SushiSwapOracle can be pointed at any address. This could be a SushiSwap pair, a Uniswap pair or a malicious contract. Any UI should therefore verify that the oracle is indeed either a SushiSwap or Uniswap pair.
Last modified 9mo ago