PositionsManager

Git Source

Inherits: IPositionsManager, PositionsManagerInternal

Author: Morpho Labs

Abstract contract exposing logic functions delegate-called by the Morpho contract.

Functions

supplyLogic

Implements the supply logic.

function supplyLogic(address underlying, uint256 amount, address from, address onBehalf, uint256 maxIterations)
    external
    returns (uint256);

Parameters

NameTypeDescription
underlyingaddressThe address of the underlying asset to supply.
amountuint256The amount of underlying to supply.
fromaddressThe address to transfer the underlying from.
onBehalfaddressThe address that will receive the supply position.
maxIterationsuint256The maximum number of iterations allowed during the matching process.

Returns

NameTypeDescription
<none>uint256The amount supplied (in underlying).

supplyCollateralLogic

Implements the supply collateral logic.

Relies on Aave to check the supply cap when supplying collateral.

function supplyCollateralLogic(address underlying, uint256 amount, address from, address onBehalf)
    external
    returns (uint256);

Parameters

NameTypeDescription
underlyingaddressThe address of the underlying asset to supply.
amountuint256The amount of underlying to supply.
fromaddressThe address to transfer the underlying from.
onBehalfaddressThe address that will receive the collateral position.

Returns

NameTypeDescription
<none>uint256The collateral amount supplied (in underlying).

borrowLogic

Implements the borrow logic.

function borrowLogic(address underlying, uint256 amount, address borrower, address receiver, uint256 maxIterations)
    external
    returns (uint256);

Parameters

NameTypeDescription
underlyingaddressThe address of the underlying asset to borrow.
amountuint256The amount of underlying to borrow.
borroweraddressThe address that will receive the debt position.
receiveraddressThe address that will receive the borrowed funds.
maxIterationsuint256The maximum number of iterations allowed during the matching process.

Returns

NameTypeDescription
<none>uint256The amount borrowed (in underlying).

repayLogic

Implements the repay logic.

function repayLogic(address underlying, uint256 amount, address repayer, address onBehalf) external returns (uint256);

Parameters

NameTypeDescription
underlyingaddressThe address of the underlying asset to borrow.
amountuint256The amount of underlying to repay.
repayeraddressThe address that repays the underlying debt.
onBehalfaddressThe address whose position will be repaid.

Returns

NameTypeDescription
<none>uint256The amount repaid (in underlying).

withdrawLogic

Implements the withdraw logic.

function withdrawLogic(address underlying, uint256 amount, address supplier, address receiver, uint256 maxIterations)
    external
    returns (uint256);

Parameters

NameTypeDescription
underlyingaddressThe address of the underlying asset to withdraw.
amountuint256The amount of underlying to withdraw.
supplieraddressThe address whose position will be withdrawn.
receiveraddressThe address that will receive the withdrawn funds.
maxIterationsuint256The maximum number of iterations allowed during the matching process.

Returns

NameTypeDescription
<none>uint256The amount withdrawn (in underlying).

withdrawCollateralLogic

Implements the withdraw collateral logic.

function withdrawCollateralLogic(address underlying, uint256 amount, address supplier, address receiver)
    external
    returns (uint256);

Parameters

NameTypeDescription
underlyingaddressThe address of the underlying asset to withdraw.
amountuint256The amount of underlying to withdraw.
supplieraddressThe address whose position will be withdrawn.
receiveraddressThe address that will receive the withdrawn funds.

Returns

NameTypeDescription
<none>uint256The collateral amount withdrawn (in underlying).

liquidateLogic

Implements the liquidation logic.

function liquidateLogic(
    address underlyingBorrowed,
    address underlyingCollateral,
    uint256 amount,
    address borrower,
    address liquidator
) external returns (uint256, uint256);

Parameters

NameTypeDescription
underlyingBorrowedaddressThe address of the underlying borrowed to repay.
underlyingCollateraladdressThe address of the underlying collateral to seize.
amountuint256The amount of underlyingBorrowed to repay.
borroweraddressThe address of the borrower to liquidate.
liquidatoraddressThe address that will liquidate the borrower.

Returns

NameTypeDescription
<none>uint256The underlyingBorrowed amount repaid (in underlying) and the underlyingCollateral amount seized (in underlying).
<none>uint256