threesome fixed

This commit is contained in:
API runner
2026-08-14 20:55:11 +00:00
parent b6ecf6ad7c
commit b933f09187
260 changed files with 17747 additions and 270 deletions
+24 -16
View File
@@ -6,40 +6,48 @@ 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.
During reward distribution, Record the bet fee going to the acc id:1 and prize going to the winner seperately. and set match_id on reward distribution .
## Match escrow (current)
Heres how a RC purchase record would look like
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_<matchId>`). 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
Heres how a reward distribution would look like.
from a single players POV (there are 2 players per match).
PS: bet fee is usually 10%, stored in settings table
entry record 1/2
### Collect (per player, ×2)
from: user_id
to: 1
to: escrow_user_id
amount: entry fee - bet fee
remarks: entry_hold
match_id: match_id
entry record 2/2
from: user_id
to: 1
to: escrow_user_id
amount: bet fee
remarks: entry_fee
match_id: match_id
And for giving the reward.
### Settle
from: 1
from: escrow_user_id
to: winner_user_id
amount: (already calculated properly)
amount: rc_prize
remarks: reward
match_id: match_id
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`).