Skip to content

Commit

Permalink
feat: add start bid fee percent constant
Browse files Browse the repository at this point in the history
  • Loading branch information
orionstardust committed May 13, 2024
1 parent eb3011a commit fc6bf4f
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ type Auction @entity {
category: Int!
buyNowPrice: BigInt!
startBidPrice: BigInt!
startBidFeePercent: BigInt!
isBought: Boolean!
}

1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -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);
3 changes: 2 additions & 1 deletion src/helper.ts
Original file line number Diff line number Diff line change
@@ -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;
}

3 changes: 2 additions & 1 deletion src/mapping.ts
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fc6bf4f

Please sign in to comment.