Exemplo n.º 1
0
        public async Task CompleteTransfer(TransferContractUserAssignment assignment)
        {
            ICoin coinAdapter = await _coinRepository.GetCoinByAddress(assignment.CoinAdapterAddress);

            if (coinAdapter == null)
            {
                throw new Exception($"CoinAdapterAddress {assignment.CoinAdapterAddress} does not exis");
            }

            string coinAbi;

            if (coinAdapter.ContainsEth)
            {
                coinAbi = _settings.EthAdapterContract.Abi;
            }
            else
            {
                coinAbi = _settings.TokenAdapterContract.Abi;
            }

            var ethereumContract = _web3.Eth.GetContract(coinAbi, assignment.CoinAdapterAddress);
            var function         = ethereumContract.GetFunction("setTransferAddressUser");
            //function setTransferAddressUser(address userAddress, address transferAddress) onlyowner{

            string transactionHash =
                await function.SendTransactionAsync(_settings.EthereumMainAccount,
                                                    assignment.UserAddress, assignment.TransferContractAddress);

            var transferContract = await _transferContractRepository.GetAsync(assignment.TransferContractAddress);

            transferContract.AssignmentHash = transactionHash;

            await _transferContractRepository.SaveAsync(transferContract);
        }
Exemplo n.º 2
0
        public async Task PushContract(TransferContractUserAssignment transferContract)
        {
            string transferContractSerialized = Newtonsoft.Json.JsonConvert.SerializeObject(transferContract);

            await _queue.PutRawMessageAsync(transferContractSerialized);
        }