PositionsManagerUtils

Git Source

Inherits: MatchingEngine

Author: Morpho Labs.

Utils shared by the EntryPositionsManager and ExitPositionsManager.

Functions

_supplyToPool

POOL INTERACTION ///

Supplies underlying tokens to Aave.

function _supplyToPool(ERC20 _underlyingToken, uint256 _amount) internal;

Parameters

NameTypeDescription
_underlyingTokenERC20The underlying token of the market to supply to.
_amountuint256The amount of token (in underlying).

_withdrawFromPool

Withdraws underlying tokens from Aave.

function _withdrawFromPool(ERC20 _underlyingToken, address _poolToken, uint256 _amount) internal;

Parameters

NameTypeDescription
_underlyingTokenERC20The underlying token of the market to withdraw from.
_poolTokenaddressThe address of the market.
_amountuint256The amount of token (in underlying).

_borrowFromPool

Borrows underlying tokens from Aave.

function _borrowFromPool(ERC20 _underlyingToken, uint256 _amount) internal;

Parameters

NameTypeDescription
_underlyingTokenERC20The underlying token of the market to borrow from.
_amountuint256The amount of token (in underlying).

_repayToPool

Repays underlying tokens to Aave.

function _repayToPool(ERC20 _underlyingToken, uint256 _amount) internal;

Parameters

NameTypeDescription
_underlyingTokenERC20The underlying token of the market to repay to.
_amountuint256The amount of token (in underlying).

Events

P2PBorrowDeltaUpdated

COMMON EVENTS ///

Emitted when the peer-to-peer borrow delta is updated.

event P2PBorrowDeltaUpdated(address indexed _poolToken, uint256 _p2pBorrowDelta);

P2PSupplyDeltaUpdated

Emitted when the peer-to-peer supply delta is updated.

event P2PSupplyDeltaUpdated(address indexed _poolToken, uint256 _p2pSupplyDelta);

P2PAmountsUpdated

Emitted when the supply and peer-to-peer borrow amounts are updated.

event P2PAmountsUpdated(address indexed _poolToken, uint256 _p2pSupplyAmount, uint256 _p2pBorrowAmount);

Errors

AddressIsZero

COMMON ERRORS ///

Thrown when the address is zero.

error AddressIsZero();

AmountIsZero

Thrown when the amount is equal to 0.

error AmountIsZero();