Publish settlement clarifications and atomically clear affected orders

This commit is contained in:
2026-12-03 10:42:35 +08:00
parent fe69e31929
commit 3495e8de3c
12 changed files with 319 additions and 3 deletions
+20
View File
@@ -222,3 +222,23 @@ sequenceDiagram
E-->>H: 按观测时刻排序的价格点 E-->>H: 按观测时刻排序的价格点
H-->>C: history 数组,每点包含 t 和 p H-->>C: history 数组,每点包含 t 和 p
``` ```
### 发布后的裁决说明
```mermaid
flowchart LR
H["market_http.rs"] --> Q["exchange/clarifications.rs"]
```
```mermaid
sequenceDiagram
participant C as 客户端
participant H as market_http
participant E as Exchange
C->>H: GET /market-clarifications?market_id=1
H->>E: 用目录 ID、limit、offset 和排序方向查询
E-->>H: 规则说明、清盘标记和本地发布时间
H-->>C: 已发布的公告数组
```
market_id 使用 assets 查询中的数字目录 ID,可重复传入。默认按公告 ID 降序,每页 20 条;支持 order=id、ascending、offset 和 0 到 100 的 limit。当前查询对其他筛选参数返回 400。
+50 -1
View File
@@ -251,6 +251,34 @@ fn market_lookup(engine: &Mutex<Exchange>, prefix: &str, raw: &str) -> Reply {
.ok_or((if is_token { 404 } else { 400 }, "market not found")) .ok_or((if is_token { 404 } else { 400 }, "market not found"))
} }
fn clarifications(engine: &Mutex<Exchange>, query: &str) -> Reply {
let invalid = (400, "Invalid clarification query");
let fields: Vec<(String, String)> = serde_urlencoded::from_str(query).map_err(|_| invalid)?;
let mut ids = Vec::new();
let mut limit = 20;
let mut offset = 0;
let mut ascending = false;
for (key, value) in fields {
match key.as_str() {
"market_id" => ids.push(value.parse().map_err(|_| invalid)?),
"limit" => limit = value.parse().map_err(|_| invalid)?,
"offset" => offset = value.parse().map_err(|_| invalid)?,
"ascending" => ascending = value.parse().map_err(|_| invalid)?,
"order" if value == "id" => {}
_ => return Err(invalid),
}
}
let rows = engine
.lock()
.map_err(|_| (500, "Internal server error"))?
.market_clarifications(&ids, limit, offset, ascending)
.map_err(|e| match e {
exchange::MarketDataError::Invalid(_) => invalid,
exchange::MarketDataError::Unavailable => (500, "Internal server error"),
})?;
Ok(Value::Array(rows))
}
fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> { fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> {
let (path, params) = req.url().split_once('?').unwrap_or((req.url(), "")); let (path, params) = req.url().split_once('?').unwrap_or((req.url(), ""));
let mut allow = None; let mut allow = None;
@@ -284,6 +312,7 @@ fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> {
allow = Some("GET"); allow = Some("GET");
Err((405, "Method not allowed")) Err((405, "Method not allowed"))
} }
(&Method::Get, "/market-clarifications") => clarifications(engine, params),
(&Method::Get, "/prices-history") => { (&Method::Get, "/prices-history") => {
let result = serde_urlencoded::from_str::<exchange::ClobHistoryQuery>(params) let result = serde_urlencoded::from_str::<exchange::ClobHistoryQuery>(params)
.map_err(|_| HistoryError::Invalid("invalid query parameters".into())) .map_err(|_| HistoryError::Invalid("invalid query parameters".into()))
@@ -378,7 +407,13 @@ fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> {
} }
( (
_, _,
"/price" | "/midpoint" | "/spread" | "/book" | "/last-trade-price" | "/prices-history" "/price"
| "/midpoint"
| "/spread"
| "/book"
| "/last-trade-price"
| "/prices-history"
| "/market-clarifications"
| "/v2/prices-history", | "/v2/prices-history",
) => { ) => {
allow = Some("GET"); allow = Some("GET");
@@ -504,7 +539,21 @@ mod tests {
let pair = json!({"eb:YES:s":"0.4","eb:NO:s":"0.6"}); let pair = json!({"eb:YES:s":"0.4","eb:NO:s":"0.6"});
let price_batch = let price_batch =
json!({"eb:YES:mid-example":{"BUY":0.09,"SELL":0.08},"eb:NO:mid-example":{"BUY":0.92}}); json!({"eb:YES:mid-example":{"BUY":0.09,"SELL":0.08},"eb:NO:mid-example":{"BUY":0.92}});
db.execute(json!({"op":"publish_clarification","id":"note","market":market,"content":"Map one includes overtime.","clear_book":false})).unwrap();
let note = db
.execute(json!({"op":"resolution","market":market}))
.unwrap()["clarifications"]
.clone();
let note_id = note[0]["marketId"].as_i64().unwrap();
let note_query = format!(
"/market-clarifications?market_id=9999&market_id={note_id}&order=id&ascending=true"
);
let cases = [ let cases = [
("GET",note_query.as_str(),String::new(),200,Some(note)),
("GET","/market-clarifications?limit=0",String::new(),200,Some(json!([]))),
("GET","/market-clarifications?offset=1",String::new(),200,Some(json!([]))),
("GET","/market-clarifications?limit=101",String::new(),400,None),
("POST","/market-clarifications","{}".into(),405,None),
("GET","/prices-history?market=eb:YES:s&interval=1h&fidelity=10",String::new(),200,Some(json!({"history":[]}))), ("GET","/prices-history?market=eb:YES:s&interval=1h&fidelity=10",String::new(),200,Some(json!({"history":[]}))),
("GET","/prices-history?market=eb:NO:s&startTs=1000&endTs=2000",String::new(),200,Some(json!({"history":[]}))), ("GET","/prices-history?market=eb:NO:s&startTs=1000&endTs=2000",String::new(),200,Some(json!({"history":[]}))),
("GET","/prices-history?market=eb:YES:s&startTs=1000",String::new(),400,None), ("GET","/prices-history?market=eb:YES:s&startTs=1000",String::new(),400,None),
+28
View File
@@ -1134,3 +1134,31 @@ sequenceDiagram
D-->>E: 观测时间和定点价格 D-->>E: 观测时间和定点价格
E-->>C: t 为 Unix 秒,p 为十进制数 E-->>C: t 为 Unix 秒,p 为十进制数
``` ```
### 裁决规则的补充公告
```mermaid
flowchart LR
C["command.rs"] --> M["market.rs"]
M --> N["clarifications.rs"]
N --> B["market.rs · clear_orders"] --> L["book.rs · release"]
N --> S["schema.sql · market_clarifications"]
R["resolution.rs"] --> N
```
```mermaid
sequenceDiagram
participant O as 操作员
participant E as Exchange
participant D as SQLite
participant B as 常驻盘口
O->>E: publish_clarification,携带请求 ID
E->>D: 同一事务中保存原文和 clear_book
opt 清盘
E->>D: 撤销本市场所有存续委托,返还剩余现金或份额
end
E->>D: 保存回执并提交
E->>B: 应用已提交的订单变更
O->>E: resolution
E-->>O: 原始规则、历次公告、裁决阶段和已确定的兑付权重
```
+82
View File
@@ -0,0 +1,82 @@
use crate::{market, validation::phase, Exchange, MarketDataError};
use anyhow::{ensure, Result};
use rusqlite::{params, Connection, Transaction};
use serde_json::{json, Value};
pub(crate) fn publish(
tx: &Transaction,
market: &str,
content: &str,
clear_book: bool,
) -> Result<Value> {
phase(tx, market, &["preopen", "continuous", "closed"])?;
ensure!(!content.trim().is_empty(), "clarification text required");
tx.execute(
"INSERT INTO market_clarifications(market,content,clear_book) VALUES(?1,?2,?3)",
params![market, content, clear_book],
)?;
let id = tx.last_insert_rowid();
let canceled = if clear_book {
market::clear_orders(tx, market)?
} else {
0
};
Ok(json!({"id":id,"market":market,"clearBook":clear_book,"canceled_count":canceled}))
}
fn read(
db: &Connection,
market: Option<&str>,
ids: &[i64],
limit: i64,
offset: i64,
ascending: bool,
) -> rusqlite::Result<Vec<Value>> {
let ids_json = json!(ids).to_string();
let order = if ascending { "ASC" } else { "DESC" };
let sql = format!(
"SELECT n.id,d.id,n.content,n.clear_book,n.created_at
FROM market_clarifications n JOIN market_directory_ids d ON d.market=n.market
WHERE (?1 IS NULL OR n.market=?1)
AND (?2='[]' OR d.id IN (SELECT value FROM json_each(?2)))
ORDER BY n.id {order} LIMIT ?3 OFFSET ?4"
);
let mut stmt = db.prepare_cached(&sql)?;
let rows = stmt.query_map(params![market, ids_json, limit, offset], |r| {
Ok(
json!({"id":r.get::<_,i64>(0)?,"marketId":r.get::<_,i64>(1)?,
"content":r.get::<_,String>(2)?,"clearBook":r.get::<_,bool>(3)?,
"createdAt":r.get::<_,String>(4)?,"showInFrontend":true,
"txTimestamp":null,"txHash":null}),
)
})?;
rows.collect()
}
pub(crate) fn for_resolution(db: &Connection, market: &str) -> rusqlite::Result<Vec<Value>> {
read(db, Some(market), &[], -1, 0, true)
}
impl Exchange {
pub fn market_clarifications(
&self,
ids: &[i64],
limit: u32,
offset: i64,
ascending: bool,
) -> Result<Vec<Value>, MarketDataError> {
if ids.iter().any(|id| *id <= 0) || limit > 100 || offset < 0 {
return Err(MarketDataError::Invalid(
"invalid clarification filter".into(),
));
}
Ok(read(
&self.db,
None,
ids,
i64::from(limit),
offset,
ascending,
)?)
}
}
+6
View File
@@ -36,6 +36,12 @@ pub(crate) enum Command {
markets: Vec<String>, markets: Vec<String>,
augmented: Option<crate::augmented::Config>, augmented: Option<crate::augmented::Config>,
}, },
#[serde(rename = "publish_clarification")]
PublishClarification {
market: String,
content: String,
clear_book: bool,
},
Clarify { Clarify {
market: String, market: String,
name: String, name: String,
+1
View File
@@ -17,6 +17,7 @@ use validation::identifier;
mod book; mod book;
mod book_snapshot; mod book_snapshot;
mod cancellation; mod cancellation;
mod clarifications;
mod clob_market; mod clob_market;
mod command; mod command;
mod inventory; mod inventory;
+13 -2
View File
@@ -109,6 +109,11 @@ pub(crate) fn apply(
} }
Ok(result) Ok(result)
} }
Command::PublishClarification {
market,
content,
clear_book,
} => crate::clarifications::publish(tx, &market, &content, clear_book),
Command::Clarify { Command::Clarify {
market, market,
name, name,
@@ -381,17 +386,23 @@ pub(crate) fn apply(
pub(crate) fn close_market(tx: &Transaction, market: &str) -> Result<()> { pub(crate) fn close_market(tx: &Transaction, market: &str) -> Result<()> {
phase(tx, market, &["preopen", "continuous"])?; phase(tx, market, &["preopen", "continuous"])?;
clear_orders(tx, market)?;
tx.execute("UPDATE markets SET phase='closed' WHERE id=?", [market])?;
Ok(())
}
pub(crate) fn clear_orders(tx: &Transaction, market: &str) -> Result<usize> {
let mut stmt = tx.prepare("SELECT seq,account FROM orders WHERE market=? AND status='live'")?; let mut stmt = tx.prepare("SELECT seq,account FROM orders WHERE market=? AND status='live'")?;
let orders = stmt let orders = stmt
.query_map([market], |r| { .query_map([market], |r| {
Ok((r.get::<_, i64>(0)?, r.get::<_, String>(1)?)) Ok((r.get::<_, i64>(0)?, r.get::<_, String>(1)?))
})? })?
.collect::<rusqlite::Result<Vec<_>>>()?; .collect::<rusqlite::Result<Vec<_>>>()?;
let count = orders.len();
for (seq, account) in orders { for (seq, account) in orders {
book::release(tx, seq, &account, book::CancelReason::Cancelled)?; book::release(tx, seq, &account, book::CancelReason::Cancelled)?;
} }
tx.execute("UPDATE markets SET phase='closed' WHERE id=?", [market])?; Ok(count)
Ok(())
} }
pub(crate) fn finalize(tx: &Transaction, market: &str, winner: &str) -> Result<i64> { pub(crate) fn finalize(tx: &Transaction, market: &str, winner: &str) -> Result<i64> {
+19
View File
@@ -110,6 +110,25 @@ pub(crate) fn authorize_finalization(tx: &Transaction, market: &str, winner: &st
} }
pub(crate) fn read(db: &Connection, market: &str) -> Result<Value> { pub(crate) fn read(db: &Connection, market: &str) -> Result<Value> {
let mut state = policy_state(db, market)?;
let (rules, resolved_at): (String, Option<i64>) = db.query_row(
"SELECT m.rules,s.at_ms FROM markets m LEFT JOIN price_settlements s ON s.market=m.id WHERE m.id=?",
[market], |row| Ok((row.get(0)?,row.get(1)?))
)?;
state["rules"] = json!(rules);
state["resolved_at_ms"] = json!(resolved_at);
// YES, NO token order from the binary CTF adapter. Only finalized markets have a winner.
state["payouts"] = match state["winner"].as_str() {
Some("YES") => json!([1, 0]),
Some("NO") => json!([0, 1]),
Some("VOID") => json!([1, 1]),
_ => Value::Null,
};
state["clarifications"] = json!(crate::clarifications::for_resolution(db, market)?);
Ok(state)
}
fn policy_state(db: &Connection, market: &str) -> Result<Value> {
if let Some(data) = crate::twap::read(db, market)? { if let Some(data) = crate::twap::read(db, market)? {
return Ok(data); return Ok(data);
} }
+7
View File
@@ -5,6 +5,13 @@ CREATE TABLE IF NOT EXISTS markets (
id TEXT PRIMARY KEY, rules TEXT NOT NULL, phase TEXT NOT NULL, id TEXT PRIMARY KEY, rules TEXT NOT NULL, phase TEXT NOT NULL,
collateral INTEGER NOT NULL DEFAULT 0 CHECK(collateral >= 0), winner TEXT collateral INTEGER NOT NULL DEFAULT 0 CHECK(collateral >= 0), winner TEXT
); );
CREATE TABLE IF NOT EXISTS market_clarifications (
id INTEGER PRIMARY KEY, market TEXT NOT NULL REFERENCES markets(id),
content TEXT NOT NULL CHECK(length(trim(content))>0),
clear_book INTEGER NOT NULL CHECK(clear_book IN (0,1)),
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
);
CREATE INDEX IF NOT EXISTS clarifications_by_market ON market_clarifications(market,id);
CREATE TABLE IF NOT EXISTS positions ( CREATE TABLE IF NOT EXISTS positions (
account TEXT REFERENCES accounts, market TEXT REFERENCES markets, outcome TEXT, account TEXT REFERENCES accounts, market TEXT REFERENCES markets, outcome TEXT,
quantity INTEGER NOT NULL CHECK(quantity >= 0), PRIMARY KEY(account,market,outcome) quantity INTEGER NOT NULL CHECK(quantity >= 0), PRIMARY KEY(account,market,outcome)
+74
View File
@@ -896,6 +896,8 @@ fn contested_resolution_blocks_both_payout_paths_until_a_verdict() {
assert_eq!(e.execute(decision).unwrap(), finalized); assert_eq!(e.execute(decision).unwrap(), finalized);
let resolved = e.execute(status).unwrap(); let resolved = e.execute(status).unwrap();
assert_eq!(resolved["winner"], "NO"); assert_eq!(resolved["winner"], "NO");
assert_eq!(resolved["payouts"], json!([0, 1]));
assert!(resolved["resolved_at_ms"].is_i64());
assert_eq!(resolved["proposals"][1]["verdict"], "NO"); assert_eq!(resolved["proposals"][1]["verdict"], "NO");
assert_eq!(resolved["proposals"][0]["challenger"], "bob"); assert_eq!(resolved["proposals"][0]["challenger"], "bob");
assert_eq!(e.execute(redeem).unwrap()["paid"], 200); assert_eq!(e.execute(redeem).unwrap()["paid"], 200);
@@ -3163,3 +3165,75 @@ fn midpoint_keeps_half_a_tick_after_reopening_the_book() {
assert_eq!(prices[&tokens[0]].as_deref(), Some("0.08505")); assert_eq!(prices[&tokens[0]].as_deref(), Some("0.08505"));
assert_eq!(prices[&tokens[1]].as_deref(), Some("0.91495")); assert_eq!(prices[&tokens[1]].as_deref(), Some("0.91495"));
} }
#[test]
fn published_clarification_clears_only_its_market_and_replays_after_restart() {
let dir = tempdir().unwrap();
let path = dir.path().join("clarifications.db");
let mut e = Exchange::open(&path).unwrap();
setup(&mut e);
for cmd in [
json!({"op":"list","id":"other-list","market":"other","rules":"other result"}),
json!({"op":"open","id":"start","market":"e"}),
order("rest-ask", "alice", "sell", 60, 2),
order("rest-bid", "bob", "buy", 40, 1),
json!({"op":"order","id":"other-bid","market":"other","outcome":"NO","account":"bob","side":"buy","price":10,"qty":1}),
] {
e.execute(cmd).unwrap();
}
let book = json!({"op":"clob_book","token_id":"eb:YES:e"});
let original = e.execute(book.clone()).unwrap();
let first = json!({"op":"publish_clarification","id":"n1","market":"e","content":"Use the official result sheet.","clear_book":false});
assert_eq!(e.execute(first).unwrap()["canceled_count"], 0);
assert_eq!(e.execute(book.clone()).unwrap()["asks"], original["asks"]);
let next = json!({"op":"publish_clarification","id":"n2","market":"e","content":"The result includes overtime.","clear_book":true});
let state = json!({"op":"resolution","market":"e"});
let connection = rusqlite::Connection::open(&path).unwrap();
connection.execute_batch("CREATE TRIGGER reject_clear BEFORE UPDATE OF status ON orders WHEN OLD.market='e' BEGIN SELECT RAISE(ABORT,'simulated release failure'); END;").unwrap();
assert!(e.execute(next.clone()).is_err());
assert_eq!(
e.execute(state.clone()).unwrap()["clarifications"]
.as_array()
.unwrap()
.len(),
1
);
assert_eq!(e.execute(book.clone()).unwrap()["bids"], original["bids"]);
connection
.execute_batch("DROP TRIGGER reject_clear")
.unwrap();
let receipt = e.execute(next.clone()).unwrap();
assert_eq!(receipt["canceled_count"], 2);
assert_eq!(e.execute(book.clone()).unwrap()["asks"], json!([]));
assert_eq!(e.execute(book.clone()).unwrap()["bids"], json!([]));
assert_eq!(
e.execute(json!({"op":"balance","account":"bob"})).unwrap()["available_micros"],
19_900_000
);
let other = e
.execute(json!({"op":"clob_book","token_id":"eb:NO:other"}))
.unwrap();
assert_eq!(other["bids"].as_array().unwrap().len(), 1);
e.execute(order("new-bid", "bob", "buy", 39, 1)).unwrap();
drop(e);
let mut e = Exchange::open(&path).unwrap();
assert_eq!(e.execute(next).unwrap(), receipt);
assert_eq!(
e.execute(book).unwrap()["bids"].as_array().unwrap().len(),
1
);
let resolution = e.execute(state).unwrap();
assert_eq!(resolution["rules"], "official result");
assert!(resolution["payouts"].is_null());
assert!(resolution["resolved_at_ms"].is_null());
assert_eq!(resolution["clarifications"][1]["clearBook"], true);
assert!(resolution["clarifications"][1]["txTimestamp"].is_null());
e.execute(json!({"op":"close","id":"end","market":"e"}))
.unwrap();
e.execute(json!({"op":"finalize","id":"void","market":"e","winner":"VOID"}))
.unwrap();
let settled = e.execute(json!({"op":"resolution","market":"e"})).unwrap();
assert_eq!(settled["payouts"], json!([1, 1]));
assert_eq!(settled["clarifications"], resolution["clarifications"]);
assert!(e.execute(json!({"op":"publish_clarification","id":"late","market":"e","content":"late note","clear_book":false})).is_err());
}
+11
View File
@@ -0,0 +1,11 @@
{"op":"list","id":"rain-list","market":"rain-final","rules":"Settle from the tournament's official final result."}
{"op":"fund","id":"rain-cash","account":"trader","cents":200}
{"op":"open","id":"rain-open","market":"rain-final"}
{"op":"order","id":"rain-bid","market":"rain-final","outcome":"YES","side":"buy","account":"trader","price":40,"qty":1}
{"op":"publish_clarification","id":"rain-context","market":"rain-final","content":"The final result includes overtime.","clear_book":false}
{"op":"publish_clarification","id":"rain-update","market":"rain-final","content":"The tournament result sheet uses UTC.","clear_book":true}
{"op":"resolution","market":"rain-final"}
{"op":"balance","account":"trader"}
{"op":"close","id":"rain-end","market":"rain-final"}
{"op":"finalize","id":"rain-result","market":"rain-final","winner":"YES"}
{"op":"resolution","market":"rain-final"}
+8
View File
@@ -377,3 +377,11 @@ Polymarket 的单资产最近成交接口规定,无成交时返回价格字符
本地以每个 UTC 采样窗口内最后一笔真实成交或模拟兑付为观测,保留其发生时刻。区间包含两端,只挂单的市场返回空数组。以第 121、149、245 秒的三个成交为例,1 分钟粒度返回第 149、245 秒两点,10 分钟粒度仅返回第 245 秒。市场作废时以实际裁决时刻记录 0.5。同毫秒的成交按执行序号排序,兑付优先。这个数据源、采样时刻和端点包含规则尚待生产逐点核对。 本地以每个 UTC 采样窗口内最后一笔真实成交或模拟兑付为观测,保留其发生时刻。区间包含两端,只挂单的市场返回空数组。以第 121、149、245 秒的三个成交为例,1 分钟粒度返回第 149、245 秒两点,10 分钟粒度仅返回第 245 秒。市场作废时以实际裁决时刻记录 0.5。同毫秒的成交按执行序号排序,兑付优先。这个数据源、采样时刻和端点包含规则尚待生产逐点核对。
官方 SDK 仓库有用户在同一已裁决资产上记录了两种结果:max 窗口按 60 分钟查询返回空,按 720 分钟查询有历史;后来该用户用显式起止时间取得更细数据。本地可返回已保存的全部历史。这项生产覆盖差异仍然存在。[原报告及后续复查](https://github.com/Polymarket/py-clob-client/issues/216) 官方 SDK 仓库有用户在同一已裁决资产上记录了两种结果:max 窗口按 60 分钟查询返回空,按 720 分钟查询有历史;后来该用户用显式起止时间取得更细数据。本地可返回已保存的全部历史。这项生产覆盖差异仍然存在。[原报告及后续复查](https://github.com/Polymarket/py-clob-client/issues/216)
### 裁决规则补充公告与兑付权重
[本地样例](examples/clarifications.jsonl)先挂出 0.40 的 YES 买单。第一条说明保留挂单,第二条要求清盘,账户收回预留的 0.40。两条说明都按发布时间保留,初始规则仍可查看。模拟操作员可在盘前、连续交易或封盘待裁决期间发布公告。重复的请求 ID 返回原回执;之后新挂的订单不会因重放旧公告被撤。[官方规则澄清说明](https://docs.polymarket.com/concepts/resolution#clarifications)
`GET /market-clarifications` 支持按数字市场 ID 筛选、翻页和按公告 ID 排序。clearBook 表示发布时是否要求清盘。createdAt 是本地发布时间,txTimestamp 和 txHash 留空。官方另外支持按事件、UMA 问题 ID、交易哈希及其他排序字段查询,这些筛选项尚待实现。[官方公告列表](https://docs.polymarket.com/api-reference/markets/list-market-clarifications) · [官方返回示例](https://docs.polymarket.com/market-data/market-details#market-clarifications)
本地 resolution 查询在获胜结果确定后同时返回已持久化的 resolved_at_ms 和 payouts;旧市场缺少时间记录时返回 null。兑付权重顺序为 YES、NO:YES 胜为 [1,0],NO 胜为 [0,1],作废为 [1,1],分母为两项之和。挑战期内的提案不会生成兑付权重。链上区块、UMA 仲裁回执及生产 Data API 的状态枚举尚待对照。[Polymarket UMA 适配器](https://github.com/Polymarket/uma-ctf-adapter/blob/main/src/UmaCtfAdapter.sol) · [生产裁决状态接口](https://docs.polymarket.com/api-reference/markets/get-resolution-state)