Skip to content

chore: add initial setup comment to lib.rs#397

Merged
Haroldwonder merged 6 commits intoHaroldwonder:mainfrom
Fidelis900:feature/initial-setup
Mar 30, 2026
Merged

chore: add initial setup comment to lib.rs#397
Haroldwonder merged 6 commits intoHaroldwonder:mainfrom
Fidelis900:feature/initial-setup

Conversation

@Fidelis900
Copy link
Copy Markdown
Contributor

@Fidelis900 Fidelis900 commented Mar 30, 2026

closes #361
closes #362
closes #360
closes #363

Feature 1 — Dispute Flow (dde618f)

Files: src/lib.rs, src/storage.rs, src/events.rs

  • mark_failed(remittance_id) — agent marks a payout as failed, records failed_at timestamp
  • raise_dispute(remittance_id, evidence_hash) — sender challenges within the configurable window (default 72h),
    transitions to Disputed
  • resolve_dispute(remittance_id, in_favour_of_sender) — admin resolves: refunds sender or pays agent
  • set_dispute_window(seconds) / get_dispute_window() — admin-configurable arbitration window
  • New errors: DisputeWindowExpired, AlreadyDisputed, NotDisputed

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Feature 2 — Partial Payouts (9168725)

Files: src/lib.rs, src/storage.rs

  • confirm_partial_payout(remittance_id, amount) — disburses a slice of the net payout to the agent
  • Tracks cumulative disbursed amount via DisbursedAmount storage key
  • Auto-completes the remittance when fully disbursed; enforces agent daily cap on each call
  • Emits partial_payout event with running total

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Feature 3 — Per-Agent Daily Caps (68a98f4)

Files: src/lib.rs, src/storage.rs

  • set_agent_daily_cap(agent, cap) / get_agent_daily_cap(agent) — admin sets rolling 24h cap per agent (0 = no cap)
  • check_and_record_agent_withdrawal() — enforced in both confirm_payout and confirm_partial_payout
  • Returns DailySendLimitExceeded if cap would be breached

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Feature 4 — Ramp Event Hooks (0a91abc)

Files: backend/src/ramp-provider.ts, backend/src/ramp-event-hooks.ts, backend/src/ramp-webhook-handler.ts

  • TransakProvider + MoonPayProvider — HMAC-SHA256 signature verification + payload normalisation
  • rampHooks singleton — on/off/emit for 6 order lifecycle hooks
  • POST /webhooks/ramp/:provider — auto-routes to the right provider, verifies, parses, and fires hooks

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

@Fidelis900 is attempting to deploy a commit to the Harold's projects Team on Vercel.

A member of the Team first needs to authorize it.

…rty arbitration window

- Added DisputeWindow storage key and get/set_dispute_window() (default 72h)
- Added DisbursedAmount, AgentDailyCap, AgentWithdrawals storage keys
- mark_failed(): agent marks payout failed, records failed_at timestamp
- raise_dispute(): sender challenges within window, transitions to Disputed
- resolve_dispute(): admin resolves in favour of sender (refund) or agent (payout)
- set_dispute_window() / get_dispute_window() public admin functions
- New events: emit_dispute_raised, emit_dispute_resolved, emit_remittance_failed
- New errors: DisputeWindowExpired (53), AlreadyDisputed (54), NotDisputed (55)
…ple disbursements

- confirm_partial_payout(remittance_id, amount): disburses partial amount to agent
- DisbursedAmount(u64) storage key tracks total disbursed per remittance
- First call transitions Pending → Processing; final disbursement → Completed
- Enforces per-agent daily cap on each partial disbursement
- Emits emit_partial_payout event with running disbursed total
- Amount validation: partial amount must not exceed remaining net payout
- AgentDailyCap(Address) persistent storage key per agent
- AgentWithdrawals(Address) rolling 24h withdrawal records per agent
- set_agent_daily_cap(agent, cap): admin sets cap (0 = no cap)
- get_agent_daily_cap(agent): query current cap
- check_and_record_agent_withdrawal(): enforced in confirm_payout and confirm_partial_payout
- Emits emit_agent_cap_set event on cap change
- Returns DailySendLimitExceeded if rolling window total would exceed cap
…integration

- ramp-provider.ts: RampProvider interface + TransakProvider + MoonPayProvider adapters
  - HMAC-SHA256 signature verification for both providers
  - Normalises provider-specific payloads into canonical RampOrderEvent
  - Provider registry: registerProvider / getProvider / listProviders
- ramp-event-hooks.ts: RampEventHooks singleton (rampHooks)
  - on/off/emit API for order.pending/processing/completed/failed/refunded/cancelled
  - hookNameForStatus() maps RampOrderStatus → RampHookName
- ramp-webhook-handler.ts: Express route POST /webhooks/ramp/:provider
  - Raw body capture for signature verification
  - Provider lookup, signature check, event parse, hook emit
  - setupRampWebhookRoutes() wires into any Express app
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@Fidelis900 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Haroldwonder Haroldwonder merged commit 9dad39d into Haroldwonder:main Mar 30, 2026
0 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants