Skip to content

Commit

Permalink
Reverse mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
nivcertora committed Jan 5, 2025
1 parent d82e269 commit f54e723
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 17 additions & 1 deletion Quorum/apis/governance/aave_governance.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import requests

from Quorum.utils.chain_enum import Chain
from Quorum.apis.governance.data_models import BGDProposalData, PayloadAddresses

BASE_BGD_CACHE_REPO = 'https://raw.githubusercontent.com/bgd-labs/v3-governance-cache/refs/heads/main/cache'
PROPOSALS_URL = f'{BASE_BGD_CACHE_REPO}/1/0x9AEE0B04504CeF83A65AC3f0e838D0593BCb2BC7/proposals'

CHAIN_ID_TO_CHAIN = {
1: Chain.ETH,
42161: Chain.ARB,
43114: Chain.AVAX,
8453: Chain.BASE,
56: Chain.BSC,
100: Chain.GNO,
10: Chain.OPT,
137: Chain.POLY,
534352: Chain.SCROLL,
324: Chain.ZK,
59144: Chain.LINEA,
}

class AaveGovernanceAPI:
"""
A utility class to interact with the BGD governance cache and retrieve
Expand Down Expand Up @@ -65,5 +81,5 @@ def get_all_payloads_addresses(self, proposal_id: int) -> list[PayloadAddresses]
results = []
for p in data.proposal.payloads:
addresses = self.get_payload_addresses(p.chain, p.payloads_controller, p.payload_id)
results.append(PayloadAddresses(chain=p.chain, addresses=addresses))
results.append(PayloadAddresses(chain=CHAIN_ID_TO_CHAIN[p.chain], addresses=addresses))
return results
4 changes: 3 additions & 1 deletion Quorum/apis/governance/data_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import List, Optional
from pydantic import BaseModel, Field

from Quorum.utils.chain_enum import Chain

class IPFSData(BaseModel):
title: Optional[str] = None
discussions: Optional[str] = None
Expand Down Expand Up @@ -43,5 +45,5 @@ class BGDProposalData(BaseModel):


class PayloadAddresses(BaseModel):
chain: str
chain: Chain
addresses: List[str]

0 comments on commit f54e723

Please sign in to comment.