Into the vDfyn vault: How it differs from other staking vaults?
We recently launched a vDfyn vault that allows the Dfyn community members to stake their $DFYN tokens and earn a share of the protocol fees in return. As anticipated, the vDfyn vault has proved to be a hit amongst the community with over 1350 users staking their Dfyn tokens in the vault. At the time of writing, the vDfyn vault has more than 2.5 million $DFYN tokens, which is approximately 8% of DFYN’s circulating supply.
As many of you might know, the idea for vDfyn vault was inspired by Sushi’s xSushi vault. However, most of the readers might be unaware that vDfyn is actually not a fork of xSushi vault, but is actually an upgraded version to comply with the new proxy contract standards. vDfyn is conceptually similar to xSushi in that you stake your base token in exchange for a representation token that entitles you to a cut of the protocol fees. However, the way this concept is implemented in vDfyn differs from how it is implemented in xSushi and its forks such as dQuick. In this post, we will take a look into how the vDfyn vault varies from its SushiSwap and QuickSwap counterparts.
All swaps in an AMM are facilitated by liquidity pairs. Therefore, the fee is collected in the LP tokens of the assets involved in the swap. The conversion of the LP tokens to Dfyn token involves two steps:
- Breaking the LP into its constituent tokens
- Converting the individual tokens to Dfyn
One method to accomplish step 2 is by directly swapping the constituent tokens for DFYN tokens on the AMM. This is the method that Sushiswap follows to buyback Sushi tokens from the fees. However, this strategy might be a bit tricky since there is no certainty that every token will have a direct pool with DFYN. Even if there is a pool for all tokens with DFYN, there are bound to be pairs that have very low liquidity reserves. In such a scenario, a direct swap will not yield an optimal result since it will cause a significant amount of slippage.
To ensure that we get the most optimal route for converting tokens to DFYN, we use Dfyn’s AMM router contract and path finder algorithm. This way we ensure that the slippage encountered during a swap is minimal and consequently, more DFYN tokens are distributed amongst the vDfyn holders as dividends. Due to the more efficient nature of this approach, we are also able to convert fees into DFYN and direct it into the vault every 8 minutes compared to Sushi which directs the reward once every hour.
Proxy Contract Implementation
With xSushi and its forks, it is not possible to upgrade the vault contracts since they have been deployed without a dedicated proxy architecture. A proxy architecture involves the deployment of two contracts:
- Logic/Implementation Contract — This contract implements the actual protocol logic that users want to interact with.
- Proxy contract — This contract is responsible for listening to users’ message calls and redirecting them to the latest deployed logic contract.
By employing a dedicated proxy architecture, Dfyn retains the option to update the contract in case of any contract vulnerability/bug. It also makes it possible for Dfyn to implement new features in the contract without disturbing the existing state. If at any time in the future, Dfyn needs to upgrade the existing vault implementation, a new version of the logic contract can be deployed, and the proxy can be updated to reference the new logic contract address.
Note: The change in logic contract will not affect your funds/balances since it’s the proxy contract that maintains the state and not the logic contract.
Dfyn follows OpenZeppelin’s latest proxy standard, EIP-1822: Universal Upgradeable Proxy Standard (UUPS), in its implementation of the proxy architecture. UUPS improves upon the existing proxy implementations by (a) making it easier for the developers to deploy and maintain the proxy and logic contracts and (b) facilitating greater transparency by standardizing the methods for verifying the bytecode used by the proxy contract.
One of the key strengths of the DeFi ecosystem is a fluid interchange of ideas. We have learnt a lot over the past year from Uniswap, Sushiswap and others. In a small way, this is our way of contributing to the community and we hope other projects find some of this work useful.
We would like to take the opportunity to once again thank the phenomenal Dfyn community for their dedication, support, patronage and guidance, and invite them to participate in the upcoming vDfyn program. For those who haven’t already used the vDfyn vault, it is live here. By staking DFYN tokens in the vDfyn contract, users can earn APR north of 100%.
Combined with other developments on the DFYN roadmap — expansion into some major chains, institutional trading tools, as well as the associated developments on the Router front, we are excited as we head into Q4; stay tuned for more product updates.
Dfyn is a multi-chain AMM DEX currently functional on the Polygon network. Dfyn nodes on various chains act as liquidity entry and exit points into the cross-chain liquidity super mesh that is being enabled by Router Protocol.
Discord : https://discord.gg/yjM2fUUHvN
Telegram Announcements: https://t.me/dfynofficial