Repository navigation
Description
Background
BountiesService.expireOverdue finds overdue bounties still in
OPEN/FUNDED/CLAIMED and flips their status to EXPIRED. Per the state
machine, EXPIRED -> REFUNDED is a valid subsequent transition, but
nothing in expireOverdue actually calls EscrowService.refund — it only
updates the Bounty.status column. There's also no visible scheduled job
(no @nestjs/schedule cron, confirm it's not a dependency) that even calls
expireOverdue automatically — investigate whether it's wired to run on
any schedule at all, or whether it's dead code only reachable via a manual
admin call.
Problem Statement
If a sponsor funds a bounty (locking real funds in escrow) and it expires
unclaimed/unmerged, the current behavior — even in the best case where
expireOverdue is actually invoked on a schedule — only marks it
EXPIRED in Postgres while the sponsor's funds remain locked in the escrow
contract indefinitely. The sponsor has no automatic recourse; someone must
manually notice the bounty is expired and manually call the refund flow
(assuming a controller endpoint for it even exists and is discoverable —
verify). For a platform whose core promise is "funds move automatically,"
silently stranding sponsor funds in escrow after expiry is a serious product
and trust failure.
Requirements
- Wire up an actual recurring job (add @nestjs/schedule if not present,
or document/implement an equivalent — a documented external cron hitting
an admin endpoint is acceptable if justified) that calls
expireOverdue on a sensible interval. - Extend expireOverdue (or add a follow-up step) to automatically trigger
EscrowService.refund for each bounty that had funds locked
(escrowId set) when it expires — respecting the existing state machine
(EXPIRED -> REFUNDED) and the locking/transaction fixes from the other
issues in this batch so this doesn't introduce a new race against a
simultaneous claim/merge. - Handle partial failure: if the on-chain refund call fails for one bounty
in a batch of expiring bounties, the rest must still be processed (don't
let one failure abort the whole batch), and the failure must be visibly
logged/retried, not silently dropped. - Add tests: an expired, funded bounty is automatically refunded on-chain
(verified via the mocked SorobanClientService); an expired, never
funded bounty (still OPEN, no escrow) is marked expired without
attempting a refund; a batch with one failing refund still processes the
rest.
Acceptance Criteria
- A real scheduled job invokes expireOverdue-and-refund on an
interval, not just a manually-reachable method. - Every expired bounty with locked funds is automatically refunded
on-chain, verified by tests against the escrow layer, not just a
status-column check. - One failing refund in a batch does not prevent the rest from
processing, and failures are logged/retryable. - No new race introduced against concurrent claim/merge flows for the
same bounty (reuse the locking pattern from the bounty-claim-race
issue).
Technical Notes
Files: src/bounties/bounties.service.ts, src/escrow/escrow.service.ts,
package.json (add @nestjs/schedule if used), src/bounties/bounties.module.ts.
Difficulty Justification
This closes an actual fund-stranding gap in the product's core value
proposition, requires integrating a new scheduling mechanism correctly with
existing transaction/locking patterns, and requires careful partial-failure
handling across a batch operation touching a live smart contract — not a
simple "add a cron decorator" change.
Activity
OkonkwoEmeka commentedon Aug 27, 2026
@OkonkwoEmeka has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @OkonkwoEmeka to this issue.
benedict-cmd commentedon Aug 27, 2026
@benedict-cmd has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @benedict-cmd to this issue.
oluwadindodosimilenuotunfatasi commentedon Aug 27, 2026
@oluwadindodosimilenuotunfatasi has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @oluwadindodosimilenuotunfatasi to this issue.
oluwagbemigaphilip commentedon Aug 27, 2026
@oluwagbemigaphilip has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @oluwagbemigaphilip to this issue.
drips-wave commentedon Aug 27, 2026
Congratulations, @oluwagbemigaphilip! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.
🧑💻 @oluwagbemigaphilip: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
drips-wave commentedon Aug 27, 2026
This issue has been completed by @oluwagbemigaphilip as part of the Stellar Wave Program's 8th Wave 🥳
😎 @oluwagbemigaphilip: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.