Skip to content

Conversation

@TaprootFreak
Copy link
Collaborator

Summary

  • Automatically trigger LiquidityManagement pipeline when ref reward payouts lack sufficient liquidity
  • Consistent with BuyCrypto implementation

Changes

  • Add liquidityPipeline relation to RefReward entity
  • Extend secureLiquidity() to check available liquidity before processing
  • Start pipeline via liquidityService.buyLiquidity() when deficit detected
  • Set status to PENDING_LIQUIDITY before pipeline attempt
  • Process pending rewards when pipeline completes
  • Reset to PREPARED on pipeline failure for automatic retry

Flow

PREPARED → [liquidity check] → PENDING_LIQUIDITY → [pipeline complete] → READY_FOR_PAYOUT
                                      ↓
                              [pipeline failed] → PREPARED (retry)

Test plan

  • Test with sufficient liquidity → direct READY_FOR_PAYOUT
  • Test with insufficient liquidity → pipeline started → PENDING_LIQUIDITY
  • Test pipeline completion → READY_FOR_PAYOUT
  • Test pipeline failure → reset to PREPARED

When ref reward payouts lack sufficient liquidity, automatically trigger
the LiquidityManagement pipeline (similar to BuyCrypto).

Changes:
- Add liquidityPipeline relation to RefReward entity
- Extend secureLiquidity() to check available liquidity
- Start pipeline via liquidityService.buyLiquidity() when deficit detected
- Set status to PENDING_LIQUIDITY before pipeline attempt (consistent with BuyCrypto)
- Process pending rewards when pipeline completes
- Reset to PREPARED on pipeline failure for automatic retry

Flow:
PREPARED → [liquidity check] → PENDING_LIQUIDITY → [pipeline complete] → READY_FOR_PAYOUT
@davidleomay davidleomay changed the title feat(ref-reward): Add automatic liquidity pipeline for ref payouts [DEV-3526] Add automatic liquidity pipeline for ref payouts Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants