示例#1
0
 public Task DecreaseBalance(string address, BigInteger amount)
 {
     return(_storage.ReplaceAsync(UserContractEntity.GeneratePartitionKey(), address, entity =>
     {
         entity.BalanceStr = BigInteger.Max(0, entity.Balance - amount).ToString();
         return entity;
     }));
 }
示例#2
0
 public Task SetBalance(string address, BigInteger balance)
 {
     return(_storage.ReplaceAsync(UserContractEntity.GeneratePartitionKey(), address, entity =>
     {
         entity.BalanceStr = balance.ToString();
         entity.LastCheck = DateTime.UtcNow;
         return entity;
     }));
 }
示例#3
0
 public async Task <IEnumerable <IUserContract> > GetUsedContracts()
 {
     return(await _storage.GetDataAsync(UserContractEntity.GeneratePartitionKey()));
 }