project screenshot 1
project screenshot 2
project screenshot 3

Tenderize.me

Combining Stake based protocols and liquidity pooling to create a liquid staking solution

Tenderize.me

Created At

ETHOnline

Project Description

This project combines staking in protocols such as Livepeer, Keep, The Graph, NuCypher, .. with automated market making to create a liquid staking solution.

Once you've staked with the aforementioned protocols, you will need to wait for an unbonding period to get your tokens back. This can be a long timeframe (e.g. Livepeer 7 days, Keep Network 60 days) during which no rewards are earned, yet the market can move significantly. This poses a risk and large opportunity cost for stakers.

Using our protocol users can stake their funds and receive a derivative token, we call it a TenderToken. TenderTokens represent the underlying stake and rewards earned over time. For example over time 1 tenderToken can be worth 1.50 underlying tokens as rewards are gained in the system. We call this the "share price".

This derivative is an ERC20 token and can be transferred, exchanged, or used as collateral in DeFi protocols. Instead of having to wait for the unbonding period to complete, users could also immediately redeem their funds through the system. Under the hood, Tenderize swaps the derivatives against an automated market making pool back for the underlying token. We use Balancer Smart Pools to create such an AMM.

How it's Made

For each stakeable token in the protocol there is a set of contracts deployed:

  1. A Staker contract that pools tokens and stakes them. It also automatically claims rewards (upon user interaction with the contract when certain thresholds are reached). Some protocols earn rewards in ETH or other tokens that are not the "staked" token as well. We use 1inch to swap these other reward tokens, or ETH, for the staked token. To do so, we use their contract API directly from our staker contract and distribute the order among different exchanges for minimum slippage.

  2. An ERC20 Mintable/Burnable token, called TenderToken, which is a derivative representing the underlying staked tokens, plus rewards. Users receive TenderTokens upon staking their funds in the Staker contract and can use them to redeem their funds plus rewards. This token can be transferred, exchanged or used as collateral in other DeFi protocols. Each TenderToken is worth a varying amount of underlying tokens. This price is called the share price. The share price increases over time as rewards are earned, but could also decrease, for example, when slashing occurs.

  3. A balancer smart pool that holds two tokens: the staked token at a ratio of 90%, and it's "tender token" derivative at a ratio of 10%. This pool allows the Staker contract to swap tender tokens for the staked token when a user chooses to withdraw from the system. It has a trading fee that acts as a performance/exit fee and works as any other AMM. The peg is maintained through arbitrage techniques performed by the Staker contact, or external traders if they see such opportunity. To allow for the Staker contract to maintain the AMM spot price with it's own share price, we created logic that allows the Staker contract to calculate how many tokens it needs to send in a swap to maintain the peg between the spot price and the "share price".

For the front-end, we used React and some components from the Rimble design system created by ConsenSys.

For the development environment, we used Truffle & Ganache and integrated the Tenderize smart contracts with Balancer, 1inch Exchange, Wrapped ETH as well as the different staking protocols (Keep, Livepeer, ...). Combining all of this in a workable and testable development environment was definitely a challenge and required some understanding of each of these protocols and how they are deployed.

We also implemented a formula from the Balancer whitepaper which was not yet implemented in any of their contracts which allows for the calculation of the exact amount of tokens that need to be swapped to move the spot price to a specific target price. This was required to efficienctly capitalise on arbitrage opportunities. https://balancer.finance/whitepaper/#in-given-price

The team met over the ETH Global Discord a few days before the hackathon and varied greatly in coding experience, web3 experience, and background. Working asynchronously and remotely across 4 countries and in several time zones was additionally challenging, but the project was a rewarding experience for all.

background image mobile

Join the mailing list

Get the latest news and updates