Skip to content

Feature/multi token support#1018

Merged
famvilianity-eng merged 2 commits into
StellarCheckMate:mainfrom
martinshub-tech:feature/multi-token-support
Jul 1, 2026
Merged

Feature/multi token support#1018
famvilianity-eng merged 2 commits into
StellarCheckMate:mainfrom
martinshub-tech:feature/multi-token-support

Conversation

@martinshub-tech

Copy link
Copy Markdown
Contributor

this pr closes #948

Implement Escrow Multi-Token Support with Conversion Rates

Description

Currently, the Checkmate escrow contract only holds a single token per match. This PR implements multi-token support with automatic price conversion. Matches can now allow stakes in different tokens (e.g., USDC and native XLM) using a conversion rate verified by the Oracle.

Tasks Completed

  • Match Struct Update: Added conversion_rate: i128 and token_b: Option<Address> fields to the Match struct.
  • New Entrypoint: Implemented create_match_with_conversion(env, player1, player2, stake_amount, token_a, token_b, rate, game_id, platform).
  • Oracle Integration:
    • Added set_rate, get_rate, and swap methods to the Oracle contract.
    • Added an on-chain verification step to ensure the creator's conversion rate is within ±5% of the oracle rate at match creation.
  • Updated Lifecycle Flows:
    • Deposit: Calculates and transfers the correct token and amount depending on player role (Player 1 deposits token_a, Player 2 deposits token_b at the converted rate).
    • Payout: Winner receives the total prize pool converted back into their preferred token via Oracle swaps.
    • Refunds (Cancel/Expire): Deposits are returned to depositors in their originally staked tokens.
  • Tests: Added a comprehensive test suite in multi_token.rs covering valid/invalid rate validation, multi-token deposits, payouts, swaps, and refunds.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@martinshub-tech 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

@famvilianity-eng famvilianity-eng merged commit 157d292 into StellarCheckMate:main Jul 1, 2026
1 check failed
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.

Implement Escrow Multi-Token Support with Conversion Rates

2 participants