Poinbase 订单簿、永续滑点减半、预测盘滑点调整、浏览器统一记账

- Poinbase 主池改为订单簿冲击曲线:第 38 天 2 PSC 约 0.1%、200 PSC 约 4%
- 永续成交深度 50,000 → 100,000,滑点减半
- 预测盘 b = 1.8 × 额度 / ln 2(5% 盘口押 50 约贵 10%),消息价 2% / 5% / 12%
- 统一记账函数 Chain:钱包每一笔进出写进浏览器和钱包记录,合约调用按执行前后余额差记账;Ponero 不上浏览器;账本上限 500
- 存档数据版本 3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Opus 5.5 committed 2026-11-07 22:39:18 +08:00
1 parent f0bbba2305
commit 6d8b05215c
24 files changed
+234 -81

No files matched your search

+13 -6
View File
@@ -32,6 +32,8 @@ namespace Decentralized
/// <summary>合约调用时钱包里实际要花掉的数量(默认等于 Amount;取出质押这类不花币的调用为 0)和付手续费的币(默认用 Asset)。</summary>
public double? Spend;
public string FeeAsset;
/// <summary>合约调用的对方地址(DEX、质押池、预测市场等):执行前后钱包余额的差按它记账。为空表示执行里自己记账。</summary>
public string Party;
public Action<Wallet> Execute;
}
@@ -550,12 +552,9 @@ namespace Decentralized
double amt = tx.To != null ? Math.Min(tx.Amount, w.Avail(tx.Asset)) : 0;
if (tx.To != null)
{
TxRules.Record(w.History, new TxRecord { Addr = tx.To, Asset = tx.Asset, Amount = amt, Day = day });
d.Ledger.Add(new LedgerEntry { Block = tx.Block, Day = day, From = w.Address, To = tx.To, Asset = tx.Asset, Amount = amt, Fee = tx.FeeAsset == tx.Asset ? tx.Fee : 0 });
var mine = d.Own(tx.To);
if (mine != null) TxRules.Record(mine.History, new TxRecord { Addr = w.Address, Asset = tx.Asset, Amount = amt, Day = day, In = true });
d.Chain(w.Address, tx.To, tx.Asset, amt, tx.FeeAsset == tx.Asset ? tx.Fee : 0, tx.Block);
// 地址投毒:链上公开的转账被人盯上,过一两天会收到一笔来自相似地址的 0 币转入
else if (d.Rng.Chance(Scales.R(Tuning.TxPoisonChance))) d.PoisonPlans.Add(new PoisonPlan { Wallet = w.Address, Target = tx.To, Day = day + d.Rng.Range(1, Tuning.TxPoisonDelayMax) });
if (d.Own(tx.To) == null && d.Rng.Chance(Scales.R(Tuning.TxPoisonChance))) d.PoisonPlans.Add(new PoisonPlan { Wallet = w.Address, Target = tx.To, Day = day + d.Rng.Range(1, Tuning.TxPoisonDelayMax) });
}
if (tx.Bill != null && !tx.Bill.Contract)
{
@@ -563,7 +562,15 @@ namespace Decentralized
double extra = amt - tx.Bill.Amount;
if (extra > 1e-9) Wallet.Transfer(w, new Wallet(), tx.Asset, extra, Session.Price);
}
if (tx.Bill != null) { tx.Bill.Execute(w); return; }
if (tx.Bill != null)
{
// 账单执行前后的余额差记账:合约调用按对方地址记进出;转账付款那一笔上面已经记过,只记对方转回来的(如 Ponero 兑换处换出的币)
var before = SaveData.Snapshot(w);
tx.Bill.Execute(w);
string party = tx.Bill.Contract ? tx.Bill.Party : tx.To;
if (party != null) d.ChainDiff(w, before, party, inOnly: !tx.Bill.Contract);
return;
}
if (tx.To == null) return;
var own = d.Own(tx.To);
Wallet target = own ?? (IsPoinbase(tx.To) ? d.Poinbase : new Wallet());