From eed05015a88d6a4fef878367a2ba2b0d57d88f37 Mon Sep 17 00:00:00 2001 From: highonhopium Date: Mon, 12 Aug 2024 16:17:58 +0100 Subject: [PATCH] add and remove order events fix --- subgraph/src/order.ts | 4 ++-- subgraph/tests/order.test.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/subgraph/src/order.ts b/subgraph/src/order.ts index efc55e97a..826a1950b 100644 --- a/subgraph/src/order.ts +++ b/subgraph/src/order.ts @@ -68,7 +68,7 @@ export function createAddOrderEntity(event: AddOrderV2): void { let addOrder = new AddOrder(event.transaction.hash); addOrder.id = eventId(event); addOrder.orderbook = event.address; - addOrder.order = event.params.orderHash; + addOrder.order = makeOrderId(event.address, event.params.orderHash); addOrder.sender = event.params.sender; addOrder.transaction = createTransactionEntity(event); addOrder.save(); @@ -78,7 +78,7 @@ export function createRemoveOrderEntity(event: RemoveOrderV2): void { let removeOrder = new RemoveOrder(event.transaction.hash); removeOrder.id = eventId(event); removeOrder.orderbook = event.address; - removeOrder.order = event.params.orderHash; + removeOrder.order = makeOrderId(event.address, event.params.orderHash); removeOrder.sender = event.params.sender; removeOrder.transaction = createTransactionEntity(event); removeOrder.save(); diff --git a/subgraph/tests/order.test.ts b/subgraph/tests/order.test.ts index 85eee91df..d39b2b984 100644 --- a/subgraph/tests/order.test.ts +++ b/subgraph/tests/order.test.ts @@ -205,11 +205,13 @@ describe("Add and remove orders", () => { let id = eventId(event); + let orderid = makeOrderId(event.address, event.params.orderHash); + assert.fieldEquals( "AddOrder", id.toHexString(), "order", - "0x0987654321098765432109876543210987654321" + orderid.toHexString() ); assert.fieldEquals( @@ -260,11 +262,13 @@ describe("Add and remove orders", () => { let id = eventId(event); + let orderid = makeOrderId(event.address, event.params.orderHash); + assert.fieldEquals( "RemoveOrder", id.toHexString(), "order", - "0x0987654321098765432109876543210987654321" + orderid.toHexString() ); assert.fieldEquals(