I have introduced a new table called transactions, @schemas/table_transactions.md I need all RC related transactions logged in here. This is to keep track of all purchases of RC, spendings of RC and withdrawals of RC in track. I have added my first record with remarks of 'supply',to acc id:1. a large sum. All purchases of RC (in purchases rc api endpoint) will be deducted from acc id:1 and given to the requested user. ## Match escrow (current) Entry fees are collected when both players have joined (`red_joined_at` + `blue_joined_at`), into a **per-match escrow user** (`matches.escrow_user_id`, username `match_escrow_`). At settle, the prize and house fee are paid **only from that escrow** — never from the system supply account. See: - `schemas/alter_matches_escrow.sql` - `schemas/rpc_collect_match_entries.sql` - `schemas/rpc_settle_match_reward.sql` ### RC purchase from: 1 to: requested_user_id amount: requested_amount remarks: purchase ### Collect (per player, ×2) from: user_id to: escrow_user_id amount: entry fee - bet fee remarks: entry_hold match_id: match_id from: user_id to: escrow_user_id amount: bet fee remarks: entry_fee match_id: match_id ### Settle from: escrow_user_id to: winner_user_id amount: rc_prize remarks: reward match_id: match_id from: escrow_user_id to: 1 amount: bet fee × 2 remarks: bet_fee match_id: match_id PS: bet fee is usually 10%, stored in settings table (`key = bet_fee`).