Skip to content

Commit

Permalink
rmeove the breach event
Browse files Browse the repository at this point in the history
  • Loading branch information
moodysalem committed Jun 14, 2024
1 parent 1be47da commit 155243d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 64 deletions.
18 changes: 0 additions & 18 deletions src/EVENT_PROCESSORS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ import {
DescribedEvent,
GovernorReconfiguredEvent,
GovernorCanceledEvent,
GovernorCreationThresholdBreached,
GovernorExecutedEvent,
GovernorProposedEvent,
GovernorVotedEvent,
parseDescribedEvent,
parseGovernorCanceledEvent,
parseGovernorCreationThresholdBreached,
parseGovernorExecutedEvent,
parseGovernorProposedEvent,
parseGovernorVotedEvent,
Expand Down Expand Up @@ -368,22 +366,6 @@ export const EVENT_PROCESSORS = [
await dao.insertGovernorCanceledEvent(parsed, key);
},
},
<EventProcessor<GovernorCreationThresholdBreached>>{
filter: {
fromAddress: FieldElement.fromBigInt(process.env.GOVERNOR_ADDRESS),
keys: [
// CreationThresholdBreached
FieldElement.fromBigInt(
0xda0eb1cb71bdbfac21648d8b87024714f7eb6207978c7eb359a20144a99bafn
),
],
},
parser: parseGovernorCreationThresholdBreached,
async handle(dao, { parsed, key }): Promise<void> {
logger.debug("GovernorCreationThresholdBreached", { parsed, key });
await dao.insertGovernorCreationThresholdBreachedEvent(parsed, key);
},
},
<EventProcessor<GovernorVotedEvent>>{
filter: {
fromAddress: FieldElement.fromBigInt(process.env.GOVERNOR_ADDRESS),
Expand Down
38 changes: 0 additions & 38 deletions src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { StakedEvent, WithdrawnEvent } from "./events/staker";
import {
DescribedEvent,
GovernorCanceledEvent,
GovernorCreationThresholdBreached,
GovernorExecutedEvent,
GovernorProposedEvent,
GovernorReconfiguredEvent,
Expand Down Expand Up @@ -367,12 +366,6 @@ export class DAO {
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_governor_canceled_id ON governor_canceled USING btree (id);
CREATE TABLE IF NOT EXISTS governor_creation_threshold_breached
(
governor_canceled_event_id int8 REFERENCES governor_canceled (id) ON DELETE CASCADE PRIMARY KEY,
breach_timestamp timestamptz NOT NULL
);
CREATE TABLE IF NOT EXISTS governor_voted
(
event_id int8 REFERENCES event_keys (id) ON DELETE CASCADE PRIMARY KEY,
Expand Down Expand Up @@ -1676,37 +1669,6 @@ export class DAO {
});
}

async insertGovernorCreationThresholdBreachedEvent(
parsed: GovernorCreationThresholdBreached,
key: EventKey
) {
await this.pg.query({
text: `
WITH inserted_event AS (
INSERT INTO event_keys (block_number, transaction_index, event_index, transaction_hash)
VALUES ($1, $2, $3, $4)
RETURNING id),
inserted_governor_canceled AS (
INSERT
INTO governor_canceled
(event_id, id)
VALUES ((SELECT id FROM inserted_event), $5))
INSERT
INTO governor_creation_threshold_breached
(governor_canceled_event_id, breach_timestamp)
VALUES ((SELECT id FROM inserted_event), $6)
`,
values: [
key.blockNumber,
key.transactionIndex,
key.eventIndex,
key.transactionHash,
parsed.id,
new Date(Number(parsed.breach_timestamp * 1000n)),
],
});
}

async insertGovernorProposalDescribedEvent(
parsed: DescribedEvent,
key: EventKey
Expand Down
8 changes: 0 additions & 8 deletions src/events/governor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ export type GovernorCanceledEvent = GetParserType<
typeof parseGovernorCanceledEvent
>;

export const parseGovernorCreationThresholdBreached = combineParsers({
id: { index: 0, parser: parseFelt252 },
breach_timestamp: { index: 0, parser: parseU64 },
});
export type GovernorCreationThresholdBreached = GetParserType<
typeof parseGovernorCreationThresholdBreached
>;

export const parseGovernorExecutedEvent = combineParsers({
id: { index: 0, parser: parseFelt252 },
result_data: { index: 1, parser: parseSpanOf(parseSpanOf(parseFelt252)) },
Expand Down

0 comments on commit 155243d

Please sign in to comment.