示例#1
0
        public async Task DeployContract()
        {
            var deploymentMessage = new TokenDeployment {
                TotalSupply = 10
            };
            var deploymentHandler  = _web3.Eth.GetContractDeploymentHandler <TokenDeployment>();
            var transactionReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage);

            _contractAddress = transactionReceipt.ContractAddress;
        }
示例#2
0
        private async Task <string> DeployToken(int supply)
        {
            var deploymentMessage = new TokenDeployment
            {
                TotalSupply = supply
            };
            var deploymentHandler  = web3.Eth.GetContractDeploymentHandler <TokenDeployment>();
            var transactionReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(deploymentMessage);

            var contractAddress = transactionReceipt.ContractAddress;

            return(contractAddress);
        }
 public static async Task<TokenService> DeployContractAndGetServiceAsync(Nethereum.Web3.Web3 web3, TokenDeployment tokenDeployment, CancellationTokenSource cancellationTokenSource = null)
 {
     var receipt = await DeployContractAndWaitForReceiptAsync(web3, tokenDeployment, cancellationTokenSource);
     return new TokenService(web3, receipt.ContractAddress);
 }
 public static Task<string> DeployContractAsync(Nethereum.Web3.Web3 web3, TokenDeployment tokenDeployment)
 {
     return web3.Eth.GetContractDeploymentHandler<TokenDeployment>().SendRequestAsync(tokenDeployment);
 }
 public static Task<TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.Web3 web3, TokenDeployment tokenDeployment, CancellationTokenSource cancellationTokenSource = null)
 {
     return web3.Eth.GetContractDeploymentHandler<TokenDeployment>().SendRequestAndWaitForReceiptAsync(tokenDeployment, cancellationTokenSource);
 }