Skip to content

Commit

Permalink
Add FixedPrice auction type
Browse files Browse the repository at this point in the history
  • Loading branch information
danielailie committed Sep 20, 2023
1 parent 44bad2f commit f73a306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ enum AuctionStatusEnum {
}

enum AuctionTypeEnum {
FixedPrice
Nft
NftBid
None
Expand Down
10 changes: 9 additions & 1 deletion src/modules/auctions/auctions-setter.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, Logger } from '@nestjs/common';
import { Auction, AuctionAbi, AuctionStatusEnum, ExternalAuctionAbi } from './models';
import { Auction, AuctionAbi, AuctionStatusEnum, AuctionTypeEnum, ExternalAuctionAbi } from './models';
import '../../utils/extensions';
import { AuctionEntity } from 'src/db/auctions';
import { NftMarketplaceAbiService } from './nft-marketplace.abi.service';
Expand Down Expand Up @@ -56,6 +56,14 @@ export class AuctionsSetterService {
);
}

if (
auctionEntity.maxBidDenominated === auctionEntity.minBidDenominated &&
auctionEntity.type !== AuctionTypeEnum.SftAll &&
auctionEntity.type !== AuctionTypeEnum.SftOnePerPayment
) {
auctionEntity.type = AuctionTypeEnum.FixedPrice;

Check warning on line 64 in src/modules/auctions/auctions-setter.service.ts

View check run for this annotation

Codecov / codecov/patch

src/modules/auctions/auctions-setter.service.ts#L64

Added line #L64 was not covered by tests
}

const savedAuction = await this.persistenceService.insertAuction(auctionEntity);

if (asset?.tags) {
Expand Down
1 change: 1 addition & 0 deletions src/modules/auctions/models/AuctionType.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum AuctionTypeEnum {
None = 'None',
Nft = 'Nft',
NftBid = 'NftBid',
FixedPrice = 'FixedPrice',
SftAll = 'SftAll',
SftOnePerPayment = 'SftOnePerPayment',
}
Expand Down

0 comments on commit f73a306

Please sign in to comment.