Expose negative-risk membership and convert fractional outcome balances

This commit is contained in:
2026-12-03 12:56:07 +08:00
parent f7946d2277
commit 351de6187e
13 changed files with 233 additions and 45 deletions
+26
View File
@@ -1362,3 +1362,29 @@ sequenceDiagram
E->>D: 读取成交曲线系数
E-->>C: 按成交数量与各档价格计算费用
```
### 互斥资产标识和小数份额转换
```mermaid
flowchart LR
C["command.rs"] --> M["market.rs"] --> N["neg_risk.rs · 成员、转换、赢家准备金"]
N --> I["inventory.rs · 百万分之一份的数量和抵押"]
N --> L["ledger.rs · 现金与份额"]
N --> S["schema.sql · 分组、准备金与小数余数"]
X["lib.rs · Exchange"] --> N
```
```mermaid
sequenceDiagram
participant C as 客户端
participant E as Exchange
participant D as SQLite
C->>E: token_neg_risk(资产 ID)
E->>D: 检查市场和分组成员记录
E-->>C: 成员返回 true,普通市场返回 false
C->>E: convert,两种 NO 各 250001 微份
E->>D: 同一事务扣除 NO 和抵押,增加其余 YES、准备金、现金和活动记录
E-->>C: 本次释放 250001 微单位现金
C->>E: 裁决赢家
E->>D: 将完整准备金含小数余数划入赢家抵押
```