From fc6bf4fabeb4c1e64793f642f28b65fef4afd970 Mon Sep 17 00:00:00 2001 From: orionstardust Date: Mon, 13 May 2024 07:51:16 -0400 Subject: [PATCH] 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