Skip to content

Implement SwapPayment model #41

Description

@codebestia

Represents a swap-routed payment where the payer pays in one token and the merchant settles in another. Specific to Shade's cross-asset capabilities.

Proposed Steps:

  • Create src/shade/models/swap.py.
  • Fields: id, pay_in_token, settle_out_token, amount_in: Decimal, amount_out: Optional[Decimal], routing_path: list[str], slippage_tolerance: float, status, stellar_tx_hash: Optional[str], created_at.
  • Add SwapStatus enum: pending, swapping, completed, failed, slippage_exceeded.
  • Validate 0 < slippage_tolerance < 1.

Acceptance Criteria:

  • SwapPayment.from_dict(...) populates all fields including routing path list.
  • slippage_tolerance outside (0, 1) raises ValueError.
  • status is a SwapStatus enum.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions