public async Task <IActionResult> GetByAddressAsync([FromRoute] string externalTokenAddress) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } IExternalToken token = await _externalTokenService.GetByAddressAsync(externalTokenAddress); return(Ok(Map(token))); }
public async Task <IActionResult> CreateTransferContract([FromBody] CreateExternalTokenModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } BigInteger amount = BigInteger.Parse(model.InitialSupply); IExternalToken token = await _externalTokenService.CreateExternalTokenAsync(model.TokenName, model.Divisibility, model.TokenSymbol, model.Version, model.AllowEmission, amount); return(Ok(Map(token))); }
private ExternalTokenModel Map(IExternalToken token) { return(new ExternalTokenModel { ContractAddress = token.ContractAddress, Id = token.Id, Name = token.Name, InitialSupply = token.InitialSupply, TokenSymbol = token.TokenSymbol, Version = token.Version, Divisibility = token.Divisibility, }); }
public static ExternalTokenEntity CreateEntity(IExternalToken token) { return(new ExternalTokenEntity { PartitionKey = GeneratePartitionKey(), Id = token.Id, Name = token.Name, ContractAddress = token.ContractAddress, Divisibility = token.Divisibility, InitialSupply = token.InitialSupply, TokenSymbol = token.TokenSymbol, Version = token.Version }); }
public async Task <IExternalToken> GetByAddressAsync(string externalTokenAddress) { IExternalToken result = await _tokenRepository.GetAsync(externalTokenAddress); return(result); }
public async Task SaveAsync(IExternalToken token) { var entity = ExternalTokenEntity.CreateEntity(token); await _table.InsertAsync(entity); }