Skip to content

Commit

Permalink
Added more fields to daostack proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddavo committed Dec 15, 2022
1 parent 29463e6 commit 079fee7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions cache_scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.1.7 - 2022-12-13
- Obtaining more fields from DAOstack proposals
- queuedVotePeriodLimit
- boostedVotePeriodLimit

## 1.1.6 - 2022-10-22
- Obtaining more time fields from DAOstack proposals

Expand Down
2 changes: 1 addition & 1 deletion cache_scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.6"
__version__ = "1.1.7"
19 changes: 16 additions & 3 deletions cache_scripts/daostack/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,24 @@ def __init__(self, runner, network: str, daoC: DaosCollector):
def changeColumnNames(df: pd.DataFrame) -> pd.DataFrame:
return df.rename(columns={
'daoId': 'dao',
'genesisProtocolParamsQueuedVoteRequiredPercentage': 'queuedVoteRequiredPercentage'
})
}).rename(columns=self._stripGenesis)

@self.postprocessor
def deleteColums(df: pd.DataFrame) -> pd.DataFrame:
return df.drop(columns=['competition'], errors='ignore')

self.postprocessors.append(_remove_phantom_daos_wr(daoC))

@staticmethod
def _stripGenesis(s: str):
tostrip='genesisProtocolParams'

if s and len(s) > 1 and s.startswith(tostrip):
s = s[len(tostrip):]
return s[0].lower() + s[1:]
else:
return s

def query(self, **kwargs) -> DSLField:
ds = self.schema
return ds.Query.proposals(**kwargs).select(
Expand All @@ -112,7 +121,11 @@ def query(self, **kwargs) -> DSLField:
ds.Proposal.winningOutcome,
ds.Proposal.stakesFor,
ds.Proposal.stakesAgainst,
ds.Proposal.genesisProtocolParams.select(ds.GenesisProtocolParam.queuedVoteRequiredPercentage),
ds.Proposal.genesisProtocolParams.select(
ds.GenesisProtocolParam.queuedVoteRequiredPercentage,
ds.GenesisProtocolParam.queuedVotePeriodLimit,
ds.GenesisProtocolParam.boostedVotePeriodLimit,
),
ds.Proposal.dao.select(ds.DAO.id),
ds.Proposal.competition.select(ds.CompetitionProposal.id)
)
Expand Down

0 comments on commit 079fee7

Please sign in to comment.