feat: tranche-based partial refund countdown and automated alert system - #413
feat: tranche-based partial refund countdown and automated alert system#413Devadakene wants to merge 5 commits into
Conversation
|
@Devadakene is attempting to deploy a commit to the jotelfootball-tech's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hey @Devadakene , looks like CI and the Vercel deployments are failing on this PR (node-ci build, and both velo/velo-frontend deployments). Could you fix those up before I review? Let me know if you need help debugging. |
jotel-dev
left a comment
There was a problem hiding this comment.
Hey @Devadakene , this one now has a merge conflict in apps/api/src/app.ts, plus node-ci / build and both Vercel deployments are failing again.
A few other PRs (#414, #416) have touched app.ts and merged/are merging around the same time, so this branch is likely just out of date — worth pulling the latest main and rebasing rather than resolving the conflict in isolation. Let me know once it's synced up and I'll take another look at the checks.
…escaped backticks
|
please review |
|
Hey @Devadakene — nice work on the tranche-based partial refund countdown and alert system! ✅ Contracts CI, node build, and frontend deploy are all green, but there are merge conflicts blocking this one: Merge conflicts in mobile/frontend/src/i18n/locales/en.json and es.json — can you resolve these against main? Once that's sorted (and the main Vercel deploy finishes), this should be ready to merge. Thanks for the good work! 🙌 |
Closes #376
Summary
This PR introduces the Tranche-Based Partial Refund Countdown & Automated Alert System.
Previously, if a buyer or seller abandoned a trade after only partially releasing funds (e.g., 1 of 3 tranches), the unreleased funds remained locked indefinitely until manual intervention occurred. This change automates the resolution of these abandoned trades.
Key additions:
SELECT FOR UPDATE) and a newtranche_refund_schedulestable to keep track of partial refunds without risking concurrent execution conflicts.refund()inescrow,htlc-core, andatomic-swapcontracts to return the refunded amount (i128), ensuring the backend cleanly parses and traces exact refund amounts while preserving the strict accounting invariant.trancheRefundWorker.ts) that runs every 5 seconds. It handles automatic push alerts (sent 100 ledgers prior to timeout expiry) and seamlessly delegatesrefundEscrow()processing to the worker queue with automated retries.TrancheCountdownBanner.tsxcomponent into theClaimQRpage, surfacing a real-time progress bar of released tranches alongside a live ledger countdown timer.Testing
The following commands were used to validate the change:
npm run test -- apps/api/src/routes/__tests__/tranche-refund.test.tsnpm run test -- tests/concurrency/tranche_refund_stress.test.tscargo test -p escrownpm run devChecklist