Redeemer
User Flow
In order for a user to redeem their ERC-5095 tokens within a given market, two steps must be executed.
First, a redeem
must be called on the external principal that Lender.sol may currently own. Similar to the Lender contract, the Redeemer contract overloads the redeem
method, and distinguishes which loan to operated on by the p
(principal) parameter. In addition to the principal, the u
(underlying), m
(maturity) and any additional data in order to execute the redemption.
Each principal's redemption method (with the exception of Illuminate) will execute the following flow once called: first, the principal tokens for the market will be transferred from the Lender contract to the Redeemer contract. From there, the principal's redemption will be executed and the Redeemer contract will receive the owed underlying asset in return. Note that for a given market, this method needs to be called only once per principal.
Second, to complete the redemption, a user must call the Illuminate principal's redeem
on the relevant market (i.e. underlying + maturity tuple). This redeem will burn their ERC-5095 position for the market and send them the owed underlying token proportional to their balance of the ERC-5095 token.
Motivation
The Redeemer contract facilitates the collection of owed underlying assets from the interest rate swap principals back to the user. At a high level, users should be able to redeem any ERC-5095 token via Illuminate's redeem
method, and in doing so, this creates an aggregated market for a given underlying asset and maturity.
Data Organization
Redeemer's data organization reflects Lender's data organization in many ways. Here are the key data it tracks:
markets
: This mapping maps tuples of(uint256, address)
(which represent a unique market) to a list ofaddress[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 themarkets
mapping value is being referred to by the user. For example, a user can refer to the Illuminate principal token by using the value0
because it is the first value in the enum. Note that the Principals enum is defined in the MarketPlace.sol contract.swivelAddr
,pendleAddr
,tempusAddr
, andapwineAddr
: Theseaddress
attributes are necessary to conductredeem
operations on their respective protocols. This means that in addition to the principal token address, these addresses are used to facilitate the redemption of the principal token of that particular protocol to the Redeemer.
Note that the Principals
enum is defined below:
Last updated