From 34865021b8f5dc2647b692ab0174fd71e19195da Mon Sep 17 00:00:00 2001 From: orionstardust Date: Mon, 29 Apr 2024 13:24:54 -0400 Subject: [PATCH 1/3] 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, From eb3011aed14b10e71cce71ff07787c152e20e0d3 Mon Sep 17 00:00:00 2001 From: orionstardust Date: Wed, 1 May 2024 09:58:54 -0400 Subject: [PATCH 2/3] refactor: isBuyNow to isBought --- schema.graphql | 2 +- src/helper.ts | 2 +- src/mapping.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/schema.graphql b/schema.graphql index dc15db8..4e71512 100644 --- a/schema.graphql +++ b/schema.graphql @@ -47,7 +47,7 @@ type Auction @entity { category: Int! buyNowPrice: BigInt! startBidPrice: BigInt! - isBuyNow: Boolean! + isBought: Boolean! } type Bid @entity { diff --git a/src/helper.ts b/src/helper.ts index 909a329..68a47a5 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -84,7 +84,7 @@ export function getOrCreateAuction( auction.totalBids = BIGINT_ZERO; auction.buyNowPrice = BIGINT_ZERO; auction.startBidPrice = BIGINT_ZERO; - auction.isBuyNow = false; + auction.isBought = false; } return auction; diff --git a/src/mapping.ts b/src/mapping.ts index 435c396..e749282 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -319,7 +319,7 @@ export function handleAuction_Initialized( auction.cancelled = false; auction.buyNowPrice = BigInt.fromI32(0); auction.startBidPrice = BigInt.fromI32(0); - auction.isBuyNow = false; + auction.isBought = false; // Update Auction auction = updateAuction(auction, event); @@ -599,7 +599,7 @@ export function handleAuction_BoughtNow( } auction.claimed = true; auction.claimAt = event.block.timestamp; - auction.isBuyNow = true; + auction.isBought = true; let bid = getOrCreateBid( auction.highestBidder, From fc6bf4fabeb4c1e64793f642f28b65fef4afd970 Mon Sep 17 00:00:00 2001 From: orionstardust Date: Mon, 13 May 2024 07:51:16 -0400 Subject: [PATCH 3/3] feat: add start bid fee percent constant --- schema.graphql | 1 + src/constants.ts | 1 + src/helper.ts | 3 ++- src/mapping.ts | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/schema.graphql b/schema.graphql index 4e71512..1b18406 100644 --- a/schema.graphql +++ b/schema.graphql @@ -47,6 +47,7 @@ type Auction @entity { category: Int! buyNowPrice: BigInt! startBidPrice: BigInt! + startBidFeePercent: BigInt! isBought: Boolean! } diff --git a/src/constants.ts b/src/constants.ts index b682952..1772439 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -4,6 +4,7 @@ export let BIGINT_ZERO = BigInt.fromI32(0); export let BIGINT_ONE = BigInt.fromI32(1); export let BIGINT_CANCELLATION_PERIOD_IN_SECONDS = BigInt.fromI32(3600); +export let BIGINT_STARTING_BID_FEE_PERCENT = BigInt.fromI32(4); // TODO: Needs to be updated to activated block number export let BLOCK_NR_BUY_NOW_ACTIVATED = BigInt.fromI32(55931248); \ No newline at end of file diff --git a/src/helper.ts b/src/helper.ts index 68a47a5..f835404 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -6,7 +6,7 @@ import { ethereum, } from "@graphprotocol/graph-ts"; import { Auction, Bid, Incentive, Statistic, User } from "../generated/schema"; -import { BIGINT_ONE, BIGINT_ZERO, BLOCK_NR_BUY_NOW_ACTIVATED } from "./constants"; +import {BIGINT_ONE, BIGINT_STARTING_BID_FEE_PERCENT, BIGINT_ZERO, BLOCK_NR_BUY_NOW_ACTIVATED} from "./constants"; import { ContractV1 } from "../generated/Contract/ContractV1"; import { Contract } from "../generated/Contract/Contract"; @@ -84,6 +84,7 @@ export function getOrCreateAuction( auction.totalBids = BIGINT_ZERO; auction.buyNowPrice = BIGINT_ZERO; auction.startBidPrice = BIGINT_ZERO; + auction.startBidFeePercent = BIGINT_STARTING_BID_FEE_PERCENT; auction.isBought = false; } diff --git a/src/mapping.ts b/src/mapping.ts index e749282..c8bcf22 100644 --- a/src/mapping.ts +++ b/src/mapping.ts @@ -46,7 +46,7 @@ import { import { events, transactions } from "@amxx/graphprotocol-utils"; import { BIGINT_CANCELLATION_PERIOD_IN_SECONDS, - BIGINT_ONE, + BIGINT_ONE, BIGINT_STARTING_BID_FEE_PERCENT, BIGINT_ZERO, } from "./constants"; @@ -319,6 +319,7 @@ export function handleAuction_Initialized( auction.cancelled = false; auction.buyNowPrice = BigInt.fromI32(0); auction.startBidPrice = BigInt.fromI32(0); + auction.startBidFeePercent = BIGINT_STARTING_BID_FEE_PERCENT; auction.isBought = false; // Update Auction