Skip to content

get_pools_by_asset has no caching or secondary index #182

Description

@ritaifeoluwa

Description

The Factory contract's get_pools_by_asset function does not cache or index results. Each call scans up to 200 pool IDs, even if the same query was made recently.

Current behavior

Every call scans from start_id, checking each pool's asset field.

Expected behavior

Consider:

  • Maintaining a secondary index (DataKey::AssetPools)
  • Or caching recent query results
  • Or allowing callers to provide a hint based on previous results

Why this matters

Frequent queries for popular assets will repeatedly scan the same pools, wasting gas.

Labels

performance, factory, hard

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfactoryFactory contracthardRequires deep domain knowledge and careful design — not a quick fixperformanceGas cost and throughput improvements

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions