EntryPositionsManager
Inherits: IEntryPositionsManager, PositionsManagerUtils
Author: Morpho Labs.
Morpho's entry points: supply and borrow.
Functions
supplyLogic
LOGIC ///
Implements supply logic.
function supplyLogic(address _poolToken, address _from, address _onBehalf, uint256 _amount, uint256 _maxGasForMatching)
external;
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the pool token the user wants to interact with. |
_from | address | The address of the account sending funds. |
_onBehalf | address | The address of the account whose positions will be updated. |
_amount | uint256 | The amount of token (in underlying). |
_maxGasForMatching | uint256 | The maximum amount of gas to consume within a matching engine loop. |
borrowLogic
Peer-to-peer supply /// Pool supply ///
Implements borrow logic.
function borrowLogic(address _poolToken, uint256 _amount, uint256 _maxGasForMatching) external;
Parameters
Name | Type | Description |
---|---|---|
_poolToken | address | The address of the market the user wants to interact with. |
_amount | uint256 | The amount of token (in underlying). |
_maxGasForMatching | uint256 | The maximum amount of gas to consume within a matching engine loop. |
_borrowAllowed
Peer-to-peer borrow /// Pool borrow ///
Checks whether the user can borrow or not.
function _borrowAllowed(address _user, address _poolToken, uint256 _borrowedAmount) internal returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_user | address | The user to determine liquidity for. |
_poolToken | address | The market to hypothetically borrow in. |
_borrowedAmount | uint256 | The amount of tokens to hypothetically borrow (in underlying). |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether the borrow is allowed or not. |
Events
Supplied
EVENTS ///
Emitted when a supply happens.
event Supplied(
address indexed _from,
address indexed _onBehalf,
address indexed _poolToken,
uint256 _amount,
uint256 _balanceOnPool,
uint256 _balanceInP2P
);
Borrowed
Emitted when a borrow happens.
event Borrowed(
address indexed _borrower,
address indexed _poolToken,
uint256 _amount,
uint256 _balanceOnPool,
uint256 _balanceInP2P
);
Errors
BorrowingNotEnabled
ERRORS ///
Thrown when borrowing is impossible, because it is not enabled on pool for this specific market.
error BorrowingNotEnabled();
UnauthorisedBorrow
Thrown when the user does not have enough collateral for the borrow.
error UnauthorisedBorrow();
SupplyIsPaused
Thrown when someone tries to supply but the supply is paused.
error SupplyIsPaused();
BorrowIsPaused
Thrown when someone tries to borrow but the borrow is paused.
error BorrowIsPaused();
Structs
SupplyVars
STRUCTS ///
struct SupplyVars {
uint256 remainingToSupply;
uint256 poolBorrowIndex;
uint256 toRepay;
}