Skip to content

Commit

Permalink
💩 Mitigate uint64 price cannot be indexed issue
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jul 15, 2024
1 parent bd98663 commit 395ade1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extractor/marketplace.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package extractor
import (
"encoding/json"
"fmt"
"math"
"strconv"
"time"

Expand Down Expand Up @@ -31,6 +32,10 @@ func parseMessage(payload *Payload) (db.NftMarketplaceItem, error) {
if err != nil {
return db.NftMarketplaceItem{}, fmt.Errorf("failed to parse price in marketplace related message: %w", err)
}
// HACK: pg cannot store MaxUInt64
if price > math.MaxInt64 {
price = math.MaxInt64
}
}
return db.NftMarketplaceItem{
ClassId: item.ClassId,
Expand Down Expand Up @@ -106,6 +111,10 @@ func getPriceFromEvent(event *types.StringEvent) uint64 {
// TODO: should we return error?
return 0
}
// HACK: pg cannot store MaxUInt64
if price > math.MaxInt64 {
price = math.MaxInt64
}
return price
}

Expand Down

0 comments on commit 395ade1

Please sign in to comment.