实测修正:交易对行去掉交易所名、互换损耗两位小数、读档时 DEX 侧池按新深度重设

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Opus 5.5 committed 2026-11-07 23:28:41 +08:00
1 parent fe82395d32
commit 709339b00c
5 files changed
+13 -10

No files matched your search

+6 -4
View File
@@ -82,14 +82,16 @@ namespace Decentralized.Domain
public Pool Main => Pools[0];
/// <summary>旧存档的稳定币对是恒定乘积池:按当前价换成 StableSwap 池。</summary>
public void UpgradeStablePools(int day)
/// <summary>旧存档:稳定币对是恒定乘积池,按当前价换成 StableSwap 池;其他 DEX 池按新深度重设(不等到夜里)。</summary>
public void UpgradeDexPools(int day)
{
for (int i = 0; i < Pools.Count; i++)
{
var p = Pools[i];
if (p.Venue != Venue.Dex || p.Stable || (p.Base != Assets.CRT && p.Base != Assets.CRA)) continue;
Pools[i] = Pool.CreateStable(Venue.Dex, p.Base, p.Quote, p.Price, Tuning.PoolDepth(day) * SideDepthShare, Tuning.StableFee, Tuning.StableAmp);
if (p.Venue != Venue.Dex || p.Stable) continue;
if (p.Base == Assets.CRT || p.Base == Assets.CRA)
Pools[i] = Pool.CreateStable(Venue.Dex, p.Base, p.Quote, p.Price, Tuning.PoolDepth(day) * SideDepthShare, Tuning.StableFee, Tuning.StableAmp);
else p.SetPrice(p.Price, Tuning.PoolDepth(day) * DepthShare(p));
}
}
+1 -1
View File
@@ -187,7 +187,7 @@ namespace Decentralized
if (!Data.Market.Main.Book)
Data.Market.Pools[0] = Pool.CreateBook(Venue.Exchange, Assets.PSC, Assets.CRC, Data.Market.Price, Tuning.PoolDepth(StoreStation.GetDayCounter()), Tuning.ExchangeFee);
Data.Market.AddPoinSpark(Data.Stable.Spark, StoreStation.GetDayCounter());
Data.Market.UpgradeStablePools(StoreStation.GetDayCounter());
Data.Market.UpgradeDexPools(StoreStation.GetDayCounter());
if (Data.Version < 3) { Data.Version = 3; Log.Info("存档数据升级到版本 3:保险基金、Poinbase 订单簿"); }
if (Data.Story == null) Data.Story = new StoryMods();
StoryMods.Current = Data.Story;
+3 -2
View File
@@ -388,7 +388,7 @@ namespace Decentralized
LiveLabel(b, () =>
{
var q = ParseAmount(out double v) ? m.Quote(_swapFrom, _swapTo, v) : null;
return q == null ? "" : L.T("swap.preview", Fmt.Num(q.Out), _swapTo, q.Hops, (q.Impact * 100).ToString("0.0", CultureInfo.InvariantCulture));
return q == null ? "" : L.T("swap.preview", Fmt.Num(q.Out), _swapTo, q.Hops, (q.Impact * 100).ToString("0.00", CultureInfo.InvariantCulture));
}, "swap_preview_dim");
b.AddButton(L.T("swap.go"), () => Swap());
}
@@ -426,7 +426,8 @@ namespace Decentralized
{
{
var p = pool;
b.AddLabel(L.T("trade.pair", p.Base, p.Quote, L.T("venue." + p.Venue)) + " " + L.T("trade.price", Fmt.Num(p.Price)) + " " + L.T("trade.fee", (p.Fee * 100).ToString("0.0#", CultureInfo.InvariantCulture)));
// 在 Poinbase 页里,交易所名不用再写一遍(行太长会被截断)
b.AddLabel(p.Base + "/" + p.Quote + " " + L.T("trade.price", Fmt.Num(p.Price)) + " " + L.T("trade.fee", (p.Fee * 100).ToString("0.0#", CultureInfo.InvariantCulture)));
LiveLabel(b, () => SpotPreview(p, true), "trade_preview_dim");
LiveLabel(b, () => SpotPreview(p, false), "trade_preview_dim");
b.BeginRow(4f);