Smart Contract Read : Acryptos’ Venus Protocol Strategy

A dive into leverage yield strategies

Published in
5 min readJan 19, 2021


Venus protocol, is a Compound + MakerDAO clone on the Binance Smart Chain (BSC). The protocol has gained around 300million worth of Total value Locked (TvL) in less than 2 months since launch. Making Venus the biggest decentralized finance project within the BSC network.

The Acryptos project is the first to get onboard with building vaults around Venus Protocol. Executing a simple strategy of leveraged yield farming, by borrowing and supplying the same asset to achieve a 3.67x leverage.

A detailed description on the strategy can be found here : Advanced Yield Farming Strategies on Venus Protocol.

As with our previous contract reads, we will attempt to do the same here. We will try to explain the code in a simple way, in the hope that the non-tech audience may understand the strategy contracts they are interacting with a little better.

function() walk through

AcryptoS strategy is powered by the following functions

deposit() is based off typical Acryptos’ cake strategy with leverage rebalance call. This is a relatively standard and safe way of calling this publicly accessible function.


Some relevant internal functions that are called by deposit():

_supplyWant() is based off acryptos’ pancakeswap strategy’s _stakeCake()

_claimXvs() is a Venus protocol specific calls, where XVS is ‘claimed’. The function is called as required and documented within the Venus documentations.

_rebalance() is a comprehensive leverage adjustment function.

Withdrawal functions :

These refer to a number of withdrawal functions. Let’s have a closer look at some important points to note.

  • Only the controller (vault) can call these external functions, withdrawing the tokens back to the vault.
  • Various provisions for fees are coded within, these are in line with acryptos’ pancakeswap strategies.
  • The function calls in a relatively safe way and mimics typical withdrawal functions found within the other strategies.

withdrawAll() functions :

  • typically used for strategy changes or bailing out from the underlying protocol during emergencies.
  • strategist and governance can call withdrawAll(), to get the funds back into Vault.

We see a need to be able to trigger fund extractions to the vault in an emergency (for example, issues within the underlying Venus protocol).

For comparison, the existing Acryptos strategies for pancakeswap allows for this action to be performed only by the Governance. Given that the underlying protocol here is different and of an upgradeable nature, the ability for the Strategist to perform this directly is necessary.

_convertRewardsToWant(). This function is a typical swap function that utilises pancakeswap to swap XVS to the vault’s asset

Some read only functions, these are mostly for information and are common calls.

harvest() — typical function based heavily on the combination of acryptos’ pancakeswap strategy’s harvest() and _payfees(). _rebalance() is called during harvest to stabilise the leverage as well.

Various contract change functions operate through the timelock (governance), common functions.

The strategist will be able to set the borrow limit directly. This is done to keep the leverage balanced.

executeTransaction(), function call included within the contract to bail funds out of underlying asset in the event of Venus Protocol proxy contract changes, where there are no guarantees on how they may change.

Governance, through a time lock, can rescue funds via this function by writing new codes through another contract, a pretty powerful function.

The strategy must be timelocked so to ensure the governance party can’t effect changes maliciously without pre-logging the event on the timelock contract.

//This does not increase user risk. Governance, already controls funds via strategy upgrade, and is behind timelock.


Venus Protocol is a protocol that operates through an upgradable proxy contract, which means building vaults on top of the protocol is a tricky affair. The underlying protocol can be changed, rendering funds stuck permanently in any strategies without built-in failsafes. The various safety features put forward by Acryptos’ Venus strategies, mitigate the risk of the underlying protocol changing or upgrading its proxy contract.

We note that in the design of the strategy, further risk reduction tools were written to enable the strategist to effect changes directly to mitigate borrowing risk without escalating asset risk.

As a whole, the strategy is efficient, allowing it to derive yield at a high borrow limit on the Venus Protocol.

Join Coinmonks Telegram group and learn about crypto trading and investing

Also, Read

Get Best Software Deals Directly In Your Inbox