1

Is there a simple way to get a list of LP-holders for a particular Uniswap/Pancakeswap pair? I need to know the addresses of people who has provided liquidity for my token (which has been already added to UNI/PAN)

Since the Pair contract has only balanceOf() function which is mapping, it's impossible to read the whole list without knowing the mapping keys

The only somehow humane way I think to do this - is to use Infura (or some other node), subscribe to 'Pair.mint()' event and trigger some of my contract functions when this event occurs. But I find this method pretty ugly

Maybe there are some better ways? Thanks

PS. leaving the link to 'Pair' contract of Pancakeswap here, just in case

0

Getting the list of LP token holders is not different from getting a list of any ERC-20 token holders. The LP token is not different from other tokens: it has its own ERC-20 contract, contract address, methods, etc.

The recommended method is to build a database of all ERC-20 Transfer events, keep it updated in real-time and then from this database extract your snapshots.

Here is one generic get ERC-20 token holders answer.

You could also try to solve the problem with TheGraph subquery. You can also construct a Dune Analytics query like this one. In both of these cases, there is a third party that maintains an existing large database with efficient indexing that you can query against.

1
  • 1
    Thanks for the answer! Special thanks for providing the explanation/examples <3
    – fewrandom
    Jul 5 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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