Skip to content

feat(synapse-core): add target runway deposit helper - #906

Closed
snissn wants to merge 1 commit into
FilOzone:masterfrom
snissn:agent/target-runway-deposit
Closed

feat(synapse-core): add target runway deposit helper#906
snissn wants to merge 1 commit into
FilOzone:masterfrom
snissn:agent/target-runway-deposit

Conversation

@snissn

@snissn snissn commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What changed

Adds calculateTargetRunwayDeposit() to @filoz/synapse-core/pay.

The pure helper calculates the additional token amount needed to clear current debt and provide a requested runway:

max(0, debt + lockupRatePerEpoch * targetRunwayInEpochs - availableFunds)

It uses bigint base units and leaves any buffer explicit in the requested runway.

Why

Clients that display a suggested account top-up can use the same calculation without duplicating payment-account arithmetic.

Scope

This does not add network requests, contract writes, date formatting, funding-status categories, or routing behavior.

Validation

  • pnpm --filter @filoz/synapse-core run lint:fix
  • pnpm --filter @filoz/synapse-core run build
  • pnpm --filter @filoz/synapse-core run test
    • 836 Node tests passed
    • 836 browser tests passed

@snissn
snissn requested a review from hugomrdias as a code owner August 4, 2026 03:52
Copilot AI lite review requested due to automatic review settings August 4, 2026 03:52
@snissn
snissn requested a review from rvagg as a code owner August 4, 2026 03:52
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

2 participants