From 17977c0c278a9cbd60f5e6cff329d77365fe0450 Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Thu, 25 Nov 2021 11:06:40 +0400 Subject: [PATCH] initial commit --- nft.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nft.go b/nft.go index 1274d39..68c2100 100644 --- a/nft.go +++ b/nft.go @@ -56,18 +56,22 @@ type MarketService struct { squadservice *SquadService floorService *FloorService + bscaddress string + nfts []Nft floor float64 nftslock *sync.RWMutex } -func NewMarketService(collection string, graphClient *graphql.Client, squadservice *SquadService, floorService *FloorService) *MarketService { +func NewMarketService(collection string, graphClient *graphql.Client, squadservice *SquadService, floorService *FloorService, bscadress string) *MarketService { return &MarketService{ collection: collection, graphClient: graphClient, squadservice: squadservice, floorService: floorService, + bscaddress: bscadress, + nfts: nil, floor: 0, nftslock: &sync.RWMutex{}, @@ -199,7 +203,7 @@ func (s *MarketService) GetNft(ctx context.Context, collection string, tokenId i res.UpdatedTimeString = humanize.Time(time.Unix(res.UpdatedAt, 0)) res.IsRecent = time.Unix(res.UpdatedAt, 0).After(time.Now().Add(-1 * time.Hour)) res.IsVeryRecent = time.Unix(res.UpdatedAt, 0).After(time.Now().Add(-5 * time.Minute)) - res.IsNotMine = res.CurrentSeller != "0x73d74055cc40ee8c62978a37a3b938f6e62739ed" + res.IsNotMine = res.CurrentSeller != s.bscaddress return res, nil } @@ -260,7 +264,7 @@ func (s *MarketService) getPage(ctx context.Context, collection string, pagenum if floor == 0 || nft.CurrentAskPrice < floor { floor = nft.CurrentAskPrice } - nft.IsNotMine = nft.CurrentSeller != "0x73d74055cc40ee8c62978a37a3b938f6e62739ed" + nft.IsNotMine = nft.CurrentSeller != s.bscaddress res = append(res, nft) }