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:
1 parent
f0bbba2305
commit
6d8b05215c
24 files changed
+234
-81
No files matched your search
@@ -404,7 +404,7 @@ namespace Decentralized
|
||||
if (w.Avail(from) + 1e-9 < v) { _message = L.T(frozenPay(w, from) ? "msg.frozen" : "msg.balance"); Open(); return; }
|
||||
_message = L.T("hw.wait");
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill { Contract = true, Asset = from, Amount = v, Summary = L.T("hw.swap", Fmt.Num(v), from, Fmt.Num(q.Out), to), Execute = pw => DoSwap(from, to, v, pw) });
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill { Contract = true, Party = Session.Data.Address("dex"), Asset = from, Amount = v, Summary = L.T("hw.swap", Fmt.Num(v), from, Fmt.Num(q.Out), to), Execute = pw => DoSwap(from, to, v, pw) });
|
||||
}
|
||||
|
||||
private static void DoSwap(string from, string to, double v, Wallet w)
|
||||
@@ -770,7 +770,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = v, Spend = deposit ? v : 0, FeeAsset = deposit ? null : BestFeeAsset(w),
|
||||
Contract = true, Party = Session.Data.Address("yield:" + p.Name), Asset = Assets.CRC, Amount = v, Spend = deposit ? v : 0, FeeAsset = deposit ? null : BestFeeAsset(w),
|
||||
Summary = L.T(deposit ? "pool.sum.in" : "pool.sum.out", p.Name, Fmt.Num(deposit ? v : p.Of(w.Address))),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -836,7 +836,7 @@ namespace Decentralized
|
||||
var w = d.Hot;
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Contract = true, Party = Session.Data.Address("airdrop:" + a.Name), Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Summary = L.T("air.auth.sum", a.Name, ApproveText(a.Approve, a.Asset)),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -858,7 +858,7 @@ namespace Decentralized
|
||||
var w = d.Hot;
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Contract = true, Party = Session.Data.Address("airdrop:" + a.Name), Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Summary = L.T("air.sum", a.Name, ApproveText(a.Approve, a.Asset)),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -881,7 +881,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Contract = true, Party = Session.Data.Address("airdrop:" + ap.Spender), Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Summary = L.T("air.revoke.sum", ap.Spender, ap.Asset),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -960,7 +960,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(iw),
|
||||
Contract = true, Party = Session.Data.Address("ponzi"), Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(iw),
|
||||
Summary = L.T("ponzi.rug.sum", Fmt.Num(pz.Pool)),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -997,7 +997,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = Tuning.PonziAdCost,
|
||||
Contract = true, Party = Session.Data.Address("ponzi"), Asset = Assets.CRC, Amount = Tuning.PonziAdCost,
|
||||
Summary = L.T("ponzi.start.sum", (rate * 100).ToString("0", CultureInfo.InvariantCulture), Fmt.Num(Tuning.PonziAdCost)),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -1160,7 +1160,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRT, Amount = price, Summary = L.T("intel.brief.sum", Fmt.Num(price)),
|
||||
Contract = true, Party = Session.Data.Address("intel"), Asset = Assets.CRT, Amount = price, Summary = L.T("intel.brief.sum", Fmt.Num(price)),
|
||||
Execute = pw =>
|
||||
{
|
||||
if (pw.Avail(Assets.CRT) + 1e-9 < price) { _message = L.T("intel.err.funds"); Open(); return; }
|
||||
@@ -1185,7 +1185,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRT, Amount = price, Summary = L.T("intel.tip.sum", Fmt.Num(price), PredictGame.Question(m)),
|
||||
Contract = true, Party = Session.Data.Address("intel"), Asset = Assets.CRT, Amount = price, Summary = L.T("intel.tip.sum", Fmt.Num(price), PredictGame.Question(m)),
|
||||
Execute = pw =>
|
||||
{
|
||||
int day = StoreStation.GetDayCounter();
|
||||
@@ -1214,7 +1214,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = v,
|
||||
Contract = true, Party = Session.Data.Address("predict"), Asset = Assets.CRC, Amount = v,
|
||||
Summary = L.T("predict.sum.buy", PredictGame.Question(m), side, Fmt.Num(v)),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -1237,7 +1237,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Contract = true, Party = Session.Data.Address("predict"), Asset = Assets.CRC, Amount = 0, Spend = 0, FeeAsset = BestFeeAsset(w),
|
||||
Summary = L.T("predict.sum.sell", PredictGame.Question(m)),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -1568,9 +1568,25 @@ namespace Decentralized
|
||||
if (own != null) return WalletWindow.NameOf(own);
|
||||
if (ChainAddress.Same(a, d.Address("pool"))) return L.T("explorer.pool");
|
||||
if (ChainAddress.Same(a, d.Address("poinbase"))) return "Poinbase";
|
||||
if (d.Addresses.TryGetValue("mixer", out var mx) && ChainAddress.Same(a, mx)) return L.T("explorer.mixer");
|
||||
if (d.Addresses.TryGetValue("platform", out var pf) && ChainAddress.Same(a, pf)) return L.T("merchant.Platform");
|
||||
if (d.Addresses.TryGetValue("desk", out var dk) && ChainAddress.Same(a, dk)) return L.T("explorer.desk");
|
||||
// 其他收款方、合约按登记的键取名:空投、收益池带自己的名字
|
||||
string key = d.Addresses.FirstOrDefault(kv => ChainAddress.Same(kv.Value, a)).Key;
|
||||
if (key != null)
|
||||
{
|
||||
if (key.StartsWith("airdrop:") || key.StartsWith("yield:")) return key.Substring(key.IndexOf(':') + 1);
|
||||
switch (key)
|
||||
{
|
||||
case "mixer": return L.T("explorer.mixer");
|
||||
case "platform": return L.T("merchant.Platform");
|
||||
case "desk": return L.T("explorer.desk");
|
||||
case "dex": return "DEX";
|
||||
case "staking": return L.T("stake.h");
|
||||
case "cra": return L.T("mint.h");
|
||||
case "predict": return L.T("predict.h");
|
||||
case "intel": return L.T("intel.h");
|
||||
case "ponzi": return L.T("ponzi.h");
|
||||
case "tumbler": return "Tumbler";
|
||||
}
|
||||
}
|
||||
var sl = d.Black.Sellers.FirstOrDefault(x => ChainAddress.Same(x.Name, a));
|
||||
return sl != null ? L.T("merchant." + sl.Type) : null;
|
||||
}
|
||||
@@ -2195,7 +2211,12 @@ namespace Decentralized
|
||||
pw.Add(src, -needSrc); pw.Add(coin, got); pw.RecordBuy(coin, got, credits);
|
||||
CandleChart.Trade(src, credits); CandleChart.Trade(coin, credits);
|
||||
Log.Info($"自动换币:{needSrc:0.####} {src} → {got:0.####} {coin}({credits:0} 信用点等值)");
|
||||
// 一次签名两步:经 DEX 换币,再付给这家商家;分别记账
|
||||
d.Chain(pw.Address, d.Address("dex"), src, needSrc);
|
||||
d.Chain(d.Address("dex"), pw.Address, coin, got);
|
||||
var paying = SaveData.Snapshot(pw);
|
||||
var r2 = ExecGroup(seller, lines, mode, coin, pw);
|
||||
d.ChainDiff(pw, paying, AddressOf(d, seller));
|
||||
Finish(CartMessage(r2.items, r2.failed));
|
||||
},
|
||||
});
|
||||
@@ -2593,7 +2614,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = coin, Amount = v, Spend = into ? v : 0, FeeAsset = into ? null : BestFeeAsset(w),
|
||||
Contract = true, Party = Session.Data.Address("staking"), Asset = coin, Amount = v, Spend = into ? v : 0, FeeAsset = into ? null : BestFeeAsset(w),
|
||||
Summary = into && q != null ? L.T("stake.sum.via", Fmt.Num(v), coin, Fmt.Num(q.Out)) : L.T(into ? "stake.sum.in" : "stake.sum.out", Fmt.Num(v), Tuning.CraUnlockDays),
|
||||
Execute = pw =>
|
||||
{
|
||||
@@ -2630,7 +2651,7 @@ namespace Decentralized
|
||||
Open();
|
||||
WalletWindow.OpenForBill(new WalletWindow.Bill
|
||||
{
|
||||
Contract = true, Asset = mint ? Assets.CRC : Assets.CRA, Amount = mint ? needCrc : v, Spend = mint ? needCrc : v,
|
||||
Contract = true, Party = Session.Data.Address("cra"), Asset = mint ? Assets.CRC : Assets.CRA, Amount = mint ? needCrc : v, Spend = mint ? needCrc : v,
|
||||
Summary = mint ? L.T("mint.sum.in", Fmt.Num(v), Fmt.Num(needCrc), Fmt.Num(needSpark), minD, maxD) : L.T("mint.sum.out", Fmt.Num(v), Tuning.CraUnlockDays),
|
||||
Execute = pw =>
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user