Beispiel #1
0
        public async Task <bool> ExchangeTokens(
            string contractAddress,
            string exchangeMarketAddress,
            string txOwner,
            string sourceTokenAddress,
            string targetTokenAddress,
            BigInteger exchangeRate,
            BigInteger tokenAmount)
        {
            ExchangeToken exchangeToken = new ExchangeToken(this.HttpRPCEndpoint, this.account);

            try
            {
                var txReciept = await exchangeToken.ExchangeTokens(
                    contractAddress,
                    exchangeMarketAddress,
                    txOwner,
                    sourceTokenAddress,
                    targetTokenAddress,
                    exchangeRate,
                    tokenAmount);

                //adding log to OffChain

                return(true);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public async Task <string> DeployExchangeTokenContract()
        {
            ExchangeToken exchangeToken = new ExchangeToken(this.HttpRPCEndpoint, this.account);

            try
            {
                var txReceipt = await exchangeToken.DeployContractAsync();

                return(txReceipt.ContractAddress);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }