Skip to content

feat(lp): track LP allocations per key and add TVL reporting endpoint (#943) - #954

Merged
Chucks1093 merged 5 commits into
accesslayerorg:mainfrom
KingDavid9999:fixes-issue-#943
Sep 28, 2026
Merged

Chucks1093 merged 5 commits into
accesslayerorg:mainfrom
KingDavid9999:fixes-issue-#943

Conversation

@KingDavid9999

Copy link
Copy Markdown
Contributor

Record protocol-owned liquidity from bonding-curve buys and expose it
via per-key and protocol-wide endpoints.

  • Add LpAllocation model (creatorId, amountXlm, ledger, txHash,
    eventIndex, allocatedAt) with a (txHash, eventIndex) unique
    constraint for idempotent event replay.
  • Add processLpAllocationEvents indexer handler for the
    LPAllocationSent contract event; validates required fields, skips
    duplicates, and invalidates the affected key's and admin's caches.
  • Add GET /keys/:keyId/lp-stats — total LP contributed and current LP
    balance per key, cached 60s.
  • Add GET /keys/:keyId/lp-history?limit=&cursor= — cursor-paginated LP
    contribution history, newest first.
  • Add GET /admin/lp-overview — protocol-owned liquidity aggregated
    across all keys, cached 60s, admin-only.
  • Add integration tests covering event recording, idempotency,
    missing-field handling, per-key stats, admin aggregation, cache
    invalidation, and pagination.

Note: no "LP removed" contract event exists in scope yet, so
currentLpBalanceXlm currently equals totalLpContributedXlm.
Closes #943

…accesslayerorg#943)

Record protocol-owned liquidity from bonding-curve buys and expose it
via per-key and protocol-wide endpoints.

- Add LpAllocation model (creatorId, amountXlm, ledger, txHash,
  eventIndex, allocatedAt) with a (txHash, eventIndex) unique
  constraint for idempotent event replay.
- Add processLpAllocationEvents indexer handler for the
  LPAllocationSent contract event; validates required fields, skips
  duplicates, and invalidates the affected key's and admin's caches.
- Add GET /keys/:keyId/lp-stats — total LP contributed and current LP
  balance per key, cached 60s.
- Add GET /keys/:keyId/lp-history?limit=&cursor= — cursor-paginated LP
  contribution history, newest first.
- Add GET /admin/lp-overview — protocol-owned liquidity aggregated
  across all keys, cached 60s, admin-only.
- Add integration tests covering event recording, idempotency,
  missing-field handling, per-key stats, admin aggregation, cache
  invalidation, and pagination.

Note: no "LP removed" contract event exists in scope yet, so
currentLpBalanceXlm currently equals totalLpContributedXlm.
Closes accesslayerorg#943
@drips-wave

drips-wave Bot commented Sep 26, 2026

Copy link
Copy Markdown

@KingDavid9999 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit b57b21b into accesslayerorg:main Sep 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add liquidity pool allocation tracking and TVL reporting endpoint

2 participants