harmony-one / explorer-v2-frontend

19 stars 23 forks source link

Fixed gas used treated as hex but is decimal. #91

Closed Severino closed 2 years ago

Severino commented 2 years ago

@murryarc pointed out on telegram that the values of gasUsed from hmyv2_getTransactionReceipt and hmy_getTransactionReceipt differ.

after some investigation it seems that; hmyv2_getTransactionReceipt returns gasUsed as decimal hmy_getTransactionReceipt returns gasUsed as hexadecimal

The explorer transformed the decimal one with the hex base, leading to an error in the gasUsed and the resulting transactionFee calculated.

I created an example here: 0x5733742fdea3cd698f2c297717cf5ca60aac7753bf29226b11180ff28e9f91ac

  1. A new wallet got funded with 1 one
  2. Sending 0.9 one back to the funding wallet
  3. TX cost shown in current version: 0.00270336
  4. remaining funds in wallet: 0.099580
  5. Actual cost: 0.1 - 0.099580 = 0.0004200000000000037

This PR fixes this issue.