Hey guys, any API (or web3 method ,other than iterating through all address ) to get the number of holders of a token in BSC like BSCscan shows.
Jun 21, 2021, 5:13 PM
the accounts in an array or mapping?
Jun 21, 2021, 5:14 PM
I just want to get total number of holders(now is about 100k).
wouldn't it take much time to get that much data back from api (I'm not sure which one )?
wouldn't it take much time to get that much data back from api (I'm not sure which one )?
Jun 21, 2021, 5:18 PM
I'm not 100% sure if using a mapping, as I have never tried to get the number back, but I think it would work same as an array. You can query array[].length +1 and it would give you how many are in that array of accounts. I haven't tried it myself, but it should work.
Maybe someone can correct me if wrong
doesn't take into account balnaces that are zero (0) but you could add that in if you want. But then you get into the iteration thing
Jun 21, 2021, 5:20 PM
How can this data be obtained?I'm not sure about that though
are there any web3 functions ? or any specific api providers who give total number of holders of token .(tried googling, didn't find any )
Jun 21, 2021, 5:22 PM
ah. You might be able to write a function to call that contract and query the array info. But I am not a web3 expert, so you should ask someone that knows better than me on that. I usually build that into my contracts so that it is easy for me to query direct on the chain. SOrry
Jun 21, 2021, 5:24 PM
ohh, thank you
Can anyone answer this ?👆👆
Jun 21, 2021, 5:26 PM
SOrry I couldn't be more help. I actually misread some of your question, haha. Good luck
Jun 21, 2021, 5:26 PM
lol😂
Jun 21, 2021, 5:27 PM
depending on your implementation, I think you can get mapping size or array size by querying the storage. have a look at this.
https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/
Note that you may need archive node to do this (if the queried block is far behind the current one).
https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/
Note that you may need archive node to do this (if the queried block is far behind the current one).
Jun 21, 2021, 5:56 PM
Actually I'm not that familiar with solidity. Someone asked me to get the total number of holders by some method so that they could display it on their token's website.
Also they don't have any access to archive nodes.
Also they don't have any access to archive nodes.
Jun 21, 2021, 6:07 PM
You would have to build this DB by yourself using etherscan/bscscan api and paginating through transfer events
Jun 21, 2021, 6:33 PM
it doesn't need to be archive node if the state you query is within 128 blocks behind the current one.
https://www.quicknode.com/guides/infrastructure/ethereum-full-node-vs-archive-node#:~:text=A%20full%20node%20stores%20the,fast%20Cpu%20with%204%2B%20cores.
https://www.quicknode.com/guides/infrastructure/ethereum-full-node-vs-archive-node#:~:text=A%20full%20node%20stores%20the,fast%20Cpu%20with%204%2B%20cores.
Jun 21, 2021, 6:34 PM
@bigooooff @dimazw thank you guys
Jun 21, 2021, 6:51 PM
The bag? o_O
Jun 21, 2021, 7:24 PM
Code i meant
Jun 21, 2021, 7:27 PM
Could you be more specific? what are you trying to change?
Jun 21, 2021, 7:28 PM
I can not change these two logos
Jun 21, 2021, 7:29 PM
Are you working with the UI kit or directly editing the code? The logo can be changed only with the UI kit.
Jun 21, 2021, 7:30 PM
They are in the ui kit
Jun 21, 2021, 7:30 PM
I forked the file but it did not change no matter how hard I tried. Did you fork it?
Jun 21, 2021, 7:32 PM
are you using UI kit to edit them?
Can someone answer this?
Hi, I'm working on a Pancakeswap clone project, cloned GooseDefi repo for the Exchange/Liquidity part. It was in version 1... I changed the router and factory to version 2. When I add new liquidity its working fine... but the added liqudity is not loading in the list.
Also, the swap is not getting the price of the token from Pancakeswap, it just show "Insufficient liquidity for this trade."
Can anyone help me on this, try to fix for a long time. Solutions required for Getting the LP from Pancakeswap V2.
Hi, I'm working on a Pancakeswap clone project, cloned GooseDefi repo for the Exchange/Liquidity part. It was in version 1... I changed the router and factory to version 2. When I add new liquidity its working fine... but the added liqudity is not loading in the list.
Also, the swap is not getting the price of the token from Pancakeswap, it just show "Insufficient liquidity for this trade."
Can anyone help me on this, try to fix for a long time. Solutions required for Getting the LP from Pancakeswap V2.
Jun 21, 2021, 7:33 PM
Toolkit
Jun 21, 2021, 7:33 PM
you can only do the editing from here: https://www.npmjs.com/
Jun 21, 2021, 7:35 PM
What is this?
I changed the code inside this file but the logo did not change
Jun 21, 2021, 7:37 PM
you should edit frontend no?
it is a svg
Jun 21, 2021, 7:40 PM
Yes it is
Yes
Jun 21, 2021, 7:41 PM
Not only the logo, you can not edit the social links, and few more things without the ui kit
Jun 21, 2021, 7:51 PM
change slippage
Jun 21, 2021, 8:58 PM
If you only need the total number of holders, explorer api is the best option
Jun 21, 2021, 10:16 PM
Any links ?
Jun 22, 2021, 7:43 AM
I was mistaken. What you need is the csv file generated from corresponding block explorer. There is no API access for getting holders
Or running your own node and tracking events on the token contract (would require a lot of resources)
Jun 22, 2021, 7:52 AM
what?
Jun 22, 2021, 8:56 AM
Hey man. So in a group a dev mentioned there's this solidity function to prevent bots from buying. I wanna know if that's true
Btw I love your answers and contributions on OpenZeppelin. You the man
Jun 22, 2021, 8:57 AM
I should see the function body
Jun 22, 2021, 8:59 AM
Yeah I got it now. He just mentioned the function call and not the function definition
Thanks
Jun 22, 2021, 9:00 AM
Oh ok , thanks
Jun 22, 2021, 12:00 PM
you have 2 sames contract
Jun 22, 2021, 1:00 PM
What I should do
New problem found
Jun 22, 2021, 1:05 PM
I think is missing
uint256
uint256
Jun 22, 2021, 1:07 PM
Ok
Same issue
Jun 22, 2021, 1:11 PM
enable optimization
Guys please
Learn to read
Jun 22, 2021, 1:12 PM
I read it but I also have same issue I added the uint256
Jun 22, 2021, 1:13 PM
no you didn't read the warning
Jun 22, 2021, 1:14 PM
Please it best you get someone that can help you.
Jun 22, 2021, 1:14 PM
I appreciate that
And know that he wasting time with us he have work
Jun 22, 2021, 1:15 PM
Alright so what are you encountering
Jun 22, 2021, 1:18 PM
did you add uint256 before?
Jun 22, 2021, 1:26 PM
No
Trying to learn hard to improve myself
Jun 22, 2021, 1:26 PM
why
Jun 22, 2021, 1:26 PM
But I added like u said
Jun 22, 2021, 1:27 PM
how show me
Jun 22, 2021, 1:27 PM
One min
Thanks for helping and listening to us
To holders
Jun 22, 2021, 1:36 PM
You passed in S as an address and the reward is a number, saying "reward per block = 1 address"
Jun 22, 2021, 1:40 PM
Thanks I will learn and also delete pervious help needed messages
Thanks everyone for the help I appreciate it
Jun 22, 2021, 1:46 PM