SMART Yield is an Ethereum platform for creating multiple risk profiles (e.g., “tranches”) out of singular debt pools across platforms like Compound Finance or AAVE. Accounts can enter pools like cUSDC or aDAI either via the junior tranche contract or the senior tranche contract. The SMART Yield contracts track these positions as either fungible tokens (ERC-20) or non-fungible tokens (ERC-721).
Learn More:
Any questions? Please contact us on Discord or read our Developer Guides for more information.
Contract Specifications can be found at Specifications
SMART Yield implementation, contains all logic that is not liquidity provider specific. SmartYield also implements an ERC20 fungible token for juniors.
ERC721 non-fungible token for senior bonds.
ERC20 fungible token for juniors.
ERC721 non-fungible token for junior bonds.
Interface for the Smart Yield implementation.
Interface for the Smart Yield implementation and how it interacts with the DAO (e.g. fee calculations and harvesting). The interface implements Governed.sol
.
Interface for the Provider
implementation relating to originators (such as Compound and Aave). You can find the specific provider contracts on /contracts/providers/
Interface for issuing ERC721 non-fungible tokens.
Interface for the DAO and governance.
contracts/external-interfaces/
contains all interfaces to external DeFi protocols such as Compound, Aave, Cream and Uniswap.
contracts/lib/
contains common utilities from Uniswap and mathematical functions MathUtils.sol that are used in our smart contracts and various application logic.
contracts/mocks/
contains mock smart contracts used by our tests. Our tests can be found on the test/
and test-mainnet/
folders.
contracts/model/
refers to logic in relation to the interest rate calculation and BOND rewards.
contracts/oracle
contains a plugable oracle used by the pool to measure a moving average of the actual underlying pool yield. See Understanding the oracles on our Developer Documentation for more details on how our oracles work.
contracts/providers
contains integration logic to our originators (such as Compound, Cream and Aave).
Check out more detailed smart contract Slither graphs with all the dependecies: SMART Yield Slither Charts.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# Restart terminal and/or run commands given at the end of the installation script
nvm install 12
nvm use 12
git clone https://github.com/BarnBridge/BarnBridge-SmartYieldBonds.git
cd BarnBridge-SmartYieldBonds
Create an API key with a Provider that supports Forking such as Alchemy Labs to run Mainnet Forking tests
Alchemy.io can be used to fork the current state of the Mainnet into your development environment. A free account will suffice.
- Navigate to Alchemy and create an account.
- Log in and create a new Project on Mainnet.
- Navigate to the Dashboard and click View Key. Paste the URL into the section labeled PROVIDER_FORKING in the
.env
file. (Optional: update sectionlabeled BLOCKNUMBER in the.env
file to fork a more recent state, at time of writing it is12488859
)
Create an API key with a Provider to deploy to Ethereum Public Testnets. In this guide, we are using Infura on Kovan.
- Navigate to Infura.io and create an account
- Log in and select "Get started and create your first project to access the Ethereum network"
- Create a project and name it appropriately. On the Settings page, switch the Network to Kovan and note the project URL ie https://kovan.infura.io/v3/INFURA-API-KEY
- Copy the Project URL and paste it into the section labeled PROVIDER in the
.env
file.
- Navigate to EtherScan and create an account
- Log in and navigate to MyAPIKey
- Use the Add button to create an API key, and paste it into the section labeled ETHERSCAN in the
.env
file
- If you deployed Governance.sol from BarnBridge-DAO, insert the contract address into the field labeled DAO in the
.env
file.
- Insert the mnemonic phrase for your testing wallet into the
.env
file. You can use a MetaMask instance, and switch the network to Kovan on the upper right. DO NOT USE YOUR PERSONAL METAMASK SEED PHRASE; USE A DIFFERENT BROWSER WITH AN INDEPENDENT METAMASK INSTALLATION - You'll need some Kovan-ETH (it is free) in order to pay the gas costs of deploying the contracts on the TestNet; you can use your GitHub account to authenticate to the KovanFaucet and receive 2 Kovan-ETH for free every 24 hours
- Use the BarnBridgeFaucet to swap some of your kETH for BOND, and also get test tokens for the originator platforms
- If you would only like to deploy certain SmartYield components, comment out DEPLOY_ALL in the
.env
file and un-comment out the components you'd like to deploy.
cp config.ts.dotenv config.ts
npm install
npm run compile
npm run test
npm run coverage
npm run test-mainnet
Optional: Update the .env
file indicating which specific Smart Yield pools you would like to deploy, or leave it as the default DEPLOY_ALL
npm run deploy-from-env
Update bot-kovan-oracle-update.ts with the oracle addresses from deploy-from-env.
npx hardhat run --network kovan scripts/bot-kovan-oracle-update.ts
# Press ctl+c to stop
For any concerns with the platform, open an issue on GitHub or visit us on Discord to discuss. For security concerns, please email info@barnbridge.com.
Copyright 2021 BarnBridge DAO