feat(compounding): gas-aware compounding economics module + tests - #9
Open
StSora wants to merge 1 commit into
Open
feat(compounding): gas-aware compounding economics module + tests#9StSora wants to merge 1 commit into
StSora wants to merge 1 commit into
Conversation
Phase 1 of the auto-compounding strategy: the pure economics core, shared by the agent's compound gate and the app's projection card. - src/lib/compounding.ts: profitability gate (compound when accrued >= M * (gas + fee)), break-even interval T*, next-compound estimate, net-reinvested (cost + performance fee deducted), and simple vs compounded projections plus a sampled curve for the UI. - test/unit/compounding.test.ts: bun:test suite covering the two signed-off examples. Cadence falls out of the numbers, never hardcoded: a 10K position (~$0.20/day, $0.15 gas) compounds ~weekly (T* ~7.5d, ~45x/yr); a 10M position (~$2,000/day) compounds daily (365x/yr, ~7.57% effective APY vs 7.30% nominal). Verified with 15/15 logic checks. Fits the agent constraints: read (accrued yield + live gas) -> trigger a pre-signed bounded compound. No delegation authoring, no custody.
|
The preview deployment for Hourglass is ready. 🟢 Open Preview | Open Build Logs | Open Application Logs Last updated at: 2026-07-25 13:25:54 CET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1 of the auto-compounding strategy: the pure economics core, shared by the agent's compound gate and the app's projection card.
Cadence falls out of the numbers, never hardcoded: a 10K position (~$0.20/day, $0.15 gas) compounds ~weekly (T* ~7.5d,
45x/yr); a 10M position ($2,000/day) compounds daily (365x/yr, ~7.57% effective APY vs 7.30% nominal). Verified with 15/15 logic checks.Fits the agent constraints: read (accrued yield + live gas) -> trigger a pre-signed bounded compound. No delegation authoring, no custody.