πŸ‘¨β€πŸŒΎ Yield Sources
Yield sources generate yield for prize pools.
A Yield Source contract is used by a Yield Source Prize Pool to generate yield for prizes.
The yield source just needs these properties:
  • The deposit asset is the same as the asset that accrues. I.e. if users deposit Dai into the yield source, then it should yield Dai as well
  • Yield must always be increasing. The mechanics of the Prize Pool require yield to always go up, as it's a no-loss system. The yield source must protect depositor's collateral.
There are implementations for all of the major yield sources:
  • Compound
  • Aave
  • Yearn
  • More!
See the full list here​

Yield Source Interface

The yield source interface is very simple; it just needs to support four functions:
1
/// @title Defines the functions used to interact with a yield source. The Prize Pool inherits this contract.
2
/// @notice Prize Pools subclasses need to implement this interface so that yield can be generated.
3
interface IYieldSource {
4
​
5
/// @notice Returns the ERC20 asset token used for deposits.
6
/// @return The ERC20 asset token
7
function depositToken() external view returns (address);
8
​
9
/// @notice Returns the total balance (in asset tokens). This includes the deposits and interest.
10
/// @return The underlying balance of asset tokens
11
function balanceOfToken(address addr) external returns (uint256);
12
​
13
/// @notice Supplies tokens to the yield source. Allows assets to be supplied on other user's behalf using the `to` param.
14
/// @param amount The amount of `token()` to be supplied
15
/// @param to The user whose balance will receive the tokens
16
function supplyTokenTo(uint256 amount, address to) external;
17
​
18
/// @notice Redeems tokens from the yield source.
19
/// @param amount The amount of `token()` to withdraw. Denominated in `token()` as above.
20
/// @return The actual amount of tokens that were redeemed.
21
function redeemToken(uint256 amount) external returns (uint256);
22
​
23
}
Copied!
​
Copy link