Skip to content

Commit

Permalink
filter for proposal created event
Browse files Browse the repository at this point in the history
  • Loading branch information
DZGoldman committed Sep 13, 2023
1 parent 0823713 commit 77b3b5e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src-ts/proposalStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { BridgeCallTriggeredEventObject } from "../typechain-types/@arbitrum/nit
import { Bridge__factory } from "@arbitrum/sdk/dist/lib/abi/factories/Bridge__factory";
import {
ProposalCreatedEventObject,
ProposalExecutedEventObject,
ProposalQueuedEventObject,
} from "../typechain-types/src/L2ArbitrumGovernor";
import { CallScheduledEventObject } from "../typechain-types/src/ArbitrumTimelock";
Expand Down Expand Up @@ -225,21 +226,23 @@ export class GovernorExecuteStage implements ProposalStage {
}

public async getExecuteReceipt(): Promise<TransactionReceipt> {
// TODO who does the ProposalExecuted filter not accept a string?
// @ts-ignore
const proposalExecutedFilter = this.governor.filters.ProposalExecuted(this.identifier);
const govInterface = GovernorUpgradeable__factory.createInterface();

const proposalExecutedFilter = this.governor.filters.ProposalExecuted();
const provider = getProvider(this.signerOrProvider);

const logs = await provider!.getLogs({
fromBlock: 0,
toBlock: "latest",
...proposalExecutedFilter,
});
if (logs.length !== 1) {
throw new ProposalStageError("Log length not 1", this.identifier, this.name);
for (let log of logs) {
const eventObject = govInterface.parseLog(log).args as unknown as ProposalExecutedEventObject;
if (eventObject.proposalId.toHexString() == this.identifier) {
return await provider!.getTransactionReceipt(log.transactionHash);
}
}

return await provider!.getTransactionReceipt(logs[0].transactionHash);
throw new ProposalStageError("Execution event not found", this.identifier, this.name);
}

public async getExecutionUrl(): Promise<string | undefined> {
Expand Down

0 comments on commit 77b3b5e

Please sign in to comment.