Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();


            NearCoinContract = web3.Eth.GetContract(abi, contractAddress);

            web3.TransactionManager.DefaultGas = 210000;  //设置默认消耗的gas
        }
Esempio n. 2
0
        public async Task <string> SendTransaction(Nethereum.Contracts.Contract contract, string functionName, string from, HexBigInteger gas, HexBigInteger value, params object[] functionInput)
        {
            // TODO: name is invalid, gas is invalid
            var function = contract.GetFunction(functionName);

            Logger.Information($"Calling {functionName}() at gas {gas.Value.ToString()}");

            try {
                return(await function.SendTransactionAsync(from, gas, value, functionInput));
            }
            catch (Exception e) {
                Logger.Error(e, $"Failed to call {functionName}() at gas {gas}");
            }

            return(null);
        }
Esempio n. 3
0
 public async Task Initialize(byte[] privatekey, string contractAddress)
 {
     agentAccount = new Nethereum.Web3.Accounts.Account(privatekey);
     web3         = new Nethereum.Web3.Web3(agentAccount);
     contract     = web3.Eth.GetContract(abi, contractAddress);
 }
Esempio n. 4
0
 public PlayCoin()
 {
     ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;
     web3     = new Nethereum.Web3.Web3("https://ropsten.infura.io/6Eln6WdYNncc1lY1zSih");
     contract = web3.Eth.GetContract(abi, "0x9378e4cf1b5991eb5f1483c885426a9d23d87534");
 }