예제 #1
0
        // Get withdrawal data.
        public WithdrawalData GetWithdrawalData(Bytes address)
        {
            nonEmptyFrozenBalance(address);

            WithdrawalData withdrawalData = FrozenBalance[address];

            return(withdrawalData);
        }
예제 #2
0
    public RedBagData(JSONNode data)
    {
        invitationCount = data["invitationCount"].AsInt;
        adsCount        = data["adsCount"].AsInt;
        signInDays      = data["signInDays"].AsInt;
        redBagCoins     = data["redBagCoins"].AsInt;
        var withdrawal = data["withdrawal"].AsArray;

        withdrawalDatas = new List <WithdrawalData>();
        foreach (JSONNode w in withdrawal)
        {
            WithdrawalData withdrawalData = new WithdrawalData(w);
            withdrawalDatas.Add(withdrawalData);
        }
    }
예제 #3
0
        //// Withdrawal methods

        // Freeze XTrophy.
        public void WithdrawalRequest(Int64 amount, String cardNumberHash)
        {
            Require(amount > 0, "Amount must be positive");

            Bytes sender = Info.Sender();

            Require(!FrozenBalance.ContainsKey(sender), "Withdrawal is already there");

            Int64 balance = Balance.GetOrDefault(sender, 0);

            Require(balance >= amount, "Not enough XTrophy for Withdrawal");

            Balance[sender]       = balance - amount;
            FrozenBalance[sender] = new WithdrawalData(amount, cardNumberHash);

            Log.Event("WithdrawalRequest", new EventData(sender, amount));
            Log.Event("Burn", new EventData(sender, amount));
        }