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