Skip to content

Commit

Permalink
fix: track non-native ask
Browse files Browse the repository at this point in the history
  • Loading branch information
HungLV46 committed Jul 8, 2024
1 parent 16463e5 commit d0b2be9
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions packages/indexer/src/orderbook/orders/zora/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,44 +96,46 @@ export const save = async (orderInfos: OrderInfo[]): Promise<SaveResult[]> => {
);

// Check: sell order has Eth as payment token
if (orderParams.askCurrency !== Sdk.Common.Addresses.Native[config.chainId]) {
if (!orderResult) {
return results.push({
id,
status: "unsupported-payment-token",
});
} else {
// If the order already exists set its fillability status as cancelled
// See https://github.com/reservoirprotocol/indexer/pull/1903/files#r976148340
await idb.none(
`
UPDATE orders SET
fillability_status = $/fillabilityStatus/,
expiration = to_timestamp(${orderParams.txTimestamp}),
updated_at = now(),
block_number = $/blockNumber/,
log_index = $/logIndex/
WHERE orders.id = $/id/
`,
{
fillabilityStatus: "cancelled",
id,
blockNumber: orderParams.txBlock,
logIndex: orderParams.logIndex,
}
);
// I don't really understand why this logic block is placed here.
// just comment out for tracking order with non-native token
// if (orderParams.askCurrency !== Sdk.Common.Addresses.Native[config.chainId]) {
// if (!orderResult) {
// return results.push({
// id,
// status: "unsupported-payment-token",
// });
// } else {
// // If the order already exists set its fillability status as cancelled
// // See https://github.com/reservoirprotocol/indexer/pull/1903/files#r976148340
// await idb.none(
// `
// UPDATE orders SET
// fillability_status = $/fillabilityStatus/,
// expiration = to_timestamp(${orderParams.txTimestamp}),
// updated_at = now(),
// block_number = $/blockNumber/,
// log_index = $/logIndex/
// WHERE orders.id = $/id/
// `,
// {
// fillabilityStatus: "cancelled",
// id,
// blockNumber: orderParams.txBlock,
// logIndex: orderParams.logIndex,
// }
// );

return results.push({
id,
status: "success",
triggerKind: "cancel",
txHash: orderParams.txHash,
txTimestamp: orderParams.txTimestamp,
logIndex: orderParams.logIndex,
batchIndex: orderParams.batchIndex,
});
}
}
// return results.push({
// id,
// status: "success",
// triggerKind: "cancel",
// txHash: orderParams.txHash,
// txTimestamp: orderParams.txTimestamp,
// logIndex: orderParams.logIndex,
// batchIndex: orderParams.batchIndex,
// });
// }
// }

// Check: order fillability
let fillabilityStatus = "fillable";
Expand Down

0 comments on commit d0b2be9

Please sign in to comment.