LensExtension

Git Source

Inherits: ILensExtension

Author: Morpho Labs.

This contract is an extension of the Lens. It should be deployed before the Lens, as the Lens depends on its address to extends its functionalities.

State Variables

morpho

STORAGE ///

IMorpho public immutable morpho;

comptroller

IComptroller internal immutable comptroller;

rewardsManager

IRewardsManager internal immutable rewardsManager;

Functions

constructor

CONSTRUCTOR ///

Constructs the contract.

constructor(address _morpho);

Parameters

NameTypeDescription
_morphoaddressThe address of the main Morpho contract.

getUserUnclaimedRewards

EXTERNAL ///

Returns the unclaimed COMP rewards for the given cToken addresses.

function getUserUnclaimedRewards(address[] calldata _poolTokens, address _user)
    external
    view
    returns (uint256 unclaimedRewards);

Parameters

NameTypeDescription
_poolTokensaddress[]The cToken addresses for which to compute the rewards.
_useraddressThe address of the user.

getAccruedSupplierComp

PUBLIC ///

Returns the accrued COMP rewards of a user since the last update.

function getAccruedSupplierComp(address _supplier, address _poolToken) public view returns (uint256);

Parameters

NameTypeDescription
_supplieraddressThe address of the supplier.
_poolTokenaddressThe cToken address.

Returns

NameTypeDescription
<none>uint256The accrued COMP rewards.

getAccruedBorrowerComp

Returns the accrued COMP rewards of a user since the last update.

function getAccruedBorrowerComp(address _borrower, address _poolToken) public view returns (uint256);

Parameters

NameTypeDescription
_borroweraddressThe address of the borrower.
_poolTokenaddressThe cToken address.

Returns

NameTypeDescription
<none>uint256The accrued COMP rewards.

getAccruedSupplierComp

Returns the accrued COMP rewards of a user since the last update.

function getAccruedSupplierComp(address _supplier, address _poolToken, uint256 _balance)
    public
    view
    returns (uint256);

Parameters

NameTypeDescription
_supplieraddressThe address of the supplier.
_poolTokenaddressThe cToken address.
_balanceuint256The user balance of tokens in the distribution.

Returns

NameTypeDescription
<none>uint256The accrued COMP rewards.

getAccruedBorrowerComp

Returns the accrued COMP rewards of a user since the last update.

function getAccruedBorrowerComp(address _borrower, address _poolToken, uint256 _balance)
    public
    view
    returns (uint256);

Parameters

NameTypeDescription
_borroweraddressThe address of the borrower.
_poolTokenaddressThe cToken address.
_balanceuint256The user balance of tokens in the distribution.

Returns

NameTypeDescription
<none>uint256The accrued COMP rewards.

getCurrentCompSupplyIndex

Returns the updated COMP supply index.

function getCurrentCompSupplyIndex(address _poolToken) public view returns (uint256);

Parameters

NameTypeDescription
_poolTokenaddressThe cToken address.

Returns

NameTypeDescription
<none>uint256The updated COMP supply index.

getCurrentCompBorrowIndex

Returns the updated COMP borrow index.

function getCurrentCompBorrowIndex(address _poolToken) public view returns (uint256);

Parameters

NameTypeDescription
_poolTokenaddressThe cToken address.

Returns

NameTypeDescription
<none>uint256The updated COMP borrow index.

Errors

InvalidCToken

ERRORS ///

Thrown when an invalid cToken address is passed to claim rewards.

error InvalidCToken();