peatio icon indicating copy to clipboard operation
peatio copied to clipboard

Deposit amount in DB is greater than Amount on Blockchain

Open martianatwork opened this issue 3 years ago • 3 comments

If someone deposits a specific amount in USD ex. $5 or $500, In some cases the Blockchain amount will contain many decimals, ex. "0.055796386110991888". In this case the DB amount will appear as "0.0557963861109919". This is not an issue on DB but the collection fails, Which is pain when we have more than 100 active customers.

I will be happy to submit a PR.

martianatwork avatar Jan 25 '21 20:01 martianatwork

what exactly is the problem? i would suggest to either truncate the deposit or round a 4.9999x$ deposit up to 5.

krtschmr avatar Jan 31 '21 18:01 krtschmr

@krtschmr I think you missed the point, system is rounding the amount but it is rounding up instead of rounding down. Amount: 0.58995 Precision: 2

Case "rounding up": Amount: 0.59

Case "rounding down": Amount: 0.58

you see if we round up, the amount will be greater than actual deposit and cause issue on blockchain when collecting as the amount on the blockchain is 0.58995 but in the system amount will be 0.59 and system will try to collect 0.59.

martianatwork avatar Mar 01 '21 16:03 martianatwork

I’ve described this issue in more details and opened PR in #2851

antonDigitalMagic avatar Mar 06 '21 12:03 antonDigitalMagic