Skip to content

Commit

Permalink
do not panic if token predicate not found
Browse files Browse the repository at this point in the history
Signed-off-by: p4u <[email protected]>
  • Loading branch information
p4u committed Aug 28, 2024
1 parent e434bb1 commit 2755159
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ func (capi *census3API) CalculateStrategyHolders(ctx context.Context,
// it is a complex predicate, create a evaluator and evaluate the predicate
if validPredicate.IsLiteral() {
token := tokens[validPredicate.String()]
if token == nil {
return nil, nil, totalTokensBlockNumber, fmt.Errorf("token not found for predicate: %s", validPredicate.String())
}
// get the strategy holders from the database
holders, err := capi.db.QueriesRO.TokenHoldersByMinBalance(ctx,
queries.TokenHoldersByMinBalanceParams{
Expand Down

0 comments on commit 2755159

Please sign in to comment.