Skip to content

feat(soroban): implement token call cost aggregator - #906

Merged
mijinummi merged 1 commit into
MDTechLabs:mainfrom
adeniran19-maker:feat/873-token-cost-aggregator
Aug 29, 2026
Merged

feat(soroban): implement token call cost aggregator#906
mijinummi merged 1 commit into
MDTechLabs:mainfrom
adeniran19-maker:feat/873-token-cost-aggregator

Conversation

@adeniran19-maker

Copy link
Copy Markdown
Contributor

Closes #873

Summary of Changes

  • Token Call Cost Aggregator: Implemented packages/analyzers/soroban/tokens/cost/token-cost-aggregator.ts to estimate and aggregate resource costs across Soroban token contract calls.
  • Resource Benchmarking: Defined TOKEN_METHOD_BENCHMARKS capturing CPU instructions, memory bytes, and ledger read/write bytes for standard SEP-41 token calls (transfer, transfer_from, balance, approve, mint, burn, clawback, allowance, decimals, etc.).
  • Categorization & Aggregation:
    • groupCostsByOperation: Groups and ranks token method costs by operation with percentage of total CPU consumption.
    • groupCostsByAsset: Groups token calls by asset identifier and identifies the dominant operation per asset.
    • aggregateTokenCosts: Produces overall metrics, identifies dominant assets/operations, and generates actionable optimization recommendations (e.g. hoisting loop calls, batching transfers, caching balances).
  • Test Suite: Added unit test coverage in packages/analyzers/soroban/tokens/cost/__tests__/token-cost-aggregator.spec.ts.

Verification

  • Ran ./node_modules/.bin/jest packages/analyzers/soroban/tokens/cost/__tests__/token-cost-aggregator.spec.ts (5/5 passing).

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@adeniran19-maker 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

@mijinummi
mijinummi merged commit adb93cd into MDTechLabs:main Aug 29, 2026
4 of 7 checks 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.

Implement Soroban Token Call Cost Aggregator

2 participants