The Yield Protocol Vault v2 is a Collateralized Debt Engine for zero-coupon bonds, loosely integrated with YieldSpace Automated Market Makers, as described by Dan Robinson and Allan Niemerg.
A longer description of the smart contracts can be found in the Yield v2 reference.
Oracles return spot prices, borrowing rates and lending rates for the assets in the protocol.
Joins store assets, such as ERC20 or ERC721 tokens.
FYTokens are ERC20 tokens that are redeemable at maturity for their underlying asset, at an amount that starts at 1 and increases with the lending rate (chi
).
The Cauldron is responsible for the accounting in the Yield Protocol. Vaults are created to contain borrowing positions of one collateral asset type against one fyToken series. The debt in a given vault increases with the borrowing rate (rate
) after maturity of the associated fyToken series.
When the value of the collateral in a vault falls below the value of the borrowed fyToken, the vault can be liquidated.
The Ladle is the gateway for all Cauldron integrations, and all asset movements in and out of the Joins (except fyToken redemptions). To implement certain features the Ladle integrates with YieldSpace Pools.
The Wand bundles function calls into governance actions.
The Witch is the liquidation engine for the Yield Protocol Vault v2.
This code is provided as-is, with no guarantees of any kind.
Before running any command, make sure to install dependencies:
$ yarn
Lint the Solidity code:
$ yarn lint:sol
Lint the TypeScript code:
$ yarn lint:ts
Generate the code coverage report:
$ yarn coverage
Be sure to have an .env
file located at packages/foundry
with the value MAINNET_RPC=<your rpc url>
to be used for forked tests.
Compile and test the smart contracts with Foundry:
$ cd packages/foundry
$ forge test
Additional tests can be run with Hardhat using npm or yarn:
$ cd packages/hardhat
$ npm run hardhat:test
Yield is offering bounties for bugs disclosed to us at [email protected]. The bounty reward is up to $500,000, depending on severity. Please include full details of the vulnerability and steps/code to reproduce. We ask that you permit us time to review and remediate any findings before public disclosure.
All files in this repository are released under the GPLv3 license.