Lender

User Flow

The Lender contract can be used by calling the lend method on any principal. The contract overloads the lend operation for all principals, and principals that have matching signatures can use the p (principal) parameter to distinguish which principal they would like to execute the loan on.

To execute a lend operation, the Lender will transfer an user's underlying asset to the Lender contract alongside a specified maturity (m), amount (a) and any additional data that the principal requires to execute the loan (e.g. pool information)

Within each lend operation, the Lender contract will extract a fee and lend the rest of the capital on the appropriate principal. The Lender contract will maintain custody of the principal token. To track the user's outstanding position, an ERC-5095 token for that market will be minted and sent to the user.

Motivation

The primary purpose of the Lender contract is to facilitate lending at the best rates aggregated among the available interest rate swap protocols in DeFi. At a high level, users should be able to bring an asset and lend it out over some period of time and get the best fixed rate on their lent capital.

This is made possible by the markets mapping, which brings together multiple maturities for different lending markets. For example, USDC may be lent on Pendle, Swivel and Tempus, and have slightly different maturities (e.g. June 28, June 29, and June 30 respectively). Illuminate combines these three lending markets into one, and allows users to gain access to the best possible rate. In addition, by combining these markets into a single market represented by a unique ERC-5095 token, Illuminate enables arbitrage between these rates, ensuring that the best rate is given to users.

Data Organization

This section describes several key pieces of data that Lender needs.

  • markets: This mapping maps tuples of (uint256, address) (which represent a unique market) to a list of address[9] (which represent principal tokens). These addresses are token contracts for the principal tokens in each of the interest rate swap protocols supported by Illuminate.

  • Principals: This enum contains the supported interest rate swap protocols by Illuminate. The order matters -- it indicates which position in the markets mapping value is being referred to by the user. For example, a user can refer to the Illuminate principal token by using the value 0 because it is the first value in the enum. Note that the Principals enum is defined in the MarketPlace.sol contract.

  • swivelAddr, pendleAddr and tempusAddr: These address attributes are necessary to conduct lend operations on their respective protocols. This means that in addition to the principal token address, these addresses are used to facilitate the swap of the underlying for the principal token of that particular protocol.

Note that the Principals enum is defined below:

    enum Principals {
        Illuminate,
        Swivel,
        Yield,
        Element,
        Pendle,
        Tempus,
        Sense,
        Apwine,
        Notional
    }

Last updated