Skip to content

Commit

Permalink
add limit check, rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Jan 23, 2025
1 parent 9540389 commit 9ed1c71
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x/oracle/keeper/native_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ func (k Keeper) GetStakerInfo(ctx sdk.Context, assetID, stakerAddr string) types
}

// GetStakerInfos returns all stakers information
// func (k Keeper) GetStakerInfos(ctx sdk.Context, assetID string) (ret []*types.StakerInfo) {
func (k Keeper) GetStakerInfos(ctx sdk.Context, req *types.QueryStakerInfosRequest) (*types.QueryStakerInfosResponse, error) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.NativeTokenStakerKeyPrefix(req.AssetId))
retStakerInfos := make([]*types.StakerInfo, 0)
if req.Pagination != nil && req.Pagination.Limit > types.MaxPageLimit {
return nil, status.Errorf(codes.InvalidArgument, "pagination limit %d exceeds maximum allowed %d", req.Pagination.Limit, types.MaxPageLimit)
}
resPage, err := query.Paginate(store, req.Pagination, func(_ []byte, value []byte) error {
sInfo := types.StakerInfo{}
k.cdc.MustUnmarshal(value, &sInfo)
Expand Down

0 comments on commit 9ed1c71

Please sign in to comment.