CRYPTO NEWS

Crypto Market Forecast: Week of October 18th 2021

A curated weekly summary of forward-focused crypto news that matters. This week, Bitcoin surges past the US$60,000 price level as the market prepares for the launch of an ETF, demand for derivatives heats up and Binance launches a US$1 billion growth fund.

How to deal with funds lost to rounding errors in DeFi protocols?

What are the different methods that DeFi protocols use to handle rounding errors? For example say I have an ICO contract that returns 1/1e10 of the ICO token per ETH, so if you deposit 1 ETH(1e18 wei) you should get back 1e8 ICO wei, hence if you deposit less than 1e10 ETH wei you’ll get::Listen

What are the different methods that DeFi protocols use to handle rounding errors? For example say I have an ICO contract that returns 1/1e10 of the ICO token per ETH, so if you deposit 1 ETH(1e18 wei) you should get back 1e8 ICO wei, hence if you deposit less than 1e10 ETH wei you’ll get zero tokens.

My initial thoughts regarding how developers could preempt this would be by requiring at least 1e10 ETH deposited, but even then if the deposit amount is x + y where x >= 1e10 and y < 1e10 you still have a rounding error with y, so the devs preempt this as well by requiring the deposit%1e10 == 0, but this limits all valid amounts that do not have rounding errors that are not a multiple of 1e10 from being deposited. So the devs instead allow all amounts >= 1e10 but find x and y, compute the ICO tokens using x and return y back to the sender.

I’m not certain any of the solutions would work and even if it does it may only be applicable to a subset of DApps, which probably doesn’t include DEX/AMMs or DeFi lending protocols at least not in a gas efficient way. So are there better more universally applicable solutions for dealing with rounding errors?

Crypto Market Forecast: Week of October 18th 2021

Shopping cart
There are no products in the cart!
Continue shopping
0