Marketplace

Motivation

The MarketPlace contract serves two primary utilities:

  1. It allows the admin to create new lending markets.

  2. It routes swaps for Illuminate's ERC-5095 tokens to their respective YieldSpace AMM pool.

These functionalities are critical to the operation of Illuminate. The creation of markets updates the markets mapping which is referred to by the Lender and Redeemer when retrieving principal tokens. Additionally, the YieldSpace AMM pools allow for users to exit their debt positions prior to maturation by providing liquidity for each market's ERC-5095 token. pool

User Flow

The MarketPlace contract is not user-facing. It can only be used by the admin. That said, its functionality is integral to the Lender and Redeemer, and is worth exploring. This section will describe the methods available to the MarketPlace admin.

  • createMarket: this method creates markets by adding entries to the markets mapping. Each market needs to have principal tokens defined for each protocol to work. Additionally, this method mints a new ERC-5095 token for each new market. This token is considered Illuminate's principal token, and is held by users.

  • pause: this method stops access to YieldSpace pools for any given principal as defined in the Principals enum.

  • setAdmin: this method allows for setting the admin to a new address.

  • setPool: this method allows for setting an address in the pools mapping. The pools attribute contains the YieldSpace AMM pool for Illuminate's principal token.

Data Organization

There are two key mappings that MarketPlace stores:

  • markets: this mapping maps Markets (which consist of an underlying (address) and a maturity (uint256)) to a list of principal tokens ([9]address). The protocol that the address maps to depends on the Principals enum.

  • pools: this mapping maps Markets to YieldSpace AMM pools (address). These pools allow users to swap their ERC-5095 positions for the underlying asset prior to maturity.

  • Principals: this enum is referenced throughout Illuminate and states which interest rate swap protocols are supported. In addition, this enum defines the index through which the protocols can be referred to when they are stored in lists (as is done in the markets mapping).

Last updated