Links

withdraw()

This function allows suppliers to withdraw their supplied assets from the protocol.
From a user standpoint, withdrawals work exactly the same as the underlying lending pool. Since Morpho taps into the lending pool, users can withdraw as long as the lending pool is solvent and their borrowing position does not exceed their capacity. In other words, as long as you can withdraw a position on the lending pool, you can do it on Morpho.
There are 3 types of withdrawal, with gradual complexity, each incrementally applied based on how the liquidity of the requested withdrawal is distributed:
  • Soft withdraw: If your liquidity is not matched in peer-to-peer, it will be redeemed from the underlying protocol's pool.
  • Transfer withdraw: If your liquidity is matched in peer-to-peer, your liquidity will be replaced with other unmatched suppliers' liquidity.
  • Hard withdraw: If Morpho can't find enough unmatched supplied liquidity, Morpho unmatches the borrowers you are matched with, within the gas consumption limit set by governance. If not enough liquidity is unmatched, the remaining liquidity asked is borrowed from the underlying pool and a spread will get introduced to Morpho's peer-to-peer borrow rate to compensate, until the extra debt is matched with a new supplier (this mechanism corresponds to the delta mechanism further described here).
A user cannot withdraw more than their supply: the input amount will be cropped to the maximum amount that can be withdrawn (the supply of the user, with accrued interests, on the given market).
function withdraw(
address _poolTokenAddress,
uint256 _amount
)
Input parameter
Input type
Description
_poolTokenAddress
address
The address of the underlying protocol's pool token to withdraw from.
_amount
uint256
The amount of underlying ERC20 tokens to withdraw.
Reverts
Emitted Events
Last modified 5mo ago