This function allows users to supply ERC20 tokens to the Morpho protocol.
If there is enough demand for your supply to be matched (within the gas consumption limit you optionally provide, which is set by default by governance), you will benefit from a peer-to-peer credit line, at Morpho's peer-to-peer rate. Otherwise, your liquidity will be deposited on the underlying liquidity pool, until there's a corresponding borrow demand for the liquidity on Morpho (in which case the user will automatically be matched).
Suppliers must approve the Morpho contract to spend _amount of the underlying ERC20 token.
function supply(
address _poolTokenAddress,
address _onBehalf,
uint256 _amount,
uint256 _maxGasForMatching = defaultMaxGasForMatching
Input parameter
Input type
The address of the underlying protocol's pool token to supply to.
The address of the supplier who will benefit from the supplied amount. In most cases, you want to supply for yourself: _onBehalf === msg.sender
The amount of underlying ERC20 tokens to supply (the contract must have at least a corresponding allowance).
uint256, optional
The maximum amount of gas to consume to get you matched in peer-to-peer. This is an optional argument, whose default value is set by governance.
Emitted Events