Integrating Badger Sett Vaults into Enzyme

An adapter for Enzyme to enable Enzyme Vault Managers to deposit capital into the Badger Sett Vaults


This project enables Enzyme vault managers to deposit funds into the Badger Sett Vaults. An Enzyme vault manager is able to deposit the funds that they are managing into Badger Sett Vaults. They can also withdraw the deposited funds together with any earnings. The solution also has a price feed in order to calculate the values of the current deposited funds (the value of the shares) in the Badger Sett Vaults. This project would not make sense without the context of the Enzyme protocol. Therefore my project is done on top of a fork of the Enzyme Protocol.

Integrating Badger Sett Vaults into Enzyme showcase

How it's made

I created an Enzyme adapter, a price feed, and a Badger Sett Vault wrapper contract to solve this. The one special thing about the solution is the wrapping of the Badger Sett Vaults. This was required due to Badger Sett Vault shares not being transferable in the same transaction as depositing into the vault. In order to transfer the shares, we have to wait for the next block. To mitigate this I created the wrapped Badger Sett Vault Shares that are transferable and are minted and burned 1:1 with the underlying vault. For instance, for the Badger Sett Vault Badger bBADGER shares are returned when depositing, then wbBADGER tokens are minted in the wrapper and sent to the Enzyme vault. When redeeming the wbBAGER tokens are burned and the same amount as returned wbBADGER tokens, bBADGER tokens are redeemed from the Badger Sett Vault and the returned BADGER tokens are transferred to the Enzyme Vault. I also created deployment scripts and some tests. The easiest way to view my work:

Technologies used