PositionsManager
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
Name | Type | Description |
---|---|---|
underlying | address | The address of the underlying asset to supply. |
amount | uint256 | The amount of underlying to supply. |
from | address | The address to transfer the underlying from. |
onBehalf | address | The address that will receive the supply position. |
maxIterations | uint256 | The maximum number of iterations allowed during the matching process. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
underlying | address | The address of the underlying asset to supply. |
amount | uint256 | The amount of underlying to supply. |
from | address | The address to transfer the underlying from. |
onBehalf | address | The address that will receive the collateral position. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
underlying | address | The address of the underlying asset to borrow. |
amount | uint256 | The amount of underlying to borrow. |
borrower | address | The address that will receive the debt position. |
receiver | address | The address that will receive the borrowed funds. |
maxIterations | uint256 | The maximum number of iterations allowed during the matching process. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The amount borrowed (in underlying). |
repayLogic
Implements the repay logic.
function repayLogic(address underlying, uint256 amount, address repayer, address onBehalf) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
underlying | address | The address of the underlying asset to borrow. |
amount | uint256 | The amount of underlying to repay. |
repayer | address | The address that repays the underlying debt. |
onBehalf | address | The address whose position will be repaid. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
underlying | address | The address of the underlying asset to withdraw. |
amount | uint256 | The amount of underlying to withdraw. |
supplier | address | The address whose position will be withdrawn. |
receiver | address | The address that will receive the withdrawn funds. |
maxIterations | uint256 | The maximum number of iterations allowed during the matching process. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The amount withdrawn (in underlying). |
withdrawCollateralLogic
Implements the withdraw collateral logic.
function withdrawCollateralLogic(address underlying, uint256 amount, address supplier, address receiver)
external
returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
underlying | address | The address of the underlying asset to withdraw. |
amount | uint256 | The amount of underlying to withdraw. |
supplier | address | The address whose position will be withdrawn. |
receiver | address | The address that will receive the withdrawn funds. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The 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
Name | Type | Description |
---|---|---|
underlyingBorrowed | address | The address of the underlying borrowed to repay. |
underlyingCollateral | address | The address of the underlying collateral to seize. |
amount | uint256 | The amount of underlyingBorrowed to repay. |
borrower | address | The address of the borrower to liquidate. |
liquidator | address | The address that will liquidate the borrower. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The underlyingBorrowed amount repaid (in underlying) and the underlyingCollateral amount seized (in underlying). |
<none> | uint256 |