Docs
Belay protects USDC loans on Morpho Blue (Base) from liquidation. When a loan's loan-to-value ratio reaches a trigger the borrower chose, Belay repays part of the debt and sells the matching collateral on Uniswap v3, so the loan goes back to the borrower's target instead of being liquidated at 86%.
Markets
| cbBTC / USDC | Morpho market 0x9103…1836, liquidation at 86% LTV. Sold through the Uniswap v3 cbBTC/USDC 0.05% pool. |
| WETH / USDC | Morpho market 0x8793…1bda, liquidation at 86% LTV. Sold through the Uniswap v3 WETH/USDC 0.05% pool. |
Setting it up
- Your loan stays on Morpho in your own address. Belay never takes custody.
- Call
setAuthorization(Belay, true) on Morpho. This lets the Belay contract repay and withdraw collateral for you, and its code only uses it inside a rescue.
- Call
setRule(market, trigger, target) on Belay. The trigger must be at least 2 points under liquidation (max 84%), the target at least 3 points under the trigger and at least 10%.
- To stop:
setRule(market, 0, 0), or revoke the authorization on Morpho.
A rescue
- A keeper checks every protected loan each minute with
needsProtection() and calls protect() when it returns true. protect() is open to anyone.
- The LTV is the debt over the collateral valued at the market's own Morpho oracle, the same price that decides liquidations.
- The contract computes the collateral to sell so the loan lands at the target after the price bound and the fee:
sell value = (debt − target × collateral value) / (k − target), with k = 1 − slippage bound − fee.
- Order: the debt is repaid first; inside Morpho's repay callback the collateral is withdrawn and sold on Uniswap. The loan is never less healthy at any step.
- The sale must return at least the oracle value minus 1.5%, or the whole rescue reverts and nothing changes.
- From the sale: the debt repayment, Belay's fee (0.1% of the sale, capped at 0.5% by the contract), and anything left goes back to the borrower in USDC.
Costs
| While protected | Nothing |
| A rescue | Uniswap pool fee 0.05%, price impact of the sale, Belay fee 0.1% of the sale |
| A Morpho liquidation, for comparison | Incentive of 4.38% of the debt repaid, paid in your collateral to the liquidator |
Owner powers
- List a Morpho market with its Uniswap pool fee tier, or unlist it.
- Set the fee and its receiver, at most 0.5%. Set the slippage bound between 0.1% and 3%.
- Nothing else. There is no function that moves collateral, debt or USDC of any borrower.
Risks
- A drop faster than the keeper's check, or a sale that cannot meet the price bound in a thin market, can still end in a Morpho liquidation.
- The oracle, Morpho and Uniswap are outside Belay's control.
- Unaudited. Tested on a fork of Base mainnet against the live markets. Start small.
Contracts