Skip to content

Commit

Permalink
feat: gas rebates october 2024 (#4791)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Maldonado <[email protected]>
  • Loading branch information
md0x authored Nov 6, 2024
1 parent c8ade06 commit 0ec536d
Show file tree
Hide file tree
Showing 2 changed files with 557 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/affiliates/gas-rebate/VoterGasRebateV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import hre from "hardhat";
const { ethers } = hre as any;
import { BigNumber } from "ethers";
import moment from "moment";
import { findBlockNumberAtTimestamp, getWeb3 } from "@uma/common";
import { findBlockNumberAtTimestamp, getWeb3, paginatedEventQuery } from "@uma/common";
import fs from "fs";
import path from "path";

Expand Down Expand Up @@ -44,8 +44,17 @@ export async function run(): Promise<void> {

// Fetch all commit and reveal events.
const voting = await ethers.getContractAt("VotingV2", await getAddress("VotingV2", 1));
const commitEvents = await voting.queryFilter(voting.filters.VoteCommitted(), fromBlock, toBlock);
const revealEvents = await voting.queryFilter(voting.filters.VoteRevealed(), fromBlock, toBlock);

const searchConfig = {
fromBlock,
toBlock,
maxBlockLookBack: 20000,
};

// Find resolved events
const commitEvents = await paginatedEventQuery<any>(voting, voting.filters.VoteCommitted(), searchConfig);

const revealEvents = await paginatedEventQuery<any>(voting, voting.filters.VoteRevealed(), searchConfig);

// For each event find the associated transaction. We want to refund all transactions that were sent by voters.
// Function to process events sequentially
Expand Down
Loading

0 comments on commit 0ec536d

Please sign in to comment.