From 34865021b8f5dc2647b692ab0174fd71e19195da Mon Sep 17 00:00:00 2001 From: orionstardust Date: Mon, 29 Apr 2024 13:24:54 -0400 Subject: [PATCH] feat: add isBuyNow --- schema.graphql | 1 + src/helper.ts | 1 + src/mapping.ts | 2 ++ 3 files changed, 4 insertions(+) diff --git a/schema.graphql b/schema.graphql index c0c02de..dc15db8 100644 --- a/schema.graphql +++ b/schema.graphql @@ -47,6 +47,7 @@ type Auction @entity { category: Int! buyNowPrice: BigInt! startBidPrice: BigInt! + isBuyNow: Boolean! } type Bid @entity { diff --git a/src/helper.ts b/src/helper.ts index 3d00188..909a329 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -84,6 +84,7 @@ export function getOrCreateAuction( auction.totalBids = BIGINT_ZERO; auction.buyNowPrice = BIGINT_ZERO; auction.startBidPrice = BIGINT_ZERO; + auction.isBuyNow = false; } return auction; diff --git a/src/mapping.ts b/src/mapping.ts index e30cca9..435c396 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -319,6 +319,7 @@ export function handleAuction_Initialized( auction.cancelled = false; auction.buyNowPrice = BigInt.fromI32(0); auction.startBidPrice = BigInt.fromI32(0); + auction.isBuyNow = false; // Update Auction auction = updateAuction(auction, event); @@ -598,6 +599,7 @@ export function handleAuction_BoughtNow( } auction.claimed = true; auction.claimAt = event.block.timestamp; + auction.isBuyNow = true; let bid = getOrCreateBid( auction.highestBidder,