Refund approval updates database status to approved, but does not appear to execute or track the contract refund operation. This can create a dangerous gap where operators believe a refund was approved while escrow funds remain on-chain.
Affected areas: app/backend/src/refunds/refunds.service.ts, app/backend/src/refunds/refunds.controller.ts, app/backend/src/refunds/refunds.types.ts, app/backend/src/transactions/soroban-rpc.service.ts, app/backend/src/common/soroban-errors/*, app/backend/supabase/migrations/*refund*, refund tests/docs.
Implementation scope:
- Introduce explicit states such as
pending, approved, submitted, confirmed, failed, rejected.
- Store on-chain transaction hash, contract ID, network, failure reason, and retry metadata.
- Wire approval to a job or service that calls the contract
refund function.
- Make idempotency keys cover both database and on-chain submission paths.
Acceptance criteria:
- Approved refunds eventually become confirmed or failed with a clear reason.
- Duplicate approvals cannot submit duplicate contract refunds.
- API responses expose refund state, transaction hash, and retryability.
Refund approval updates database status to
approved, but does not appear to execute or track the contract refund operation. This can create a dangerous gap where operators believe a refund was approved while escrow funds remain on-chain.Affected areas:
app/backend/src/refunds/refunds.service.ts,app/backend/src/refunds/refunds.controller.ts,app/backend/src/refunds/refunds.types.ts,app/backend/src/transactions/soroban-rpc.service.ts,app/backend/src/common/soroban-errors/*,app/backend/supabase/migrations/*refund*, refund tests/docs.Implementation scope:
pending,approved,submitted,confirmed,failed,rejected.refundfunction.Acceptance criteria: