PoolLib

Git Source

Author: Morpho Labs

Library used to ease pool interactions.

Functions

supplyToPool

Supplies amount of underlying to pool.

The pool supply index must be passed as a parameter to skip the supply on pool if it were to revert due to the amount being too small.

function supplyToPool(IPool pool, address underlying, uint256 amount, uint256 index) internal;

borrowFromPool

Borrows amount of underlyingfrom pool.

function borrowFromPool(IPool pool, address underlying, uint256 amount) internal;

repayToPool

Repays amount of underlying to pool.

If the debt has been fully repaid already, the function will return early.

function repayToPool(IPool pool, address underlying, address variableDebtToken, uint256 amount) internal;

withdrawFromPool

Withdraws amount of underlying from pool.

If the amount is greater than the balance of the aToken, the function will withdraw the maximum possible.

function withdrawFromPool(IPool pool, address underlying, address aToken, uint256 amount) internal;

getCurrentPoolIndexes

Returns the current pool indexes for underlying on the pool.

function getCurrentPoolIndexes(IPool pool, address underlying)
    internal
    view
    returns (uint256 poolSupplyIndex, uint256 poolBorrowIndex);

Returns

NameTypeDescription
poolSupplyIndexuint256The current supply index of the pool (in ray).
poolBorrowIndexuint256The current borrow index of the pool (in ray).