Exemple #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;
     }));
 }
Exemple #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;
     }));
 }
Exemple #3
0
 public async Task <IEnumerable <IUserContract> > GetUsedContracts()
 {
     return(await _storage.GetDataAsync(UserContractEntity.GeneratePartitionKey()));
 }
Exemple #4
0
 public Task SaveContract(string address)
 {
     return(_storage.InsertAsync(UserContractEntity.Create(address)));
 }