---
# System prepended metadata

title: v3 Subgraph Spec
tags: [v3]

---

---
tags: v3
---

# v3 Subgraph Spec

## Entities

#### baal

#### proposal
proposalId: uint256
prevProposalId: uint256
votingStarts: uint256
votingEnds: uint256
graceEnds: uint256
proposalData: bytes (or string to hold more data)
proposalDataHash: bytes32
expiration: uint256
selfSponsor: bool
details: string
yesVotes: uint256
noVotes: uint256
maxTotalSharesAndLootAtYesVote: uint256
cancelled: bool
processed: bool
passed: bool
actionFailed: bool
sponsor: bytes


proposer: bytes
processor: bytes
createdAt: uint256
sponsoredAt: uint256
processedAt: uint256
cancelledAt: uint256

moloch
escrows
votes


#### proposal escrow
proposal
tributeToken
tributeOffered
released
applicant
safe

questions:
- can add detail in proposal entitity, but will be inconsistent with props submitted without escrow contract
    - sharesRequested
    - lootRequested

#### vote
voteWeight (or balance)
approved

member
proposal

#### member

#### tokens
address
symbol
decimals

questions
- needed for whitelisted tokens for a dao?
- token balances are no longer internal
    - could track here for avatar/dao
    - or sub-balance records 
- prevProposalId
    - needed for processing order?



## Events & mappings

```
event SetupComplete(
    bool lootPaused,
    bool sharesPaused,
    uint32 gracePeriod,
    uint32 votingPeriod,
    uint256 proposalOffering,
    uint256 quorumPercent,
    uint256 sponsorThreshold,
    uint256 minRetentionPercent,
    string name,
    string symbol,
    address[] guildTokens,
    uint256 totalShares,
    uint256 totalLoot
); /*emits after Baal summoning*/
```
- create moloch entity
- loop guildTokens to create token entities

** revist with factory



```
event SubmitProposal(
    uint256 indexed proposal,
    bytes32 indexed proposalDataHash,
    uint256 votingPeriod,
    bytes proposalData,
    uint256 expiration,
    bool selfSponsor,
    uint256 timestamp,
    string details
); /*emits after proposal is submitted*/
```
- create proposal entity

questions
- define level of bucketing prop types
    - decode proposalData?
    - define solid details schema
        - can parse into meaningful fields if we do this
- can we update proposal status equal to proposal states if all time based?
```
    enum ProposalState {
        Unborn, /* 0 - can submit */
        Submitted, /* 1 - can sponsor -> voting */
        Voting, /* 2 - can be cancelled, otherwise proceeds to grace */
        Cancelled, /* 3 - terminal state, counts as processed */
        Grace, /* 4 - proceeds to ready/defeated */
        Ready, /* 5 - can be processed */
        Processed, /* 6 - terminal state */
        Defeated /* 7 - terminal state, yes votes <= no votes, counts as processed */
    }
```
- can't get without decoding
    - shares/loot requested/applicant/tribute/payment/ect...

- add event on tribute contract?
    - can store proposal escrow similar to v2

```
event SponsorProposal(
    address indexed member,
    uint256 indexed proposal,
    uint256 indexed votingStarts
); /*emits after member has sponsored proposal*/

event CancelProposal(uint256 indexed proposal); /*emits when proposal is cancelled*/
```
- update proposal entity


```
event SubmitVote(
    address indexed member,
    uint256 balance,
    uint256 indexed proposal,
    bool indexed approved
); /*emits after vote is submitted on proposal*/
```
- create vote entity
- update proposal


## todo

- baal/v3.1
- factory
    - will play with summonComplete in baal
- poster (or in factory)
- token tracking
    - erc20/721/1155
    - do we need history for charts or let bolton devs handle
- tribute proposal contract
- loot erc20?

- shares erc20 can be transferred outside this contract?

- naming: baal or moloch?


- add transactions
    - entity for polls
    - contectualy transaction hashes for some events for auditing?

## factory notes

looterc20 factory

safe factory

baal factory

ball+safe+loot factory
- see dsm factory
- takes all the things
    - _initializationMultisendData




multisendcontrat per network


function to take all our params
- needs safe/avatar
- needs setup multisend data for share/loot/members
    - _initializationMultisendData
- initial shaman to set those shares?

call setup

poster for metadata



summonBaalAndSafe

- add poster call

summonBaalWithSafe