Skip to content

Commit

Permalink
fix: delete commented code & rename strategy handler
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnigir1 committed Nov 20, 2024
1 parent 338721b commit 9d6a824
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const STRATEGY_NAME = "allov2.DirectGrantsSimpleStrategy";
* - RegisteredWithSender
* - DistributedWithRecipientAddress
*/
export class DirectGrantsSimpleStrategyHandler extends BaseStrategyHandler {
export class DGSimpleStrategyHandler extends BaseStrategyHandler {
constructor(
private readonly chainId: ChainId,
private readonly dependencies: ProcessorDependencies,
Expand Down
8 changes: 3 additions & 5 deletions packages/processors/src/processors/strategy/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Hex } from "viem";
import type { StrategyHandlerConstructor } from "../../internal.js";
import { DirectAllocationStrategyHandler } from "./directAllocation/index.js";
import { DirectGrantsLiteStrategyHandler } from "./directGrantsLite/index.js";
import { DirectGrantsSimpleStrategyHandler } from "./directGrantsSimple/index.js";
import { DGSimpleStrategyHandler } from "./directGrantsSimple/index.js";
import { DVMDDirectTransferStrategyHandler } from "./donationVotingMerkleDistributionDirectTransfer/dvmdDirectTransfer.handler.js";

/**
Expand All @@ -23,10 +23,8 @@ const strategyIdToHandler: Readonly<Record<string, StrategyHandlerConstructor>>
DVMDDirectTransferStrategyHandler, // DonationVotingMerkleDistributionDirectTransferStrategyv2.1
"0x4cd0051913234cdd7d165b208851240d334786d6e5afbb4d0eec203515a9c6f3":
DirectAllocationStrategyHandler,
"0x263cb916541b6fc1fb5543a244829ccdba75264b097726e6ecc3c3cfce824bf5":
DirectGrantsSimpleStrategyHandler,
"0x53fb9d3bce0956ca2db5bb1441f5ca23050cb1973b33789e04a5978acfd9ca93":
DirectGrantsSimpleStrategyHandler,
"0x263cb916541b6fc1fb5543a244829ccdba75264b097726e6ecc3c3cfce824bf5": DGSimpleStrategyHandler,
"0x53fb9d3bce0956ca2db5bb1441f5ca23050cb1973b33789e04a5978acfd9ca93": DGSimpleStrategyHandler,
"0x103732a8e473467a510d4128ee11065262bdd978f0d9dad89ba68f2c56127e27":
DirectGrantsLiteStrategyHandler,
} as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ChainId, ILogger, ProcessorEvent, StrategyEvent } from "@grants-stack-i

import { UnsupportedEventException } from "../../../src/exceptions/index.js";
import { BaseDistributedHandler } from "../../../src/processors/strategy/common/index.js";
import { DirectGrantsSimpleStrategyHandler } from "../../../src/processors/strategy/directGrantsSimple/directGrantsSimple.handler.js";
import { DGSimpleStrategyHandler } from "../../../src/processors/strategy/directGrantsSimple/directGrantsSimple.handler.js";
import {
DGSimpleRegisteredHandler,
DGSimpleTimestampsUpdatedHandler,
Expand Down Expand Up @@ -45,7 +45,7 @@ vi.mock("../../../src/processors/strategy/common/baseDistributed.handler.js", ()
});

describe("DirectGrantsSimpleStrategyHandler", () => {
let handler: DirectGrantsSimpleStrategyHandler;
let handler: DGSimpleStrategyHandler;
let mockMetadataProvider: IMetadataProvider;
let mockRoundRepository: IRoundReadRepository;
let mockProjectRepository: IProjectReadRepository;
Expand All @@ -69,7 +69,7 @@ describe("DirectGrantsSimpleStrategyHandler", () => {
mockPricingProvider = {} as IPricingProvider;
mockApplicationRepository = {} as IApplicationReadRepository;

handler = new DirectGrantsSimpleStrategyHandler(chainId, {
handler = new DGSimpleStrategyHandler(chainId, {
metadataProvider: mockMetadataProvider,
roundRepository: mockRoundRepository,
projectRepository: mockProjectRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,6 @@ import { ChainId, ProcessorEvent } from "@grants-stack-indexer/shared";
import { DGSimpleRegisteredHandler } from "../../../../src/processors/strategy/directGrantsSimple/handlers/registered.handler.js";
import { createMockEvent } from "../../../mocks/index.js";

// function createMockEvent(
// overrides: DeepPartial<ProcessorEvent<"Strategy", "RegisteredWithSender">> = {},
// ): ProcessorEvent<"Strategy", "RegisteredWithSender"> {
// const defaultEvent: ProcessorEvent<"Strategy", "RegisteredWithSender"> = {
// params: {
// recipientId: "0x1234567890123456789012345678901234567890",
// data: "0x0000000000000000000000001234567890123456789012345678901234567890000000000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcd0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003b6261666b72656967796334336366696e786c6e6168713561617773676869626574763675737273376b6b78663776786d7a626a79726f37366977790000000000",
// sender: "0xcBf407C33d68a55CB594Ffc8f4fD1416Bba39DA5",
// },
// eventName: "RegisteredWithSender",
// srcAddress: "0x1234567890123456789012345678901234567890",
// blockNumber: 12345,
// blockTimestamp: 1000000000,
// chainId: 10 as ChainId,
// contractName: "Strategy",
// logIndex: 1,
// transactionFields: {
// hash: "0xd2352acdcd59e312370831ea927d51a1917654697a72434cd905a60897a5bb8b",
// transactionIndex: 6,
// from: "0xcBf407C33d68a55CB594Ffc8f4fD1416Bba39DA5",
// },
// strategyId: "0x9fa6890423649187b1f0e8bf4265f0305ce99523c3d11aa36b35a54617bb0ec0",
// };

// return mergeDeep(defaultEvent, overrides);
// }

describe("DGSimpleRegisteredHandler", () => {
let handler: DGSimpleRegisteredHandler;
let mockRoundRepository: IRoundRepository;
Expand Down

0 comments on commit 9d6a824

Please sign in to comment.