raid-guild / RIPs

Registry of internal raidguild improvment projects
24 stars 17 forks source link

Add Moloch v3 Data to Accounting Page #162

Closed ECWireless closed 4 months ago

ECWireless commented 7 months ago

Project Idea

Due to the migration of the RaidGuild DAO from Moloch v2 to Moloch v3, our DungeonMaster accounting page no longer works. In order to easily export and analyze treasury data each quarter, we need to make sure this data can be gathered quickly and automatically. This of course helps in archiving historical data, but it also will help plan and make financial decisions for the future.

Project Submitted By

@ECWireless

Summary

On the DungeonMaster Accounting, data ends near the end of 2023 when we migrated our DAO from Moloch v2 to v3. Unfortunately, because of how the treasury contracts in v3 differs from v2, getting v3 data to display on DungeonMaster is rather difficult.

Migrating the accounting page requires displaying and allowing exports for:

  1. Current balances
  2. Transactions (including all table columns that were there for v2 such as Proposal Title, Token, etc.)
  3. Spoils

On top of these, 1 additional feature should be added:

  1. Adding a filter or tabs to switch between v2 and v3 data (so we don't lose the old data

Why should we build this?

We can't run a DAO without understanding when and where money is entering and leaving. Ideally, a financial report should be made and analyzed every quarter in order to assess what should be done in the upcoming quarters. At the moment, the task of doing this is incredibly laborious at best. It has to be done via custom script, it can't be viewed in realtime on the Accounting page, and--in some case--data has to be gathered by hand. If we want to have good financial hygiene as a DAO, we need a better way of getting and displaying this data automatically.

Resources

Balances

Migrating this will be much more difficult than it might first appears. The current accounting page is here, but none of the v2 subgraphs will work for v3.

You can use the current DAOHaus subgraph for v3 on Gnosis (which is here) for DAO data (such as proposal info), but it will not give you treasury token balances.

As pointed out in DAOHaus' support:

"DAOHaus does not have an equivalent to the v2 subgraph for v3 and no token balances for the main treasury or side vaults are tracked in the subgraph. But all the vaults are gnosis safes so in the DAOHaus UI, they use the Gnosis API to fetch balances."

The @daohaus/moloch-v3-data npm package is a wrapper for this ^. The code for the package is here, so you can either use the package directly, or borrow the code that DAOHaus uses to wrap the Gnosis Safe API in order to interact with the API instead. The first link in this paragraph shows code for querying for token balances by DAO address, but if you want to query by safe address or vault, you can use this code.

Transactions

Getting v3 token balances is just the first difficulty... On top of this, you will also need to find your own way to get all transactions, and to map them to DAO proposals (when applicable). Most likely, you can use the Gnosis Safe API for this, but it needs researched to be certain.

Once these transactions are fetched, you may be able to use the transaction hash to map it to proposals fetched in "DAOHaus subgraph for v3 on Gnosis" mentioned above.

Spoils

Getting spoils is potentially the easiest component. However, it will still involve using a brand new subgraph, which could lead to a few headaches. The v2 spoils are being fetched from here, but the most likely correct subgraph to query for v3 is here.

On the current spoils tab, the spoils payout is also linked to the raid that it came from. This, luckily, shouldn't change at all.

Raid Party Skills Needed

Cost (in USD)

Research - 8 hours Balances tab - 16 hours Transactions tab - 24 hours Spoils tab - 12 hours DAO version tab feature - 8 hours Buffer (since many components of this are in the dark) - 14 hours Member Assistance - 4 hours

Total - 86 hours

\$5,160 ($4,920 for dev; $240 for member assistant)

Bonus

At the completion of this, it is recommended to seek equivalent (or additional) funds from DAOHaus in order to add this to DAOHaus' tooling.

ECWireless commented 4 months ago

Completed thanks to @Seroxdesign @vidvidvid and @growindiedev : https://dm.raidguild.org/accounting

ECWireless commented 4 months ago

Payout distributed via https://app.smartinvoice.xyz/invoice/0x64/0xcab8febd4fE62c3BC31040F396ba2D3F5f8F0725