Skip to content

Commit

Permalink
feat: add isBuyNow
Browse files Browse the repository at this point in the history
  • Loading branch information
orionstardust committed Apr 29, 2024
1 parent 5854f90 commit 3486502
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type Auction @entity {
category: Int!
buyNowPrice: BigInt!
startBidPrice: BigInt!
isBuyNow: Boolean!
}

type Bid @entity {
Expand Down
1 change: 1 addition & 0 deletions src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function getOrCreateAuction(
auction.totalBids = BIGINT_ZERO;
auction.buyNowPrice = BIGINT_ZERO;
auction.startBidPrice = BIGINT_ZERO;
auction.isBuyNow = false;
}

return auction;
Expand Down
2 changes: 2 additions & 0 deletions src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -598,6 +599,7 @@ export function handleAuction_BoughtNow(
}
auction.claimed = true;
auction.claimAt = event.block.timestamp;
auction.isBuyNow = true;

let bid = getOrCreateBid(
auction.highestBidder,
Expand Down

0 comments on commit 3486502

Please sign in to comment.