ethereum_block_scanner.go
The convertAmount function in the ETHScanner class is used to adjust the token amounts based on their respective decimals. However, this function has a significant issue when dealing with transactions involving multiple tokens with different decimal places. The function always normalizes token amounts to a fixed decimal (18 decimals), which may not reflect the true decimals of all tokens involved in the transaction. This one-size-fits-all approach can result in incorrect token amount calculations, potentially leading to significant financial discrepancies and loss when executing transactions that involve multiple tokens with varying decimals.
Code snippet:
Expected Behavior: The function should handle token amounts based on the actual decimals of each token involved in a transaction. This requires dynamically adjusting the scaling based on each tokens metadata rather than assuming a fixed decimal scale for all tokens. This approach ensures that the token amounts are correctly represented and calculated, preventing errors in transactions that involve tokens with non-standard decimals.
Expected Behavior code snippet:
Logic:
Actual Behavior: The function currently uses a fixed decimal normalization (18 decimals) for all tokens, which can result in incorrect token amount calculations for tokens with decimals that differ from this standard.
Actual Behavior code snippet:
Logic:
