Gas price index on a 7-day cycle
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dbba8b4376
commit
50c119697e
9 files changed
+32
-6
No files matched your search
@@ -18,8 +18,14 @@ namespace Decentralized.Domain
|
||||
public static class TxRules
|
||||
{
|
||||
/// <summary>手续费(信用点等值,按转出的币扣):档位基础价 × 拥堵倍数。</summary>
|
||||
public static double FeeCredits(FeeTier t, bool congested) =>
|
||||
(t == FeeTier.Slow ? Tuning.TxFeeSlow : t == FeeTier.Normal ? Tuning.TxFeeNormal : Tuning.TxFeeFast) * (congested ? Tuning.TxCongestedFeeMult : 1);
|
||||
public static double FeeCredits(FeeTier t, bool congested, double gas = 1) =>
|
||||
(t == FeeTier.Slow ? Tuning.TxFeeSlow : t == FeeTier.Normal ? Tuning.TxFeeNormal : Tuning.TxFeeFast) * gas * (congested ? Tuning.TxCongestedFeeMult : 1);
|
||||
|
||||
/// <summary>Gas 周期部分:phase 是这一局的起始相位(0..周期-1)。</summary>
|
||||
public static double GasCycle(int day, int phase) => 1 + Tuning.TxGasAmp * System.Math.Sin(2 * System.Math.PI * (day + phase) / Tuning.TxGasPeriod);
|
||||
|
||||
/// <summary>某天的 gas 指数:周期 × (1 ± 随机波动)。</summary>
|
||||
public static double Gas(int day, int phase, Rng rng) => GasCycle(day, phase) * (1 + Tuning.TxGasNoise * (rng.NextDouble() * 2 - 1));
|
||||
|
||||
/// <summary>需要的确认数:金额越大越多。</summary>
|
||||
public static int Confirmations(double valueCredits) =>
|
||||
|
||||
Reference in new issue
Block a user