Skip to content

Commit

Permalink
fix: build types
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkenj1 committed Nov 28, 2024
1 parent 556ad29 commit da7bbe7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 28 deletions.
12 changes: 6 additions & 6 deletions packages/data-flow/test/unit/eventsRegistry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ describe("InMemoryEventsRegistry", () => {
srcAddress: "0x123",
strategyId: "0xstrategy",
params: {
poolId: 1n,
poolId: "1",
profileId: "0x456",
strategy: "0x789",
token: "0xtoken",
amount: 0n,
metadata: [1n, "0xmetadata"],
amount: "0",
metadata: ["1", "0xmetadata"],
},
transactionFields: {
hash: "0xabc",
Expand All @@ -61,12 +61,12 @@ describe("InMemoryEventsRegistry", () => {
srcAddress: "0x123",
strategyId: "0xstrategy",
params: {
poolId: 1n,
poolId: "1",
profileId: "0x456",
strategy: "0x789",
token: "0xtoken",
amount: 0n,
metadata: [1n, "0xmetadata"],
amount: "0",
metadata: ["1", "0xmetadata"],
},
transactionFields: {
hash: "0xabc",
Expand Down
12 changes: 6 additions & 6 deletions packages/data-flow/test/unit/orchestrator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ describe("Orchestrator", { sequential: true }, () => {
"0x6f9291df02b2664139cec5703c124e4ebce32879c74b6297faa1468aa5ff9ebf" as Hex;
const mockEvent = createMockEvent("Allo", "PoolCreated", 1, {
strategy: strategyAddress,
poolId: 1n,
poolId: "1",
profileId: "0x123",
token: "0x123",
amount: 100n,
metadata: [1n, "1"],
amount: "100",
metadata: ["1", "1"],
});

const eventsProcessorSpy = vi.spyOn(orchestrator["eventsProcessor"], "processEvent");
Expand Down Expand Up @@ -384,11 +384,11 @@ describe("Orchestrator", { sequential: true }, () => {
"0x6f9291df02b2664139cec5703c124e4ebce32879c74b6297faa1468aa5ff9ebf" as Hex;
const poolCreatedEvent = createMockEvent("Allo", "PoolCreated", 1, {
strategy: strategyAddress,
poolId: 1n,
poolId: "1",
profileId: "0x123",
token: "0x123",
amount: 100n,
metadata: [1n, "1"],
amount: "100",
metadata: ["1", "1"],
});
const registeredEvent = createMockEvent(
"Strategy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export class PoolCreatedHandler implements IEventHandler<"Allo", "PoolCreated">
poolId,
token: tokenAddress,
strategy: strategyAddress,
amount: fundedAmount,
amount,
} = this.event.params;
const fundedAmount = BigInt(amount);
const { hash: txHash, from: txFrom } = this.event.transactionFields;
const strategyId = this.event.strategyId;

Expand Down Expand Up @@ -99,7 +100,7 @@ export class PoolCreatedHandler implements IEventHandler<"Allo", "PoolCreated">
// transaction sender
const createdBy = txFrom ?? (await evmProvider.getTransaction(txHash)).from;

const roundRoles = getRoundRoles(poolId);
const roundRoles = getRoundRoles(BigInt(poolId));

const newRound: NewRound = {
chainId: this.chainId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class PoolFundedHandler implements IEventHandler<"Allo", "PoolFunded"> {

async handle(): Promise<Changeset[]> {
const poolId = this.event.params.poolId.toString();
const fundedAmount = this.event.params.amount;
const fundedAmount = BigInt(this.event.params.amount);
const { roundRepository, pricingProvider } = this.dependencies;

const round = await roundRepository.getRoundById(this.chainId, poolId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ function createMockEvent(
srcAddress: "0x1133eA7Af70876e64665ecD07C0A0476d09465a1",
params: {
strategy: "0xD545fbA3f43EcA447CC7FBF41D4A8F0f575F2491",
poolId: 10n,
poolId: "10",
profileId: "0xcc3509068dfb6604965939f100e57dde21e9d764d8ce4b34284bbe9364b1f5ed",
amount: 0n,
amount: "0",
token: "0x4200000000000000000000000000000000000042",
metadata: [1n, "bafkreihrjyu5tney6wia2hmkertc74nzfpsgxw2epvnxm72bxj6ifnd4ku"],
metadata: ["1", "bafkreihrjyu5tney6wia2hmkertc74nzfpsgxw2epvnxm72bxj6ifnd4ku"],
},
transactionFields: {
hash: "0xd2352acdcd59e312370831ea927d51a1917654697a72434cd905a60897a5bb8b",
Expand Down Expand Up @@ -72,7 +72,7 @@ describe("PoolCreatedHandler", () => {
it("process an event with initial funds", async () => {
const fundedAmount = parseUnits("10", 18);
const mockEvent = createMockEvent({
params: { amount: fundedAmount },
params: { amount: fundedAmount.toString() },
strategyId: "0xunknown",
});

Expand Down Expand Up @@ -308,7 +308,7 @@ describe("PoolCreatedHandler", () => {
});

it("throws an error if token price fetch fails", async () => {
const mockEvent = createMockEvent({ params: { amount: 1n }, strategyId: "0xunknown" });
const mockEvent = createMockEvent({ params: { amount: "1" }, strategyId: "0xunknown" });

vi.spyOn(mockMetadataProvider, "getMetadata").mockResolvedValue(undefined);

Expand Down Expand Up @@ -469,7 +469,7 @@ describe("PoolCreatedHandler", () => {
const fundedAmount = parseUnits("10", 18);
const mockEvent = createMockEvent({
params: {
amount: fundedAmount,
amount: fundedAmount.toString(),
token: "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE",
},
strategyId: "0xunknown",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function createMockEvent(
logIndex: 123,
srcAddress: "0x1133eA7Af70876e64665ecD07C0A0476d09465a1",
params: {
poolId: 1n,
amount: 100n,
fee: 10n,
poolId: "1",
amount: "100",
fee: "10",
},
transactionFields: {
hash: "0xtransactionhash",
Expand Down Expand Up @@ -101,9 +101,9 @@ describe("PoolFundedHandler", () => {
args: {
chainId: 10,
roundId: "1",
fundedAmount: mockEvent.params.amount,
fundedAmount: BigInt(mockEvent.params.amount),
fundedAmountInUsd: calculateAmountInUsd(
mockEvent.params.amount,
BigInt(mockEvent.params.amount),
mockPrice.priceUsd,
mockToken?.decimals as number,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function createMockEvent(
logIndex: 456,
srcAddress: "0x1133eA7Af70876e64665ecD07C0A0476d09465a1",
params: {
poolId: 1n,
metadata: [1n, "bafkreihrjyu5tney6wia2hmkertc74nzfpsgxw2epvnxm72bxj6ifnd4ku"],
poolId: "1",
metadata: ["1", "bafkreihrjyu5tney6wia2hmkertc74nzfpsgxw2epvnxm72bxj6ifnd4ku"],
},
transactionFields: {
hash: "0xtransactionhash",
Expand Down

0 comments on commit da7bbe7

Please sign in to comment.