BirthdayResearch / defichain-app

DeFi Blockchain desktop app for Windows, Linux and Mac.
https://defichain.com
MIT License
156 stars 57 forks source link

Balance in Wallet & Add Liquidity displayed is different #542

Closed tame81 closed 3 years ago

tame81 commented 3 years ago

What happened:

This happened to me a couple of times already for several coin types: When wanting to add liquidity, the balance of the coin I want to use is displayed wrongly, namely too high. I think it happens after I add liquidity once and then when I want to repeat the process, the balance is not updated. Thus the MAX button will use the wrong value.

What you expected to happen:

The balance displayed under the reference currency on the left side (e.g. LTC) should match what is in the wallet page.

How to reproduce it (as minimally and precisely as possible):

I had added liquidity before that day. Then later, I wanted to add some more. The last time it was LTC, so I'll use it in this example. I clicked Liquidity -> LTC-DFI -> Add more. The reference currency on the left side shows a wrong balance (too high), so when using the MAX button, it will enter the wrong amount.

What are your environment parameters?

defichain-bot commented 3 years ago

@tame81: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

In the meantime, you can:

  1. Checkout DeFiChain’s Github issue page to see if your issue has already been reported
  2. Checkout how to an submit issue for DeFi app
  3. Submit any logs if you have them, this will greatly expedite the process for us.
