Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing cancelled logic for transferred orders #2369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions indexer/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ enum OrderStatus @entity {
open
sold
cancelled
transferred
}

enum WearableCategory @entity {
Expand Down
8 changes: 7 additions & 1 deletion indexer/src/modules/nft/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,14 @@ export function clearNFTOrderProperties(nft: NFT): NFT {
}

export function cancelActiveOrder(nft: NFT, now: BigInt): boolean {
if (nft.activeOrder == null) {
return false
}
let oldOrder = Order.load(nft.activeOrder)
if (oldOrder != null && oldOrder.status == status.OPEN) {
if (
oldOrder != null &&
(oldOrder.status == status.OPEN || oldOrder.status == status.TRANSFERRED)
) {
// Here we are setting old orders as cancelled, because the smart contract allows new orders to be created
// and they just overwrite them in place. But the subgraph stores all orders ever
// you can also overwrite ones that are expired
Expand Down
Loading