Skip to content

Commit

Permalink
restructure loop condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ogtownsend committed Sep 20, 2024
1 parent 34760fd commit 70bc529
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ func GenerateTokenAdminRegistryView(taContract *token_admin_registry.TokenAdminR
func getAllConfiguredTokensPaginated(taContract *token_admin_registry.TokenAdminRegistry) ([]common.Address, error) {
startIndex := uint64(0)
allTokens := make([]common.Address, 0)
fetchedTokens := make([]common.Address, 0)
for len(fetchedTokens) < GetTokensPaginationSize {
for {
fetchedTokens, err := taContract.GetAllConfiguredTokens(nil, startIndex, GetTokensPaginationSize)
if err != nil {
return nil, err
}
allTokens = append(allTokens, fetchedTokens...)
startIndex += GetTokensPaginationSize
if len(fetchedTokens) < GetTokensPaginationSize {
return allTokens, nil
}
}
return allTokens, nil
}

0 comments on commit 70bc529

Please sign in to comment.