Details I am a bot created to help the [DeFiCh](https://github.com/DeFiCh) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/DeFiCh/app/blob/master/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [DeFiCh/oss-governance-bot](https://github.com/DeFiCh/oss-governance-bot) repository.
izzycsy commented 3 years ago

Hi @tame81 , thanks for your feedback. I would like to further understand your issue, the balance displayed in Wallet & Add Liquidity is different? Or when you click MAX it displays a different balance (too high) compared to the amount displayed in your Wallet?

tame81 commented 3 years ago

Hi @izzycsy, it's the former. The MAX button then uses the same (too high) value.

izzycsy commented 3 years ago

Hi @tame81 , I understand, can update to v2.3.0, this a mandatory update due to node Dakota Upgrade 1.5.0. Please note that you’ll need to reindex from 0%.
 I've seen your comment in https://github.com/DeFiCh/app/issues/544 .

So I'll suggest that you keep a copy of your wallet.dat file. Mac — Go to Folder: 
/Users/<username>/Library/Application Support/DeFi/wallets/wallet.dat

wallet dat location

If after the upgrade to v2.3.0, balance reflected is still different, can you send your app logs please?

tame81 commented 3 years ago

Hi Bella,

I have upgraded and will check once I add liquidity twice - this is when the error occurred.

About posting the logs publicly I am not very keen to be honest as I find it dangerous.

Regards, T

Am Do., 25. Feb. 2021 um 13:38 Uhr schrieb Bella notifications@github.com:

Hi @tame81 https://github.com/tame81 , I understand, can update to v2.3.0 https://github.com/DeFiCh/app/releases/tag/v2.3.0, this a mandatory update due to node Dakota Upgrade 1.5.0. Please note that you’ll need to reindex from 0%. I've seen your comment in #544 https://github.com/DeFiCh/app/issues/544 .

So I'll suggest that you keep a copy of your wallet.dat file. Mac — Go to Folder: /Users//Library/Application Support/DeFi/wallets/wallet.dat

[image: wallet dat location] https://user-images.githubusercontent.com/65014479/109154550-6570c600-77a9-11eb-9a38-e0429caa4c0a.png

If after the upgrade to v2.3.0, balance reflected is still different, can you send your app logs please?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DeFiCh/app/issues/542#issuecomment-785865548, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKLZ3DD35VC2H4H3N6N2VDTAZAFTANCNFSM4YC6QQRA .

izzycsy commented 3 years ago

Hi @tame81 , I understand I'll try to help you from here since we won't be able to further understand your issue with the logs. When you add liquidity, what was the error message shown?

tame81 commented 3 years ago

Hi @izzycsy!

I have updated to v2.3.0 and still have issues:

Problem 1: First time I wanted to add liquidity to the ETH-DFI pair, in the input dialog with the two fields, the wrong ETH balance was displayed. Restarted the procedure with clicking on Liquidity, pair selection and adding more: now the balance was correct.

Problem 2: In the input dialog with the two fields, I can only enter a value into the left element (ETH), the right one (DFI) is not writable. I can use the MAX button on both sides, though.

tame81 commented 3 years ago

Problem 3: I wanted to add liquidity in two steps having a balance of ~4 ETH and ~2600 DFI. Added 2 ETH and 9xx DFI which was successful. Clicked Back To Pool and wanted to add more. The ETH balance is again wrong (4 ETH), the DFI balance is correct (16xx DFI). When clicking the MAX button now on the ETH side, it will take the 4 ETH but display Insufficient balance.

Restarting the process yielded the correct ETH balance after 2 trials.

Screenshot 2021-03-04 at 18 09 26
izzycsy commented 3 years ago

Hi @tame81 , when you click on MAX ETH it equates to 1,916 DFI which is insufficient, then the insufficient balance message, reduce your ETH amount and your tx should get through.

izzycsy commented 3 years ago

Hi @tame81 , update v2.3.2 is out, this is a mandatory update. 
Please read through the release notes before updating.

Do give a thumbs up to this comment if your issue has been resolved, otherwise, please send new information (include screenshots) and app logs. Thank you.

tame81 commented 3 years ago

Hi @izzycsy! I have had some issues with the new Mac app you provided with the link above, one of it can't be run (see screenshot). It's not the regular thing where you allow the app to open via 'Security & Privacy' settings. Clicking the question mark brings up an empty window.

Not working file: https://github.com/DeFiCh/app/releases/download/v2.3.2/DeFi-Wallet-2.3.2-mac.zip

Screenshot 2021-03-23 at 11 01 26 Screenshot 2021-03-23 at 11 10 45

This one is working: https://github.com/DeFiCh/app/releases/download/v2.3.2/DeFi-Wallet-2.3.2.dmg

What is the *mac.zip for, then? If erroneous, please remove it, otherwise it will cause trouble for more people.

v2.3.2 is working now, but the old, parallel v2.3.0 stalls now when launched:

Screenshot 2021-03-23 at 11 31 12
izzycsy commented 3 years ago

Hi @tame81 , you can install using the .dmg format. Thanks for your feedback, we'll look into it. As for the old app v2.3.0 named defi-app, you can delete it. We'll be moving forward with the new DeFi Wallet; as mentioned in the release notes due to the upcoming Dakota Cresent upgrade that's going to happen at block 733,000. If you've updated to v2.3.2, then there should be no issues.

Do give a thumbs up to this comment if your issue has been resolved, otherwise, you may reopen this issue with new information (include screenshots) and app logs. Thank you.

tame81 commented 3 years ago

@izzycsy, it's still not solved, there are my two issues left:

Adding liquidity the first time worked: I added 50 DFI, the BTC was calculated correctly. Second go: Wanted to add 50 more, the BTC is calculated wrongly which results in an insufficient balance error.

Screenshot 2021-03-23 at 11 48 46

When adding liquidity, you can either click the specific liquidity pool and then + ADD MORE or click the + ADD LIQUIDITY button. The difference is that with the first one, the tokens BTC, ETH, LTC are on the left side, with the latter, DFI is on the left. Only the left value can be edited, the right one only accepts the MAX button. This should be fixed as well.

Now with the new app, I have 2 extra addresses which I did not have in v2.3.0. I have to select every time where I want my proceeds from LM to go, which is inconvenient. Apparently these addresses existed before because from the app I see that they are 3 months old as the one address I created myself. Are they internal/legacy only?

They were not displayed in the older app. Can I check that the balance is empty and then remove these two addresses? How? The old app won't start anymore unfortunately so I could double-check.

Screenshot 2021-03-23 at 11 42 20
tame81 commented 3 years ago

@izzycsy: Is the bonus available for bugs that are reported, as it was announced some time ago?

izzycsy commented 3 years ago

The add liquidity function is deliberately designed this way, when you add liquidity, the ratio of the two respective tokens are calculated for you. In your first screenshot, you wanted to add 50DFI and the BTC needed is 0.08980700, which for your case you have an amount under it. So to add the 50DFI, you'll need more BTC.

To your next issue, have extra addresses, in v2.3.2 the app automatically retrieves old address — which you can remove if you're not using them. This was included in the update because we've cases where addresses are missing when users updated / addresses that were not saved. Hence, you can just cancel request and continue using the app.

#4 Receive   Cancel request

To check which address has tokens, you may type in the CLI: listaccounts {} false false true This will give you a breakdown of your tokens on the respective addresses.

What bonus are you referring to? There's no bonuses for bugs reported. If you're technical, feel free to contribute to the DeFi App — find out more here. The purpose of this GitHub Issue page is to address bugs that users face. Although we do test before official release, sometimes new bugs may occur. Thank you for your feedback.

tame81 commented 3 years ago

The add liquidity function is deliberately designed this way, when you add liquidity, the ratio of the two respective tokens are calculated for you. In your first screenshot, you wanted to add 50DFI and the BTC needed is 0.08980700, which for your case you have an amount under it. So to add the 50DFI, you'll need more BTC.

That's what I'm saying, it's calculating wrongly: 50 DFI == 150 USD, 0.089 BTC == 4800 USD.

izzycsy commented 3 years ago

Hi @tame81 , I understand your issue now, can you send your logs please? Thank you.

2 Compress 1 App log
tame81 commented 3 years ago

To your next issue, have extra addresses, in v2.3.2 the app automatically retrieves old address — which you can remove if you're not using them. This was included in the update because we've cases where addresses are missing when users updated / addresses that were not saved. Hence, you can just cancel request and continue using the app.

Don't know where these addresses come from, they were not displayed in the older apps. I'll remove them once I'm sure there's nothing on them. If somebody would send me DFI to a removed address, can it be added again?

To check which address has tokens, you may type in the CLI: listaccounts {} false false true This will give you a breakdown of your tokens on the respective addresses.

It shows only tokens from the address I created (address #1, starting with a "d"), the other addresses starting with "8" are not listed. Would they be listed if there was balance on them?

What bonus are you referring to? There's no bonuses for bugs reported. If you're technical, feel free to contribute to the DeFi App — find out more here. The purpose of this GitHub Issue page is to address bugs that users face. Although we do test before official release, sometimes new bugs may occur. Thank you for your feedback.

I was referring to something I read on a DeFi page, where you'd get a bounty of 50 DFI for real bugs. Can't find the link right now.

izzycsy commented 3 years ago

Yes, you can add the addresses back manually even after it's been removed.

If you're keen on a bounty and you found a security related issue, you can submit a PR for the issue said you managed to resolve. If you've such a case you may send an email to engineering@defichain.com.

tame81 commented 3 years ago

Hi @tame81 , I understand your issue now, can you send your logs please? Thank you.

2 Compress

I'd rather send them to you directly. Please provide an email address for me to send them.

izzycsy commented 3 years ago

Hi @tame81 , sure, you may email to bella@defichain.com.

tame81 commented 3 years ago

Hi @tame81 , sure, you may email to bella@defichain.com.

Just sent them out to you.

izzycsy commented 3 years ago

Hi @tame81 , well received, please give us time to investigate this.

tame81 commented 3 years ago

@izzycsy: Update with v2.3.3:

Changed some DFI to BTC using the DEX, then wanted to add liquidity.

Wallet balance is this:

image

Adding liquidity dialog looks like this:

image
izzycsy commented 3 years ago

Hi @tame81 , noted what is your output of gettokenbalances ?

tame81 commented 3 years ago

gettokenbalances reflects what I see in the Balances tab.

There are two ways to add liquidity to the DFI-BTC pair:

I think the latter calculated correctly, the former had a buggy calculation.

tame81 commented 3 years ago

Here's an observation: When using Liquidity -> + ADD LIQUIDITY the ETH balance is used for BTC, thus resulting in wrong behaviour when using the MAX button. The correct BTC value is used when utilizing the other way to add liquidity.

Hint: It should be possible to enter values on both sides...

image

image

izzycsy commented 3 years ago

Hi @tame81 , thanks the team is investigating this. Thank you for your feedback.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

izzycsy commented 3 years ago

Hi @tame81 , v2.3.4 is out. Please read through the release notes before updating. Is you balance now reflected the same? Thank you.

izzycsy commented 3 years ago

Hi @tame81 , v2.3.5 is out. Please read through the release notes before updating. Do give a thumbs up to this comment if your issue has been resolved, otherwise, please send new information (include screenshots) and app logs. Thank you.