Repository navigation
Phase 5: worker and buy scheduler - #113
Merged
Merged
Conversation
- scheduleBuys: due / in-flight / 15-min backoff / empty checks, amount = min(per-run, balance), real quote, cost check, plan match, row inserted before execute_buy, deposit tx submitted; skips, refusals and failures recorded with a note and alerted - pollFunding and pollBuys map 1Click statuses, expire stale quotes, record actual amount out, destination tx and refund reasons - expireQuotes (DB only) and a keeper gas alert - runner: loops never overlap, survive errors, stop cleanly on signals - buys.note column (migration 0001); 100 TS tests
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.
Implements the background worker (ARCHITECTURE §4.4).
What changed
min(amount_per_run, balance). Real quote (fails closed on signature) → cost check → plan match → row inserted beforeexecute_buy→ deposit tx submitted (best effort). Skips, refusals and failures are recorded with anote; refusals and failures raise an alert.buys.notecolumn (migration0001_buy_note).Smoke run:
pnpm workerwith no env starts on PGlite, warns that the keeper isn't configured, and stops cleanly on SIGTERM.Closes #50
Closes #51
Closes #52
Closes #53
Closes #54
Roadmap
Checks
pnpm typecheck,pnpm lintNEAR HACKATHON rules