project screenshot 1
project screenshot 2

APY - Ape Predict Yield

Yield Token Compounding Dapp built on top of Element, with an accompanying real-time APY calculator to assess YTC strategies before aping in.

APY - Ape Predict Yield

Created At

HackMoney 2021

Project Description


Yield Token Compounding on Element Finance is a potentially very profitable strategy. However, with the newly launched platform it is not a trivial process to compound yield tokens efficiently from a user experience perspective and it's difficult to assess potential costs and speculate on potential returns.

Doing one cycle of YTC on Element requires the following user actions:

  1. Navigate to earn tab
  2. Click show on the required tranche
  3. Enter the amount of underlying tokens to use
  4. Approve transaction
  5. Submit transaction
  6. Navigate to trade tab
  7. Select Principal Pools
  8. Navigate to sell tab
  9. Hit max on your Principal tokens
  10. Click sell

So to re-cap we are solving for two problems:

  1. Number of user actions required are inefficient. In total one round of yield token compounding requires 10 user actions. So if you wanted to do say 10 rounds of Yield Token Compounding this would require 100 user actions.

  2. It's a relatively complex strategy and there is currently no guidance on expected returns and cost impact in the very new element UI.


  1. Our solution takes a maximum number of 5 user actions for N rounds of YTC. A huge boost in UX and efficiency.

Here are the steps required: i) Select the tranche ii) Enter the amount of underlying tokens iii) Enter the number of yield token compounding cycles you'd like to do iv) Approve transaction v) Ape

  1. We've built in a real-time yield token compounding calculator. This gives users the option to see expected APY and gas costs for their specific strategy ahead of aping in.

What's Unique?

Yield token compounding in and of itself is unique concept brought to the decentralized finance world by Element. To illustrate this I'll run through a quick example of returns from a live tranche available on Element right now.

Alice wants to do 10 cycles of Yield Token Compounding with her 20,000 crvLUSD. Here’s what is possible with current rates on a 6 month term (10.52% variable, 5.26% fixed)

Alice deposits 20,000 crvLUSD

Our APY Dapp does magic

Alice now has 15,211 crvLUSD left over. Alice now has 175,088 eYyvCurveLUSD (yield tokens)

This gives Alice exposure to 8.75x more yield than her initial balance.

If Alice waits 6 months and the variable rate stays relatively consistent…

Alice's net gain is 4430 crvLUSD on 4789 crvLUSd in 6 months. Giving Alice an APR of 92.5% and an APY of 185%! This is all made possible to the broader DeFi yield-seeking community through our efficient YTC DApp.

As we can see with this example, although certainly not guaranteed due to the variable rate & variable gas, this represents an excellent way to compound yield tokens. Using our calculator and simple YTC Dapp, this allows users to quickly access whether or not their strategy is attractive first.

What's in it for the stakeholders of the hackathon?


After less than 1 week of being live on mainnet Element has over $20 million USD (change before pitch) in Total Value Locked. One of the most unique/attractive things about Element is their introduction of fixed yield through their principal tokens. Our YTC Dapp can hopefully shed light on the opportunities their yield tokens present. Simply put, having this YTC Dapp could bring in a new riskier demographic of yield-seeking investors; boosting TVL & fee revenue significantly!


When a user does YTC 10 times, they generate fees for Balancer 10 times. This YTC Dapp along with the rise in demand for Element in general could product a significant amount of fee revenue for Balancer and become a new steady source of revenue in perpetuity!


For only a fraction of people’s USDC holdings they can be exposed to much more yield through USDC-based YTC. A cost-effective and risk mitigated way for USDC holder to earn yield.


Our project is certainly a great new way for DeFi degens to be exposed to a new source of yield through Element's yield token compounding innovation. However, more than that our project is a combination of several DeFi legos to help further scale collaboration & innovation in DeFi.

It combines the power of Element, Circle, Balancer, Yearn and Curve just to start. Over time more and more DeFi legos will be added as Element scales and we hope this could become a main stream strategy for compounding yield in Decentralized Finance!

How it's Made

We used balancer's contracts and element's contract interfaces to write the basic smart contract. Balancer uses solidity v 0.7.0 while some of element's contracts use 0.8.0. Since our contract speaks to both balancer and element, we had to change some of element's contracts to use v0.7.0. Furthermore both balancer and element had their own interface definition for an ERC20. This caused a lot of confusion for the solidity compiler. As a result i needed to remove element's erc20 definition and just use balancer's.

Another issue was that solidity complains if you have more than 16 variables in memory. This was a problem for our contract's compound() method. So I had to refactor the method into multiple smaller methods.

Next, we tried to use element's SDK in our project. However, element's sdk isn't an actual js package yet. As a result, we had to directly copy some of the code and use it in our codebase. There were also other issues because the SDK uses typescript while we were using javascript.

I am very happy that I learnt how to use ethers, hardhat from scratch during the hackathon! I had heard about these tools but never actually used them.

background image mobile

Join the mailing list

Get the latest news and updates