Skip to content

Commit 7391972

Browse files
committed
fix governance
1 parent 9ceca97 commit 7391972

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/templates/governance/governance.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ export const createGovernanceProcessor = ({ from, address }: { from: number; add
7474

7575
const initialize = async (ctx: Context) => {
7676
const pending = await ctx.store.findBy(GovernanceProposal, {
77+
address,
7778
status: GovernanceProposalState.Pending,
7879
})
7980
const active = await ctx.store.findBy(GovernanceProposal, {
81+
address,
8082
status: GovernanceProposalState.Active,
8183
})
8284
pendingProposals.push(...pending)
@@ -152,7 +154,7 @@ export const createGovernanceProcessor = ({ from, address }: { from: number; add
152154
calldatas: data.calldatas,
153155
values: data.values.map((v) => v.toString()),
154156
targets: data.targets,
155-
lastUpdated: new Date(),
157+
lastUpdated: blockTimestamp,
156158
status: GovernanceProposalState.Pending,
157159
events: [],
158160
quorum: await governance.quorum(BigInt(block.header.height - 1)),
@@ -210,6 +212,7 @@ export const createGovernanceProcessor = ({ from, address }: { from: number; add
210212

211213
const _updateProposalStatus = async (ctx: Context, result: IProcessResult, block: Block, proposalId: bigint) => {
212214
const proposal = await _getProposal(ctx, proposalId, result)
215+
proposal.lastUpdated = new Date(block.header.timestamp)
213216
proposal.status = await _getProposalState(ctx, block, proposal.proposalId)
214217
// ctx.log.info({ status: proposal.status }, '_updateProposalStatus')
215218
if (proposal.status === GovernanceProposalState.Pending && !pendingProposals.find((p) => p.id === proposal.id)) {
@@ -228,6 +231,7 @@ export const createGovernanceProcessor = ({ from, address }: { from: number; add
228231
const blockTimestamp = new Date(block.header.timestamp)
229232

230233
const proposal = await _getProposal(ctx, proposalId, result)
234+
proposal.lastUpdated = new Date(block.header.timestamp)
231235
await _updateProposalStatus(ctx, result, block, proposalId)
232236

233237
const proposalTxLog = new GovernanceProposalEvent({
@@ -247,6 +251,7 @@ export const createGovernanceProcessor = ({ from, address }: { from: number; add
247251
const blockTimestamp = new Date(block.header.timestamp)
248252

249253
const proposal = await _getProposal(ctx, proposalId, result)
254+
proposal.lastUpdated = new Date(block.header.timestamp)
250255
proposal.endBlock = extendedDeadline
251256
await _updateProposalStatus(ctx, result, block, proposalId)
252257

@@ -274,6 +279,7 @@ export const createGovernanceProcessor = ({ from, address }: { from: number; add
274279
const blockTimestamp = new Date(block.header.timestamp)
275280

276281
const proposal = await _getProposal(ctx, proposalId, result)
282+
proposal.lastUpdated = new Date(block.header.timestamp)
277283

278284
const voteType = [GovernanceVoteType.Against, GovernanceVoteType.For, GovernanceVoteType.Abstain][
279285
parseInt(support.toString())

0 commit comments

Comments
 (0)