Perpetual Yield Tranches (Beta)

The aim of Idle Perpetual Yield Tranches is to pool capital of users (eg DAI), deposit it into a lending provider (eg Idle Finance) and split the interest received between 2 classes of users with different risk profiles.

One will gain more interest and will be more risky (BB or junior tranche) and the other will have a lower APR but more safety (AA or senior tranche). In the case of an hack or a loss of funds of the lending provider integrated (or any other protocol integrated by this provider), all funds still available will be used to refund senior tranche holders first with the aim of making them whole, and with remaining funds, if any, junior holders after.

There are no locking period or epochs and users are free to enter and exit at any time, the interest earned (and governance tokens, after being partially sold in the market) will be split between the two classes according to a predefined ratio called trancheAPRSplitRatio (eg 20% interest to AA holders and 80% to BB) so the rate is variable for both classes of tranches.

Codebase

The codebase and a general overview of the architecture can be found here: https://github.com/Idle-Labs/idle-tranches

Deployed Contracts

Interface

interface IIdleCDO {
function AATranche() external view returns(address);
function BBTranche() external view returns(address);
function AAStaking() external view returns(address);
function BBStaking() external view returns(address);
function strategy() external view returns(address);
function strategyToken() external view returns(address);
function token() external view returns(address);
function allowAAWithdraw() external view returns(bool);
function allowBBWithdraw() external view returns(bool);
function fee() external view returns(uint256);
function getApr(address _tranche) external view returns(uint256);
function getContractValue() external view returns(uint256);
function trancheAPRSplitRatio() external view returns(uint256);
function getCurrentAARatio() external view returns(uint256);
function tranchePrice(address _tranche) external view returns(uint256);
function virtualPrice(address _tranche) external view returns(uint256);
function getIncentiveTokens() external view returns(address[] memory);
function depositAA(uint256) external returns(uint256);
function depositBB(uint256) external returns(uint256);
function withdrawAA(uint256) external returns(uint256);
function withdrawBB(uint256) external returns(uint256);
}

Core Methods

AAStaking view ()

  • Return Values

  • address _val: address of the IdleCDOTrancheRewards contract for AA tranche staking (can be address(0) which means that staking is disabled for AA).

AATranche view ()

  • Return Values

  • address _val: address of the AA Tranche token contract (ERC20)

BBStaking view ()

  • Return Values

  • address _val: address of the IdleCDOTrancheRewards contract for BB tranche staking (can be address(0) which means that staking is disabled for BB)

BBTranche view ()

  • Return Values

  • address _val: address of the BB Tranche token contract (ERC20)

depositAA nonpayable (uint256)

pausable

msg.sender should approve this contract first to spend `_amount` of `token`

  • Parameters

  • uint256 _amount: amount of `token` to deposit

  • Return Values

  • uint256 _val: AA tranche tokens minted

depositBB nonpayable (uint256)

pausable

msg.sender should approve this contract first to spend `_amount` of `token`

  • Parameters

  • uint256 _amount: amount of `token` to deposit

  • Return Values

  • uint256 _val: BB tranche tokens minted

fee view ()

  • Return Values

  • uint256 _0: performance fee taken where 100% is 100000

getApr view (address)

  • Parameters

  • address _tranche: tranche address

  • Return Values

  • uint256 _val: actual apr given current ratio between AA and BB tranches

getContractValue view ()

calculates the current total value locked (in `token` terms)

unclaimed rewards (gov tokens) are not counted. NOTE: `unclaimedFees` are not included in the contract value

  • Return Values

  • uint256 _val: current TVL of the contract

getCurrentAARatio view ()

calculates the current AA tranche ratio

  • Return Values

  • uint256 _val: AA tranches ratio (in underlying value) considering all interest where 100% is 100000

getIncentiveTokens view ()

returns an array of tokens used to incentivize tranches via IdleCDOTrancheRewards contracts

  • Return Values

  • address[] _val: array with addresses of incentiveTokens (can be empty)

lastNAVAA view ()

  • Return Values

  • uint256 _val: return last saved net asset value (TVL) for AA tranches only

lastNAVBB view ()

  • Return Values

  • uint256 _val: return last saved net asset value (TVL) for BB tranches only

strategy view ()

  • Return Values

  • address _val: address of the lending strategy used for deploying capital

strategyToken view ()

  • Return Values

  • address _val: intereset bearing asset of the lending provider used in this IdleCDO (eg idleDAI)

token view ()

  • Return Values

  • address _val: underlying asset address deposited by the user (eg DAI)

trancheAPRSplitRatio view ()

  • Return Values

  • uint256 _val: percentage of interest that will go to AA tranche holders where 100% is 100000

tranchePrice view (address)

  • Parameters

  • address _tranche: tranche address

  • Return Values

  • uint256 _0: last saved tranche price. This price gets updated right before each deposit and redeem call in order to split the interest accrued since the last interaction.

virtualPrice view (address)

calculates the current tranches price considering the interest that is yet to be splitted ie the interest generated since the last interaction (done on depositXX/withdrawXX/harvest) useful for showing updated gains on frontends

this should always be >= of tranchePrice

  • Parameters

  • address _tranche: address of the requested tranche

  • Return Values

  • uint256 _virtualPrice: tranche price considering all interest since last interaction

withdrawAA nonpayable (uint256)

pausable

  • Parameters

  • uint256 _amount: amount of AA tranche tokens to burn

  • Return Values

  • uint256 _val: underlying tokens redeemed

withdrawBB nonpayable (uint256)

pausable

  • Parameters

  • uint256 _amount: amount of BB tranche tokens to burn

  • Return Values

  • uint256 _val: underlying tokens redeemed