第十阶段 stage 1(三):钱包物品化、连接钱包、空投逐个授权、矿机收款地址
This commit is contained in:
1 parent
f732304f38
commit
59dd3c05bc
20 files changed
+462
-55
No files matched your search
@@ -13,6 +13,8 @@ namespace Decentralized.Domain
|
||||
public double Approve;
|
||||
public double Reward;
|
||||
public bool Scam, Claimed;
|
||||
/// <summary>已为这个空投授权的钱包地址(签过授权合约);空 = 还没授权。领取要用授权过的钱包。</summary>
|
||||
public string AuthWallet;
|
||||
}
|
||||
|
||||
/// <summary>钱包对某个合约的授权。钓鱼授权到 DrainDay 那晚把这种币转走,撤销后作废。</summary>
|
||||
@@ -97,6 +99,17 @@ namespace Decentralized.Domain
|
||||
return s.Substring(0, k) + swaps[char.ToLowerInvariant(s[k])] + s.Substring(k + 1);
|
||||
}
|
||||
|
||||
/// <summary>这个钱包是否已为这个空投授权。</summary>
|
||||
public static bool Authorized(Airdrop a, Wallet w) => a != null && w != null && !string.IsNullOrEmpty(a.AuthWallet) && ChainAddress.Same(a.AuthWallet, w.Address);
|
||||
|
||||
/// <summary>为空投授权钱包(签完授权合约后调用);换了钱包要重新授权。</summary>
|
||||
public static bool Authorize(Airdrop a, Wallet w, int day)
|
||||
{
|
||||
if (a == null || w == null || a.Claimed || day > a.Expire) return false;
|
||||
a.AuthWallet = w.Address;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>领取:正规空投给奖励(干净的 CRC),钓鱼空投给一点点诱饵;有授权的记一条授权,钓鱼授权定下转走的那晚。</summary>
|
||||
public Approval Claim(Airdrop a, Wallet w, int day, Rng rng, out double got)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user