Optimizing Gas Costs For the Crypto Volatility Index: How We Have Managed to Reduce Up to 50% Of Costs

CVI
3 min readFeb 28, 2021

As we continue to develop the CVI trading platform, we are happy to present another ticked milestone in the CVI Roadmap: Gas Optimization

Gas Costs are a major concern in ETH based on-chain applications, especially with the recent surge in gas prices.

We are proud to announce that we succeeded to cut down up to 50% of gas costs with our optimized code.

While the entire ecosystem waits for Ethereum to improve congestion, we have actively improved our contracts to reach lower gas costs by usage data evaluation. We have improved our Solidity code by reducing our digital footprint as well as the number of contracts and operations by reusing the code. This is performed by minimizing calls and updates related to persistent storage, which are the most costly parts of the contract.

Here are some optimization benchmarks:

  • Since the previous operation of open position, the gas has dropped down by 42%
  • Since the previous operation of close position, the gas has dropped down by 37%
  • Since the previous operation of providing liquidity, the gas has dropped down by 36%
  • Since the previous operation of Withdrawing liquidity, the gas has dropped down by 36%

Additional optimization achieved within the $GOVI rewards mechanism contracts:

Everytime a trader opens a new position or adds liquidity to a position, a $GOVI amount based on the position’s size will be made available for claiming. This amount will be both proportional to his position amount and bound to a predetermined limit per open position action. There will be a daily limit on the amount of $GOVI that can be claimed by traders. This limit will be adjusted periodically according to a thorough analysis. The $GOVI can be claimed as early as a day after the most recent open position operation. An early claim will carry a penalty for the trader during the first 3 days (adjustable). Moreover, claiming the rewards will only be possible within a predefined period of 30 days (adjustable) from his last open position operation. All the traders’ claimable rewards connected (or assigned) to a specific address will have to be claimed at the same time.

This straightforward implementation will be more gas-efficient and should make the trader’s experience simpler by allowing him to try and claim his $GOVI after performing the open position action. Any reward from the original version should be claimable during the originally predefined period.

Additional information about the $GOVI rewards mechanism will be shared in an upcoming article.

The Gas optimization model has now been implemented to the benefit of all CVI users. We are expecting the gas to further improve with our upcoming support for the Ethereum option inclusion in our platform.

We believe that such improvements will attract a wider CVI platform adoption as well as make it more useful to everyone.

We continue to develop and will push out further upgrades during the next 2 weeks, stay tuned!

For all of our updates and to join the conversation, be sure to check out CVI channels:

Website: https://cvi.finance

Whitepaper: https://cvi.finance/files/cvi-white-paper.pdf

Twitter: https://twitter.com/official_CVI

Telegram (group): https://t.me/cviofficial

Telegram (channel): https://t.me/cvichannel

--

--

CVI

CVI is a decentralized volatility index for the crypto space