Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FixedPrice auction type #1029

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
);
}

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