# Beginner's Guide to SMART Yield

## **What Is SMART Yield?**

SMART Yield offers users fixed or levered variable yield on their stablecoins through integrations with lending markets like Compound and Aave. It aggregates user deposits into underlying markets on these platforms and allocates the yield generated on the sum between two different risk profile subsets.

Let’s look at an example.

Alice is a crypto veteran looking to reduce the volatility of her portfolio. She decides to allocate a portion into stablecoins and is looking for predictable fixed rates of return.

Bob is a more aggressive DeFi power user. He is willing to take higher risks with his capital in order to get an opportunity for higher returns.

SMART Yield fulfills both Alice and Bob’s needs as it offers two types of risk profiles:

* Junior Pools: higher risk, levered variable rate rewards
* Senior Pools: lower risk, fixed-rate rewards

![](https://742178816-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MIu3rMElIO-jG68zdaV%2F-MfCckFFn2e60bu4td5u%2F-MfCePh9NgzcexDryL4Z%2Fimage.png?alt=media\&token=4020d982-f163-4f46-b247-a5445bf13524)

Users are able to deposit funds into either the junior or senior pool in exchange for a token indicating their claim on their principal and whatever yield is allocated for them. These aggregated holdings are then deposited into the specified originating lending market, e.g. Compound.

Seniors lock in a fixed-rate yield upon entering their side of the pool. This fixed rate is determined by the underlying market rate, as well as the ratio between existing seniors and juniors. The yield that is allocated to any given Senior pool depositor is allocated directly from the Junior pool; that is to say, the yield exists in the system from the moment the Senior bond in question is minted.

Juniors are willing to subsidize senior yields as they have the opportunity to benefit from levered yields. Because seniors are only entitled to their fixed yields, all yield generated by their principals goes to the junior side. So while Junior depositors are indeed risking their yield and potentially their principal, the Junior pool receives all of the yield earned by the entirety of the capital deposited into that given market.

Now it’s time to learn more about senior and junior tranches, and how they are represented in SMART Yield.

## **Introducing Senior Bonds**

### **Overview**

SMART Yield senior positions are represented by ERC-721 non-fungible tokens (NFTs), which we call senior bonds (sBonds). Senior bonds are minted (created) each time the user deposits into the pool.

Since bonds are unique and contain specific information, each bond NFT has a set of properties:

* `principal`— the amount user has deposited into the bond;
* `gain` — the amount of token that will be gained;
* `issuedAt` — the issuance date;
* `maturesAt` — the maturity date;
* `liquidated` — a flag used to determine if the senior bond was redeemed or not.

After the senior bond matures the principal and gain can be redeemed and the NFT is burned.

### **ABOND**

Each pool can contain an unlimited number of senior and junior positions. In order to calculate the pool profits and losses efficiently, the weighted average across all existing senior bonds is used. This weighted average is represented by the ABOND variable. It has the following properties:

* `ABOND.principal` — sum of all principal deposits;
* `ABOND.gain` — sum of guaranteed rewards to senior bonds holders;
* `ABOND.issuedAt`;
* `ABOND.maturesAt` — weighted average maturity date.

ABOND parameters are recalculated each time a new senior bond is minted.

### **Senior APY**

Senior APY is the annual percentage yield that is available for the next marginal senior bond to be minted. This figure fluctuates in accordance with a rolling average of the underlying interest rate market. When a user deposits into the Senior pool, this is the maximum fixed yield they can expect to lock in. Slippage occurs when the principal size brings the Senior pool size closer to, or greater than, that of the Junior pool.

Here is the simple formula that is used to calculate senior APY:

```
((gain/principal) / (maturesAt - issuedAt)) * 365 * 100
```

## **Introducing Junior Tokens**

### **Overview**

SMART Yield Junior pool positions are represented by ERC-20 fungible tokens, which we call junior tokens (jTokens). Junior tokens are minted each time the user purchases them at a current conversion rate using BarnBridge app.

Each originator’s junior token has its own ticker. For example, USDC in Compound’s pool is called `bb_cUSDC`, where `bb` stands for BarnBridge and `c`is the first letter of the originator’s protocol name.

### **Junior APY**

Junior APY determines the annual percentage yield for the junior tokens at the current time. It is realized only when exiting the position and converting jTokens into the underlying asset.

When the new pool starts, the conversion rate of jTokens is 1:1. For example, if you tried to deposit into the Compound USDC pool, you would get 1 `bb_cUSDC` for each USDC you put in. Going forward, the conversion rate changes with the price of `bb_cUSDC` increasing (as your deposit generates yield) or decreasing (in scenarios where the Junior pool has Senior pool yield obligations).

APY can be calculated as annualized difference between your purchase and your sell (exit) price.

### **Junior Bond**

There are two ways to withdraw Junior pool liquidity. Depending on the method, users are able to either withdraw immediately or after a calculated period of time. In the case of the latter, Junior bonds are ERC-721 non-fungible tokens that are used to represent the unique circumstances of a given user’s exit from the pool.

A Junior bond will have the following properties:

* `tokens` — the amount of jTokens that will be withdrawn;
* `maturesAt` — the date when the bond can be redeemed (determined by the ABOND variable’s maturity date).

In order to exit the junior position using junior bonds, two steps should be initiated. Step one is minting a junior bond token by choosing the 2-step withdrawal option. Step two is redeeming the liquidity at its maturity date.

## **How SMART Yield Works**

Now that we know what sBonds and jTokens are, it’s time to figure out how they work within the system.

Let’s get back to our example with Alice and Bob. They both decided to deposit into the Compound USDC pool on BarnBridge.

![](https://742178816-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MIu3rMElIO-jG68zdaV%2F-MfCckFFn2e60bu4td5u%2F-MfCgDCqJQgAoGhRsE4f%2Fimage.png?alt=media\&token=522b35cb-4030-4b51-b82d-c33d8dcf8517)

Alice wants to purchase a senior bond. She is looking at the senior APY and 6.4% seems like a decent rate of return considering the reward is guaranteed.

[_How to purchase a senior bond?_](smart-yield-faq/how-to-buy-senior-bonds)

She goes to the Deposit page, enters the amount of 100M USDC, selects the maturity date of 1 year, and suddenly sees that the guaranteed APY isn’t so high anymore. It has lowered because there is not enough junior liquidity in the pool to fix a 6.4% return for such a large deposit. However, the rate is still attractive, so she decides to go through with it.

![](https://742178816-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MIu3rMElIO-jG68zdaV%2F-MfCckFFn2e60bu4td5u%2F-MfCgOgkI3N1a9q64A3M%2Fimage.png?alt=media\&token=6d48a77a-057f-4139-bda5-23b2d6f159d7)

Alice now holds an NFT senior bond and is able to track her portfolio growth using the statistics section in the BarnBridge app. She will be able to redeem both her principal and gain at the maturity date. There is currently no formal secondary marketplace for senior bonds but they are totally transferable between Ethereum addresses and BarnBridge core team is working on an additional product for it called SMART FIAT (full details disclosed in a few weeks).

[_How to redeem a senior bond?_](smart-yield-faq/how-to-redeem-senior-bonds)

Bob decides to enter the junior position considering he is going to stake his jTokens in the yield farm and earn an additional 44.73% APY in $BOND tokens.

[_How to buy junior tokens?_](smart-yield-faq/how-to-buy-junior-tokens)

He goes to the Deposit page, inputs the amount of USDC he wants to buy `bb_cUSDC`with, and confirms the transaction. The current conversion rate is 1:1.0329, so each `bb_cUSDC` token will cost 1.0329 USDC.

![](https://742178816-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MIu3rMElIO-jG68zdaV%2F-MfCckFFn2e60bu4td5u%2F-MfChkGmNnpv-k1WWaEK%2Fimage.png?alt=media\&token=fb25fd55-4d85-4958-90c3-60a5223c6523)

Pooled Alice’s and Bob’s liquidity is put into Compound to earn yield. The originator APY represents the Compound native APY.

It’s important to note that BarnBridge uses a 3-day moving average historical APY metric to determine the originator APY. It is an additional protection layer that prevents the system from being manipulated by supply rate spikes. If the spike lasts for more than 3 days, we assume it can be considered as a trend rather than a random spike. This is why the SMART Yield originator APY doesn’t usually match the real originator APY at the current time.

Alice is earning a lower yield than she produces but if the originator APY goes below her guaranteed APY, junior funds will be used to cover her rates. Bob is getting a chance to leverage seniors’ liquidity and earn the extra yield produced by seniors.

![](https://lh6.googleusercontent.com/dhifDlSCU_270Ths-cueiAoWH_MuZWim1eSTFVBdzeoCAQJ8qsxiCavYlUKwkA76up8DIgCGAplNk8ooNPYqyct8o2lOcrzC4DRK9cRv5lWUQinUYY25fWQgI-_GnqM6SttgwMDY)



Bob’s advantage over Alice is that he is able to exit his junior position at any time. However, in order to ensure that there are enough funds in the pool available to supply seniors’ guaranteed gains, there have been two options developed for juniors to withdraw their funds:

1. Instant withdrawal — Bob withdraws his liquidity immediately but forfeits a part of it in favor of seniors. The exact % that needs to be forfeited is calculated at the moment of withdrawal and depends on the amount of senior guaranteed gains. ([_How to instantly withdraw junior tokens?_](https://docs.barnbridge.com/how-to-guides/smart-yield/how-to-withdraw-junior-tokens))
2. 2-step withdrawal through the junior bond — Bob mints a junior bond which contains the amount of tokens he wants to withdraw and seniors average maturity date (ABOND.maturesAt). He will be able to redeem his liquidity at the maturity of the bond similar to how seniors do this. ([_How to withdraw junior tokens with a junior bond?_](../smart-yield-faq/how-to-withdraw-junior-tokens#2-steps-withdraw))

{% hint style="info" %}
Note: The max senior maturity date is subject to change and can be adjusted by the BarnBridge DAO vote. It is currently set to 1 year. If you are considering investing in junior tokens, make sure you understand the risks of being locked for that time in case you don’t want to sacrifice a part of your liquidity with instant withdrawal.
{% endhint %}

Alice has to pay a 5% fee on the senior bond gain at redeem. Bob pays 0.5% fee on the deposit amount each time he enters the junior tranche.

## Is It Secure to Invest in SMART Yield?

Each DeFi protocol is subject to different risks. However, as BarnBridge products are helping users hedge their risks, we are taking it seriously and have always been focused on security.

SMART Yield’s TVL has been as high as $290M+ recently and no hacks or vulnerabilities were found since the product launch 3 months ago. We have also successfully passed security audits from the industry leaders:

* [Open Zeppelin Security Audit](https://blog.openzeppelin.com/barnbridge-smart-yield-bonds-audit/)
* [Hacken Security Audit](https://github.com/BarnBridge/BarnBridge-PM/blob/master/audits/Hacken-Smart%20Yield.pdf)

## **What’s Next?**

We hope this guide was useful for you.&#x20;

If you are interested in learning more, we have an extended version of the guide with some models available here: [SMART Yield PDF Guide](https://drive.google.com/file/d/1sfY_N2xf503m7Gl02rmIoRllVgcBwUWH/view?usp=sharing).

Now it’s time to earn in a SMART way: [Launch app](https://app.barnbridge.com/smart-yield/markets).

Feel free to drop us a message if you have any questions:

* [Discord Community Server](https://discord.gg/barnbridge)
* [pavlo@barnbrige.com](mailto:pavlo@barnbridge.com) or [max@barnbridge.com](mailto:max.fiege@barnbridge.com)
