private async Task ProcessMessageAsync(Erc20ContractCreatedMessage arg) { _log.Info($"Got Erc20ContractCreatedMessage: {arg.Address} "); var token = new Erc20Token { Address = arg.Address, AssetId = null, BlockHash = arg.BlockHash, BlockTimestamp = arg.BlockTimestamp, DeployerAddress = arg.DeployerAddress, TokenDecimals = (int?)arg.TokenDecimals, TokenName = arg.TokenName, TokenSymbol = arg.TokenSymbol, TokenTotalSupply = arg.TokenTotalSupply, TransactionHash = arg.TransactionHash }; // todo: refactor into event generation + projection logic var existingContract = await _erc20TokenService.GetByTokenAddressAsync(token.Address); if (existingContract == null) { await _erc20TokenService.AddAsync(token); } }
public async Task <IActionResult> Add([FromBody] Erc20Token token) { await _erc20TokenService.AddAsync(token); return(Ok()); }