Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/application/handlers/blockHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ ponder.on("OrderDiscoveryPoller:block", async ({ event, context }) => {
buyAmount: orderData.buyAmount.toString(),
feeAmount: orderData.feeAmount.toString(),
validTo: orderData.validTo,
creationDate: BigInt(Number(event.block.timestamp)),
creationDate: event.block.timestamp,
})
.onConflictDoNothing(),
);
Expand Down
11 changes: 5 additions & 6 deletions src/application/helpers/orderbookClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ interface OrderbookOrder {
}

/** Processed composable order stored in cache and returned to callers.
* Shares field types with the discreteOrder schema for the DB-mapped fields.
* creationDate is number here (unix seconds) and converted to bigint at insert time. */
* Shares field types with the discreteOrder schema for the DB-mapped fields. */
export type ComposableOrder = Pick<
typeof discreteOrder.$inferInsert,
"status" | "sellAmount" | "buyAmount" | "feeAmount" | "validTo" | "executedSellAmount" | "executedBuyAmount"
Expand All @@ -56,7 +55,7 @@ export type ComposableOrder = Pick<
generatorId: string;
generatorHash: string;
orderType: OrderType;
creationDate: number;
creationDate: bigint;
};

/** Status + executed amounts returned by fetchOrderStatusByUids. */
Expand Down Expand Up @@ -187,7 +186,7 @@ export async function upsertDiscreteOrders(
buyAmount: order.buyAmount,
feeAmount: order.feeAmount,
validTo: order.validTo,
creationDate: BigInt(order.creationDate),
creationDate: order.creationDate,
executedSellAmount: order.executedSellAmount,
executedBuyAmount: order.executedBuyAmount,
})
Expand Down Expand Up @@ -278,7 +277,7 @@ export async function fetchOrderStatusByUids(
buyAmount: order.buyAmount,
feeAmount: order.feeAmount,
validTo: order.validTo,
creationDate: 0,
creationDate: 0n,
executedSellAmount: order.executedSellAmount,
executedBuyAmount: order.executedBuyAmount,
});
Expand Down Expand Up @@ -473,7 +472,7 @@ async function filterAndProcess(
buyAmount: order.buyAmount,
feeAmount: order.feeAmount,
validTo: order.validTo,
creationDate: Math.floor(new Date(order.creationDate).getTime() / 1000),
creationDate: BigInt(Math.floor(new Date(order.creationDate).getTime() / 1000)),
executedSellAmount: order.executedSellAmount,
executedBuyAmount: order.executedBuyAmount,
});
Expand Down
Loading