Files
probably-decentralized/src/Decentralized.Domain/Ledger.cs
T
ZHU MINCHAOandClaude Opus 5.5 6d8b05215c 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>
2026-11-07 22:39:18 +08:00

38 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace Decentralized.Domain
{
/// <summary>浏览器里的一条链上转账:区块、天、转出方、转入方、币种、数额、手续费。</summary>
public sealed class LedgerEntry
{
public long Block;
public int Day;
public string From, To, Asset;
public double Amount, Fee;
}
/// <summary>
/// 全局账本:只记真实发生的转账(玩家钱包的每一笔进出,含合约调用和地址投毒的 0 币转入),不生成 NPC 流水;最新的在前,超过 <see cref="Tuning.LedgerMax"/> 条丢最旧的。
/// </summary>
public sealed class Ledger
{
public List<LedgerEntry> Entries = new List<LedgerEntry>();
public void Add(LedgerEntry e)
{
if (e == null || e.Amount < 0) return;
Entries.Insert(0, e);
if (Entries.Count > Tuning.LedgerMax) Entries.RemoveRange(Tuning.LedgerMax, Entries.Count - Tuning.LedgerMax);
}
/// <summary>某个地址相关(转出或转入)的记录,最新的在前,最多 limit 条。address 为空时返回全部最近的。</summary>
public List<LedgerEntry> Of(string address, int limit)
{
if (string.IsNullOrWhiteSpace(address)) return Entries.Take(limit).ToList();
return Entries.Where(e => ChainAddress.Same(e.From, address) || ChainAddress.Same(e.To, address)).Take(limit).ToList();
}
}
}