IndexCoop / index-coop-analytics

A repository for the Analytics Working Group.
MIT License
22 stars 18 forks source link

High Priority - Medium Complexity - Governance Power Analysis #85

Closed jackiep00 closed 2 years ago

jackiep00 commented 3 years ago

Initial request:

""" Something has come up as high priority. Was low for TWG but BD has expressed a more urgent need for this data. We now consider this to be a high priority.

The challenge - create an interactive pie chart showing the INDEX token distribution. This will need to accurately capture VC, Set Labs, DFP, Full Time contributors (as a block), community non FT (as a block) and LP positions.

FT and Contributors, we have wallet address for this. We capture everything in a top level pie chart and then break out sub sections like Contributors into there own pie chart to show the distribution in more granular detail.

LP positions will be harder, but I'm sure we can work it out together.

We will do this exercise for the actual token distribution and then later on we will tackle this from a governance delegation voting perspective.

Deliverables for INDEX token:

A series of pie charts. A top 20 holder table.

"""

The main ask is to establish what the voting power is for each address, classify the addresses, and then report it. The specific address classification list will probably not be public.

There's an existing governance python script created by Craig, who's not free to help us out with it, but likely can onboard us. It's unclear if the python script has the components of what we need, but it's a good starting point.

Other research: We looked into using IndexPowah, which is a fake erc20 token used to calculate voting power for Snapshot. However, since the only function it has is balanceOf, we can't use Dune to track it over time. Dune erc20 balances are dependent on the usage of transfer().

ericlinML commented 3 years ago

How does voting power work esp if people can delegate their votes? Is this more about who is holding INDEX tokens and how much theyr'e holding?

I looked at Craig's scripts and it doesn't seem to differentiate between wallet addresses / tell much about who is behind the wallet address (no scraping of contract names etc). He also manually excluded LP positions. So his script seems useful to the degree you can generate a CSV with all INDEX holding wallets and how much they hold. Not sure yet about how to determine who holds the tokens at Set, DFP, and LPs.

Also, FYI (hopefully I'm not the only one who didn't know this already), this does exist (top 25 addresses piechart on etherscan): https://etherscan.io/token/tokenholderchart/0x0954906da0Bf32d5479e25f46056d22f08464cab?range=25

jackiep00 commented 3 years ago

So there's a few things here -

  1. Thanks so much for looking through Craig's scripts! I hadn't the time to dig through them yet, and your comments are helpful. That actually might change our direction.
  2. We actually want to include LPs, because LP positions get included in IndexPowah. Here's the link to the IndexPowah contract logic, which more and more it seems like we'll have to replicate somehow: https://github.com/SetProtocol/index-coop-smart-contracts/blob/master/contracts/token/IndexPowah.sol
  3. Delegating is always temporary, so we care less about who is holding delegated votes and more about who controls those votes
  4. I have a list of tagged wallets that I do not want to publish on the repo since that's kind of sensitive
  5. That feature is actually pretty cool. Unfortunately, if you notice, most of those tokens are locked up in vesting contracts, which makes sense. In this case, what we want to do is get a pulse on who has active voting power and can influence IIPs, so we want to actually exclude those.
ericlinML commented 3 years ago

I'm trying to build a scraper for Etherscan, but it's not meant to be scraped repeatedly and has several measures in place to prevent repeated scraping of the same address. I've had success in scraping the top 20 holders' addresses Name Tags and Token Trackers. In cases without Public Name Tags, I've been trying to recursively look through the contract creator and grab the top most level's Public Name Tag. Still a noob at webscraping though and working things out.

I have to admit I'm still working through CryptoZombies lvl 1

jackiep00 commented 3 years ago

Yeah I don’t think you should try and sink too much effort into scraping public APIs like that, I don’t know if it’s really worth it. We generally want production-ready sources of on-chain data. I think the right move is to duplicate the IndexPowah logic on Dune

On Thu, Aug 12, 2021 at 11:44 AM Eric L @.***> wrote:

I'm trying to build a scraper for Etherscan, but it's not meant to be scraped repeatedly and has several measures in place to prevent repeated scraping of the same address. I've had success in scraping the top 20 holders' addresses Name Tags and Token Trackers. In cases without Public Name Tags, I've been trying to recursively look through the contract creator and grab the top most level's Public Name Tag. Still a noob at webscraping though and working things out

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SetProtocol/index-coop-analytics/issues/85#issuecomment-897747783, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGAGRSSDYYMYGWQ7ERK7KTT4PT6DANCNFSM5B5BZARQ .

ericlinML commented 3 years ago

I had some conversations with jackiep00 about my progress (he's up to date on what I've done so far), but I'll just say that I was able to get CSVs for the excluded wallets list that Craig had previously identified (mostly contains a lot of Index Coop contracts and big LPs), the top 20 holders of INDEX outside of this list, and then did a series of CSVs with the top holders holding >10k INDEX, > 1k INDEX, and >500 INDEX (last group is n=257 wallets which mostly consist of unidentifiable addresses and would capture 90% of all distributed INDEX tokens). For each address, I was able to scrape (when available) the INDEX balance, address' name tag on Etherscan (ie Uniswap INDEX/ETH LP), token type (another indicator for LP tokens), and recursively search, if the address was a contract or had a creator, for the top level address creator's Name Tag.

I could also try a few other metrics quite easily with the Etherscan API like getting how much ETH an address holds, but the Etherscan API is limited in what you can easily ascertain about an address. What I did above was just straight web-scraping, but Etherscan does quite a lot to limit webscraping and it became difficult to scrape more than a couple hundred addresses at a time before one gets significantly throttl;ed in scraping.

I've withheld the work and the CSVs from the public view given privacy concerns.

If anyone has any other thoughts, please let me know. I think Dune Analytics would be preferable, but if we wanted a short term solution, this is also some-what rerunnable (requires a decent amount to babysit the script given limitations on webscraping).

ripples3 commented 3 years ago

Started working on the Dune Analytics side of this.

jackiep00 commented 3 years ago

This task is actually two tasks:

  1. High priority - get the INDEX token distribution, trace LP ownership back to original addresses, don't trace unclaimed INDEX in staking contracts back to claimable addresses
  2. Low priority - Get the formal governance power, which includes the claimable addresses & vesting contracts
ericlinML commented 3 years ago

@ripples3 if there's any utility in my CSVs (perhaps having another list to cross reference), let me know. I don't grasp what can / can't be done from the Dune Analytics side of things.

jackiep00 commented 3 years ago

@ripples3 if there's any utility in my CSVs (perhaps having another list to cross reference), let me know. I don't grasp what can / can't be done from the Dune Analytics side of things.

Sorry for low responsiveness! yeah we ended up duplicating the logic here: https://dune.xyz/emesrever/Index-Coop-Governance-Token-Distribution

We're still actively working on the actual governance part of things.

ericlinML commented 3 years ago

Okay! I'm glad it worked out. As I had told @jackiep00 before, I'm going to be cramming for a significant licensing exam in the next 2 weeks, so I'm not going to be available to contribute for some time. I'll let you know when I'm back

jackiep00 commented 2 years ago

ahhh lemme open up a PR with Don's work on this to close it