Skip to content

Commit

Permalink
Merge pull request #769 from rainlanguage/2024-08-12-add-events-sg
Browse files Browse the repository at this point in the history
  • Loading branch information
hardyjosh authored Aug 13, 2024
2 parents 722dd25 + 6bb3b3b commit e1457a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions subgraph/src/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions subgraph/tests/order.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit e1457a2

Please sign in to comment.