DeFiCh / DeFiCh/ain

History for Vault Withdraw not correct on tiny amounts

Open
#2,803 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
397
Forks
129
PR merge metrics
No merged PRs in 30d

Description

## Summary
If the amount is really small like 9.3e-07 the withdrawn amount and the info from the history does not match

{"method": "withdrawfromvault", "params": ["591882453d1c682bbc1aaaddaf5b0b3801416e1089386b99581c28f28dbb5bfc", "dTGeTGkayryJFi1tc6ERNnsL7eo4G5CbaZ", "9.3e-07@DUSD", [{"txid": "37153751df5f721636b38af31948978042cae635298f61561c3f1ef792550f37", "vout": 1, "amount": 0.19847125}]], "jsonrpc": "2.0"}

9.3e-07@DUSD vs. 0.00012317 DUSD

{"method": "listaccounthistory", "params": ["dTGeTGkayryJFi1tc6ERNnsL7eo4G5CbaZ", {"depth": 240, "no_rewards": true, "txtype": "J"}], "jsonrpc": "2.0"}
and looking for txid in history

returns 0.00012317@DUSD as amount

![image](https://github.com/DeFiCh/ain/assets/60894942/b8d6d4e7-b8af-4eea-abe0-8c91572d4432)

Defiscan Block Explorer shows correct amount
https://defiscan.live/transactions/37153751df5f721636b38af31948978042cae635298f61561c3f1ef792550f37

## Steps to Reproduce

Take small DUSD loan and look in the history

## Environment

- Node Version: 4.0.8
- Block height on bug if applicable: 3669950
- TX or TX type on bug if applicable: f97e816318da5e86e57408e565ea7a810826df8b7442394a11f3cc4848fd841d
- OS with version: win11

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the tiny-amount case with the withdrawfromvault and listaccounthistory RPC methods using the issue's DUSD values, transaction ID, and block height. Trace how the withdrawal amount is recorded and returned in account history; done means the history reports 9.3e-07 DUSD consistently with the withdrawal and Defiscan.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.