Skip to content

Add cross-table chip transfer with fee (Issue #208) - #472

Merged
Marvy247 merged 2 commits into
HitEmPoka:mainfrom
MarcusDavidG:cross-table-chip-transfer-issue-208
Aug 29, 2026
Merged

Add cross-table chip transfer with fee (Issue #208)#472
Marvy247 merged 2 commits into
HitEmPoka:mainfrom
MarcusDavidG:cross-table-chip-transfer-issue-208

Conversation

@MarcusDavidG

Copy link
Copy Markdown
Contributor

Summary

This PR implements cross-table chip transfers as requested in Issue #208, allowing players to transfer chips between tables they are seated at with a small fee deducted.

Changes

New API Endpoint

    • Transfer chips from source table to destination table

Request/Response Types (api/types.rs)

    • Contains destination_table_id and amount
    • Returns status, source/destination table IDs, amount, fee, net_amount, and transaction hashes

Soroban Integration (soroban/actions.rs)

  • New function that invokes the on-chain contract function
  • Accepts source/destination table IDs, player address, amount, and fee basis points
  • Returns source and destination transaction hashes

API Logic (api/mod.rs)

  • Validates player is seated at both source and destination tables
  • Validates sufficient chip balance at source table
  • Calculates fee (configurable via TRANSFER_FEE_BASIS_POINTS env var, default 100 = 1%)
  • Executes on-chain transfer via Soroban
  • Logs audit entry for the transfer event

Configuration

  • Fee can be configured via environment variable (100 = 1%)
  • Default fee: 1% (100 basis points)

Testing

The implementation follows existing patterns in the codebase:

  • Uses existing to verify player seating
  • Uses existing rate limiting and authentication
  • Uses existing audit logging for event emission
  • Follows same error handling patterns as other endpoints

Notes

The on-chain contract must implement a function with the expected interface:

  • Parameters: source_table_id, destination_table_id, player, amount, fee_basis_points
  • Returns JSON with source_tx_hash and destination_tx_hash

Closes #208

Add verifiable random function (VRF) to the deal circuit.
- Prove that the shuffle seed was derived from a VRF output
- Enables public verifiability of randomness

Changes:
- circuits/lib/src/vrf.nr: New VRF module with prove/verify functions
- circuits/lib/src/lib.nr: Expose VRF module
- circuits/deal_valid/src/main.nr: Accept VRF inputs, derive shuffle seed
- circuits/deal_valid_2p/5p/6p/src/main.nr: Update parameterized circuits
- New API endpoint POST /api/table/:table_id/transfer-chips
- Allows players to transfer chips between tables they are seated at
- Deducts a configurable fee (default 1% = 100 basis points) from transferred amount
- Validates player is seated at both source and destination tables
- Validates sufficient chip balance at source table
- Invokes Soroban contract transfer_chips function on-chain
- Emits TransferEvents via audit logging
- Includes OpenAPI documentation and request/response types
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@MarcusDavidG 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

@Marvy247
Marvy247 merged commit dbce615 into HitEmPoka:main Aug 29, 2026
6 of 21 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

Development

Successfully merging this pull request may close these issues.

Implement a cross-table chip transfer with fee

2 participants