Yearn Tranche is a decentralized protocol for managing risk and maximizing returns. The protocol integrates with Yearn's yTokens and yVaults, to create two new interest-bearing instruments, one with a fixed-rate, Tranche A, and one with a variable rate, Tranche B.
Info URL: https://docs.tranche.finance/tranchefinance/
npm i
truffle compile --all
truffle run test
truffle run coverage
or to test a single file:
truffle run coverage --network development --file="<filename>"
Test coverage on JYearn contract: 94.41%
Please refer to ./migrations/1_deploy_contracts.js file to see how the system could be deployed on the blockchain
Users can now call buy and redeem functions for tranche A & B tokens
Note: if ETH tranche is deployed, please deploy ETHGateway contract without a proxy, then set its address in JCompound with setETHGateway function.
You can migrate to a different Yearn version vault or token simply calling the following function:
migrateYTranche(uint256 _trancheNum, address _newYTokenAddress, bool _isVault)
All values will be sent to new vault and tokens inside contract will be switched with the new one, no other change
Name | Test % | Notes |
---|---|---|
JAdminTools | 57.89% |
--- |
JFeesCollector | 6.25% |
--- |
JTrancheDeployer | 80% |
--- |
JTrancheTokens | 100% |
--- |
JYearn | 91.88% |
--- |
Name | Size (KiB) | Description |
---|---|---|
JAdminTools | 2.27 |
Contract for administrative roles control (implementation), allowing the identification of addresses when dealing with reserved methods. Upgradeable. |
JAdminToolsStorage | 0.72 |
Contract for administrative roles control (storage) |
JFeesCollector | 9.29 |
Fees collector and uniswap swapper (implementation), it changes all fees and extra tokens into new interests for token holders, sending back extra mount to Compound protocol contract. Upgradeable. |
JFeesCollectorStorage | 0.82 |
Fees collector and uniswap swapper (storage) |
JTrancheAToken | 6.84 |
Tranche A token, with a non decreasing price, making possible for holders to have a fixed interest percentage. Not upgradeable. |
JTrancheBToken | 6.84 |
Tranche B token, with a floating price, making possible for holders to have a variable interest percentage. Not upgradeable. |
JTranchesDeployer | 18.46 |
Tranche A & B token deployer (implementation): this contract deploys tranche tokens everytime a new tranche is opened by the core protocol contract. Upgradeable. |
JTranchesDeployerStorage | 0.17 |
Tranche A & B token deployer (storage) |
JYearn | 19.17 |
Core contract protocol (implementation). It is responsible to make all actions to give the exact amount of tranche token to users, connecting with Yearn to have interest rates and other informations to give tokens the price they should have block by block. It also opens new tranches, and, via Tranche Deployer contract, it deploys new tranche tokens. Upgradeable. |
JYearnStorage | 1.74 |
Core contract protocol (storage) |