Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Balance change does not match transfer value" ignore statement will ignore "fee base" tokens #13

Open
DenisCarriere opened this issue Feb 8, 2025 · 2 comments

Comments

@DenisCarriere
Copy link

Tokens that deduct a fee when transferring would be entirely ignored by this if statement.

Ex: User A transfers 1.0000 XYZ token to user B, protocol deducts 0.0500 XYZ (as 5% transfer tax), user A deducts 1.0000 XYZ full amount (✅ not ignored), however user B only receive an increase in 0.9500 XYZ tokens (❌ this balance change would be ignored)

if balance_change_abs != transfer_value_abs {
info!("Balance change does not match transfer value. Balance change: {}, transfer value: {}", balance_change_abs, transfer_value_abs);
continue;
}

@maoueh
Copy link
Contributor

maoueh commented Feb 8, 2025

Algorithm #2 seems to deal with that case, trying to gather storage changes with the diff, see https://github.com/streamingfast/substreams-erc20-balance-changes/blob/master/src/maps.rs#L308-L314

Do you have an example that generates a wrong input, we could easily create a unit test for that based on real data.

Overall, agreed they should be handled.

@DenisCarriere
Copy link
Author

The "safemoon" types of tokens have a transfer fee.

Perhaps the current logic is accurate since it's tracking the "value" from the logs and not the "call" itself (which would have a different value from the diff balances vs. value amount)

https://bscscan.com/tx/0x76d98d01c220234ab1ae1f13044ff4c613264a6d6f6e80135bb121910e54ff32

Image Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants