Merge third-party yield pools and own scheme into one Yield page with two sub-tabs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f8bbf295e3
commit
5c7e7bf360
4 files changed
+46
-13
No files matched your search
@@ -360,7 +360,6 @@ namespace Decentralized
|
||||
{
|
||||
var sc = Session.Data.Scams;
|
||||
var pools = sc.Pools.Where(p => !p.Closed || p.Pending.Any(q => ChainAddress.Same(q.Wallet, w.Address))).ToList();
|
||||
l.AddSeparator();
|
||||
l.AddHeader(L.T("pool.h"));
|
||||
if (pools.Count == 0) { l.AddLabel(L.T("pool.none")); return; }
|
||||
TableHeader(l, PoolW, L.T("pool.col.name"), L.T("pool.col.rate"), L.T("pool.col.reserve"), L.T("pool.col.lock"), L.T("pool.col.audit"), L.T("pool.col.mine"));
|
||||
@@ -485,7 +484,32 @@ namespace Decentralized
|
||||
});
|
||||
}
|
||||
|
||||
private static bool PonziVisible => Session.Data != null && (Session.Data.Ponzi.Open || Session.Data.Ponzi.Done || StoreStation.GetDayCounter() >= Tuning.PonziMinDay);
|
||||
private enum YieldTab { Pools, Mine }
|
||||
private static YieldTab _yieldTab = YieldTab.Pools;
|
||||
|
||||
/// <summary>理财页:两个子页。"存钱"是 NPC 开的第三方收益池,你存进去吃利息(可能是骗局);"自己发"是你当庄开高息理财(庞氏),下层的人往你这儿存。</summary>
|
||||
private static void YieldPage(CustomUIBuilder b)
|
||||
{
|
||||
b.BeginRow();
|
||||
foreach (YieldTab t in Enum.GetValues(typeof(YieldTab)))
|
||||
{
|
||||
var tab = t;
|
||||
string name = L.T("yield.sub." + t.ToString().ToLowerInvariant());
|
||||
b.AddButton(tab == _yieldTab ? $"[{name}]" : name, () => { _yieldTab = tab; _message = null; Open(); });
|
||||
}
|
||||
b.End();
|
||||
if (_yieldTab == YieldTab.Mine) { PonziPage(b); return; }
|
||||
var d = Session.Data;
|
||||
var w = d.Hot;
|
||||
int day = StoreStation.GetDayCounter();
|
||||
Columns(b, l => YieldPools(l, w, day), r =>
|
||||
{
|
||||
r.AddHeader(L.T("pool.side.h"));
|
||||
r.AddLabel(L.T("predict.acct", WalletWindow.NameOf(w), Fmt.Num(w.Avail(Assets.CRC))));
|
||||
AmountRow(r);
|
||||
});
|
||||
}
|
||||
|
||||
private static double _ponziRate = 0.04;
|
||||
private static bool _ponziConfirm;
|
||||
|
||||
@@ -513,7 +537,7 @@ namespace Decentralized
|
||||
double risk = Ponzi.ReportChance(pz.Rate, pz.Pool, day);
|
||||
l.AddLabel(L.T("ponzi.wind", L.T(risk < 0.05 ? "ponzi.wind.low" : risk < 0.10 ? "ponzi.wind.mid" : "ponzi.wind.high")));
|
||||
}
|
||||
else l.AddLabel(L.T(pz.Done ? "ponzi.done" : "ponzi.idle", Tuning.PonziMinDay));
|
||||
else l.AddLabel(pz.Done ? L.T("ponzi.done") : day < Tuning.PonziMinDay ? L.T("ponzi.early", Tuning.PonziMinDay) : L.T("ponzi.idle"));
|
||||
}, r =>
|
||||
{
|
||||
if (pz.Open)
|
||||
@@ -546,7 +570,7 @@ namespace Decentralized
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pz.Done) return;
|
||||
if (pz.Done || day < Tuning.PonziMinDay) return;
|
||||
r.AddHeader(L.T("ponzi.open"));
|
||||
r.BeginRow();
|
||||
foreach (double rate in Tuning.PonziRates)
|
||||
@@ -984,11 +1008,10 @@ namespace Decentralized
|
||||
if (_web3Tab == Web3Tab.Mixer && !Unlock.MixerUnlocked) _web3Tab = Web3Tab.Trade;
|
||||
if (_web3Tab == Web3Tab.Black && !Unlock.BlackUnlocked) _web3Tab = Web3Tab.Trade;
|
||||
if (_web3Tab == Web3Tab.Predict && !PredictGame.Available(StoreStation.GetDayCounter())) _web3Tab = Web3Tab.Trade;
|
||||
if (_web3Tab == Web3Tab.Ponzi && !PonziVisible) _web3Tab = Web3Tab.Trade;
|
||||
b.BeginRow();
|
||||
foreach (Web3Tab t in Enum.GetValues(typeof(Web3Tab)))
|
||||
{
|
||||
if ((t == Web3Tab.Mixer && !Unlock.MixerUnlocked) || (t == Web3Tab.Black && !Unlock.BlackUnlocked) || (t == Web3Tab.Predict && !PredictGame.Available(StoreStation.GetDayCounter())) || (t == Web3Tab.Ponzi && !PonziVisible)) continue;
|
||||
if ((t == Web3Tab.Mixer && !Unlock.MixerUnlocked) || (t == Web3Tab.Black && !Unlock.BlackUnlocked) || (t == Web3Tab.Predict && !PredictGame.Available(StoreStation.GetDayCounter()))) continue;
|
||||
var tab = t;
|
||||
string name = L.T("web3.sub." + t.ToString().ToLowerInvariant());
|
||||
b.AddButton(tab == _web3Tab ? $"[{name}]" : name, () => { _web3Tab = tab; _message = null; _edit = null; Open(); });
|
||||
@@ -996,7 +1019,7 @@ namespace Decentralized
|
||||
b.End();
|
||||
if (_web3Tab == Web3Tab.Stake) { StakePage(b); return; }
|
||||
if (_web3Tab == Web3Tab.Predict) { PredictPage(b); return; }
|
||||
if (_web3Tab == Web3Tab.Ponzi) { PonziPage(b); return; }
|
||||
if (_web3Tab == Web3Tab.Ponzi) { YieldPage(b); return; }
|
||||
if (_web3Tab == Web3Tab.Airdrop) { AirdropPage(b); return; }
|
||||
if (_web3Tab == Web3Tab.Mining) { ReportPage(b); return; }
|
||||
if (_web3Tab == Web3Tab.Mixer) { MixerPage(b); return; }
|
||||
@@ -1565,7 +1588,6 @@ namespace Decentralized
|
||||
}
|
||||
l.AddSeparator();
|
||||
l.AddLabel(L.T("spark.price", Fmt.Num(st.Spark)));
|
||||
YieldPools(l, w, day);
|
||||
}, r =>
|
||||
{
|
||||
r.AddHeader(L.T("stake.ops", WalletWindow.NameOf(w)));
|
||||
|
||||
Reference in new issue
Block a user