Smart Contract Integration
This page describes how to integrate Illuminate into your smart contracts with examples.
Looking up markets
We can begin with finding supported tokens and pools within an Illuminate market. A market is defined by a tuple of underlying (address) and maturity (uint256).
address marketPlace = 0x9A74762723685c5EEE2f94b80a427dE1bf029426;
// To look up a market, you will need the maturity and underlying for a given market.
// In this example, we'll look up information about the USDC-MAR23 market.
uint256 maturity = 1680393600; // ~April 02, 2023
address underlying = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; // USDC
// First, we'll look up the supported principal tokens for the market.
// To do so, call the markets method on the MarketPlace contract. This method takes
// in an underlying, maturity and principal enum. The enum value, defined below,
// returns the PT for a given market. A null address is returned if there is no PT
// for that particular market.
enum Principals {
Illuminate, // 0
Swivel, // 1
Yield, // 2
Element, // 3
Pendle, // 4
Tempus, // 5
Sense, // 6
Apwine, // 7
Notional // 8
}
// To look up Pendle's PT for the USDC-MAR23 market:
address pendlePT = IMarketPlace(marketPlace).markets(underlying, maturity, 4);
// Additionally, we can get the Yield Space Pool for the Illuminate principal token
// by calling the pools method:
address iptPool = IMarketPlace(marketPlace).pools(underlying, maturity);
Lending
The Lender contract provides convenience lend methods that swap between the underlying and supported PTs. Each protocol has a lend method that results in users receiving Illuminate principal tokens (iPTs).
Minting
If a user already has PTs, they can wrap them into iPTs via the Lender contract's mint method.
Redeeming
Once a market matures, users can redeem the underlying asset via the Redeemer contract.
Execution of the redemption should only be done after the Redeemer has redeemed the supported principal tokens from the Lender contract. Redeeming prior to this will result in lost funds.
Swapping
Prior to maturity, users may swap their iPTs for the underlying, and vise versa via a Yield Space Pool.
Swapping with EIP4626 (EIP5095) Interfaces
Prior to maturity, users may swap their iPTs for the underlying, and vise versa via a Yield Space Pool.
Checking for Paused States
Integrated protocols are subject to being paused on a principal or market basis by the admin of each respective contract. Below, we demonstrate how to check the paused state of the contracts.
Last updated