0

I'm creating a web application for which I want to log transactions specific to a single wallet and a single token on the BSC network.

I would like to do this programmatically by using the bscScan API. Now when I query this API of theirs for requesting transaction history I get the same results as can be seen in the url below (this is the history for a token called Safemoon for my wallet address 0x2ac7809a2a046fb347debc998ed16ec89495ea51): https://bscscan.com/token/0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3?a=0x2ac7809a2a046fb347debc998ed16ec89495ea51

Now if I add and subtract all these transactions, I would conclude that my balance of this Safemoon token should be 1079881822 SAFEMOON.

But I know this is not correct...Because the actual amount of Safemoon that is in my wallet is 2,382,699.325561183 . I know this because both the bscScan wallet overview, as well as metamask say so. Also, when I interact with the Safemoon smart contract by calling the balanceOf function through Web3, it tells me the same amount. So the only thing I can imagine is that there must be one or more significant transactions missing. Does anybody have an idea as to which info is missing here?

1 Answer 1

0

Yeah. There's a separate swap function:

https://bscscan.com/tx/0x23e65276304a7b20c511e539ac350a38978710ae10734cc209af4e2e4be5a15a#eventlog

enter image description here

Which burns the tokens. So the value in your wallet is the sum of the transactions - burn %.

Hence to get the current balance you'll need to manually call the getBalance() function on the contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.