Skip to content

exchange_router: cancel_order does not refund execution fee to user #258

Description

@abayomicornelius

Summary

When a user calls exchange_router::cancel_order, the collateral token is returned but the execution fee (paid in XLM/native token to incentivise the keeper) is silently retained in the order_vault. Users lose the execution fee even though no keeper performed any work.

Expected Behaviour

On user-initiated cancellation, the full execution fee should be returned to the user. The keeper fee is only earned upon a successful (or failed-but-attempted) execution.

Steps to Reproduce

  1. Create an order with execution_fee = 1 XLM
  2. Call cancel_order before keeper executes
  3. Check user wallet — collateral returned, 1 XLM missing

Acceptance Criteria

  • cancel_order transfers execution fee back to env.invoker()
  • Integration test: order created with fee, cancelled, assert full balance restored
  • Keeper-initiated cancellation (via execute_order_fail) still pays keeper the execution fee
  • No change to behaviour when execution_fee = 0

Affected Contract

exchange_router, order_vault

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions