slydev
November 24, 2021, 12:24pm
1
So not sure if this is a bug or I am reading balances wrong but if we look at address:
0xc4caf585c2b7eaf3f61ac69b1529e79f90b15569
Their balance of the token Mithril on the BSC chain can be found with the /balances_v2/ endpoint
https://api.covalenthq.com/v1/56/address/0xb5a2b7409aa016fd68a1bc1c26fb3b68f7a9ee2d/balances_v2/?quote-currency=USD&format=JSON&nft=false&no-nft-fetch=false&key=APIKEY
At time of writing returns: ‘13852812678813092044794’
But when I run the /token_holders/ endpoint:
https://api.covalenthq.com/v1/56/tokens/0xc4caf585c2b7eaf3f61ac69b1529e79f90b15569/token_holders/?quote-currency=USD&format=JSON&block-height=latest&page-number= 1&page-size=10&key=APIKEY
I get a balance of ‘812248382789531844731091’ for the same address
Same balance for the same address on the ‘token_holders_changes’ endpoint
https://api.covalenthq.com/v1/56/tokens/0xc4caf585c2b7eaf3f61ac69b1529e79f90b15569/token_holders_changes/?quote-currency=USD&format=JSON&starting-block=12917230&ending-block=latest&key=APIKEY
I get a balance of ‘812248382789531844731091’ for the same address again
So my question is, is there something with the V2 versions of end points that gives the correct balance that I can find information about? Is there a way I can convert the balance I am being given from the v1 to the correct one? It might have something to do with the token’s reflections? Or am I not using the API correctly?
Thanks for the help, I tried to look for an answer to this question or someone who had the same issue but I couldn’t find anything sorry. The API call is exactly what I need but the balances just aren’t right so if I could get some more clarity that would be super thanks!
Thanks for pointing! I raised a ticket
1 Like
hey,
so the issue is reflection tokens
Binance (BNB) detailed transaction info for txhash 0x51de5c32a1601c4ecde8d31c78d741580862eb38ce17a2b5ad1b887666c7fc7b. The transaction status, block confirmation, gas fee, BNB, and token transfer are shown.
https://api.covalenthq.com/v1/56/tokens/0xc4caf585c2b7eaf3f61ac69b1529e79f90b15569/token_holders/?quote-currency=USD&format=JSON&block-height=12575273&key=ckey_****&page-size=9999
Binance (BNB) detailed transaction info for txhash 0x54ee456458517527cf6ac291f1ded463c605f2f157f5ce5af76f041887b1324b. The transaction status, block confirmation, gas fee, BNB, and token transfer are shown.
https://api.covalenthq.com/v1/56/tokens/0xc4caf585c2b7eaf3f61ac69b1529e79f90b15569/token_holders/?quote-currency=USD&format=JSON&block-height=12575441&key=ckey_****&page-size=9999
https://api.covalenthq.com/v1/56/tokens/0xc4caf585c2b7eaf3f61ac69b1529e79f90b15569/token_holders/?quote-currency=USD&format=JSON&block-height=12575442&key=ckey_****&page-size=9999
The Contract Address 0xc4Caf585c2b7eAF3F61ac69b1529E79F90B15569 page allows users to view the source code, transactions, balances, and analytics for the contract address. Users can also interact and make transactions to the contract directly on...
latest block_height == 12956885
last block where last event occurred: 12575442
12956885 - 12575442 = 381443 block difference
balance diff
Prelude> 1920000000000000000000 - 6864114161334774883
1913135885838665225117
Prelude> 1913135885838665225117 / 1920000000000000000000
0.9964249405409714
quote-calculations
Prelude> 0.03590443 * (1920000000000000000000 / 1e18)
68.9365056
Prelude> 0.03590443 * (6864114161334774883 / 1e18)
0.24645210641765314
Prelude> 1 - 0.24645210641765314/68.9365056
0.9964249405409715
Prelude>
This holder somehow (no transaction or event emitted) lost 99% of its balance between blocks 12956885
and 12575442
So yeah, bottom line, token_holders currently do event-based tracking of token holder balances.
I believe that token_holders_v2 will support this case though.
slydev
November 26, 2021, 1:09am
4
Great thanks, that is the answer I wanted. Just had to know why the balance_v2 was correct and the others were incorrect, makes sense that one version factors that in and the other does not.
Thank you so much
I assume ETA for v2 is quite a while out or unknown for these endpoints?
1 Like
system
Closed
December 16, 2021, 1:10am
5
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.