コード例 #1
0
ファイル: CallInput.cs プロジェクト: ffabrizio/Nethereum
 public CallInput(string data, HexBigInteger gas, string addressFrom)
 {
    
     this.Data = data;
     this.Gas = gas;
     this.From = addressFrom;
 }
コード例 #2
0
        public virtual void ShouldDecode08ac7230489e80000()
        {
            var encode = new HexBigInteger(BigInteger.Parse("10000000000000000000"));
            var x = new HexBigInteger("0x8ac7230489e80000");
            Assert.Equal(encode.Value.ToString(), x.Value.ToString());


        }
コード例 #3
0
 public virtual void EncodingDecodingRandom10000Test()
 {
     var random = new Random();
     
     for (int i = 0; i < 10000; i++)
     {
         var number = random.Next(0, 100000);
         var value = i* number + "000000000000";
         var encode = new HexBigInteger(BigInteger.Parse(value)); 
        Assert.Equal(encode.Value.ToString(), new HexBigInteger(encode.HexValue).Value.ToString());
     }   
 }
コード例 #4
0
ファイル: IDService.cs プロジェクト: olibd/EphemerisLynxLib
        public async Task <string> RemoveAttributeAsync(byte[] key, HexBigInteger gasPrice = null, HexBigInteger valueAmount = null)
        {
            var    function = GetFunctionRemoveAttribute();
            string data     = function.GetData(key);

            return(await _transactionService.SignAndSendTransaction(data, contract.Address, valueAmount, gasPrice));
        }
コード例 #5
0
 public TransactionInput(string data, string addressTo, HexBigInteger value) : base(data, addressTo, value)
 {
 }
コード例 #6
0
        public async Task <BigInteger> GetBalanceInWei(IAccount account)
        {
            HexBigInteger balance = await Web3Instance(account).Eth.GetBalance.SendRequestAsync(account.Address);

            return(balance.Value);
        }
コード例 #7
0
ファイル: IDService.cs プロジェクト: olibd/EphemerisLynxLib
        public async Task <string> AddCertificateAsync(string attr, string cert, HexBigInteger gasPrice = null, HexBigInteger valueAmount = null)
        {
            var    function = GetFunctionAddCertificate();
            string data     = function.GetData(attr, cert);

            return(await _transactionService.SignAndSendTransaction(data, contract.Address, valueAmount, gasPrice));
        }
コード例 #8
0
ファイル: BlockParameter.cs プロジェクト: Nethereum/Nethereum
 public void SetValue(HexBigInteger blockNumber)
 {
     ParameterType = BlockParameterType.blockNumber;
     BlockNumber = blockNumber;
 }
コード例 #9
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
 public Task <string> SendRequestAsync(HexBigInteger type, string contractByteCode, string from,
                                       HexBigInteger gas, HexBigInteger maxFeePerGas, HexBigInteger maxPriorityFeePerGas, HexBigInteger value, HexBigInteger nonce)
 {
     return(TransactionManager.SendTransactionAsync(new TransactionInput(type, contractByteCode, null, from, gas,
                                                                         value, maxFeePerGas, maxPriorityFeePerGas)));
 }
コード例 #10
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
        public Task <TransactionReceipt> SendRequestAndWaitForReceiptAsync <TConstructorParams>(HexBigInteger type, string contractByteCode, string from,
                                                                                                HexBigInteger gas, HexBigInteger maxFeePerGas, HexBigInteger maxPriorityFeePerGas, HexBigInteger value, HexBigInteger nonce, TConstructorParams inputParams, CancellationTokenSource receiptRequestCancellationToken = null)
        {
            var transaction =
                _deployContractTransactionBuilder.BuildTransaction(type, contractByteCode, from, gas, maxFeePerGas, maxPriorityFeePerGas, value, nonce,
                                                                   inputParams);

            return(TransactionManager.TransactionReceiptService.DeployContractAndWaitForReceiptAsync(transaction,
                                                                                                     receiptRequestCancellationToken));
        }
コード例 #11
0
 public virtual void ShouldDecodeCompactNoTraillingZeros()
 {
     var x = new HexBigInteger("0x400");
     Assert.Equal(1024, x.Value); 
 }
コード例 #12
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
        public Task <TransactionReceipt> SendRequestAndWaitForReceiptAsync(string abi, string contractByteCode,
                                                                           string from, HexBigInteger gas, HexBigInteger gasPrice,
                                                                           HexBigInteger value, CancellationTokenSource receiptRequestCancellationToken = null,
                                                                           params object[] values)
        {
            var transaction =
                _deployContractTransactionBuilder.BuildTransaction(abi, contractByteCode, from, gas, gasPrice, value,
                                                                   values);

            return(TransactionManager.TransactionReceiptService.DeployContractAndWaitForReceiptAsync(transaction,
                                                                                                     receiptRequestCancellationToken));
        }
コード例 #13
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
 public Task <TransactionReceipt> SendRequestAndWaitForReceiptAsync(string contractByteCode, string from,
                                                                    HexBigInteger gas, HexBigInteger value, CancellationTokenSource receiptRequestCancellationToken = null)
 {
     _deployContractTransactionBuilder.EnsureByteCodeDoesNotContainPlaceholders(contractByteCode);
     return(TransactionManager.TransactionReceiptService.DeployContractAndWaitForReceiptAsync(
                new TransactionInput(contractByteCode, null, from, gas, value), receiptRequestCancellationToken));
 }
コード例 #14
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
        public Task <string> SendRequestAsync <TConstructorParams>(HexBigInteger type, string contractByteCode, string from,
                                                                   HexBigInteger gas, HexBigInteger maxFeePerGas, HexBigInteger maxPriorityFeePerGas, HexBigInteger value, HexBigInteger nonce, TConstructorParams inputParams)
        {
            var transaction =
                _deployContractTransactionBuilder.BuildTransaction(type, contractByteCode, from, gas, maxFeePerGas, maxPriorityFeePerGas, value, nonce,
                                                                   inputParams);

            return(TransactionManager.SendTransactionAsync(transaction));
        }
コード例 #15
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
        public Task <string> SendRequestAsync <TConstructorParams>(string contractByteCode, string from,
                                                                   HexBigInteger gas, HexBigInteger gasPrice, HexBigInteger value, TConstructorParams inputParams)
        {
            var transaction =
                _deployContractTransactionBuilder.BuildTransaction(contractByteCode, from, gas, gasPrice, value,
                                                                   inputParams);

            return(TransactionManager.SendTransactionAsync(transaction));
        }
コード例 #16
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
 public Task <string> SendRequestAsync(string contractByteCode, string from, HexBigInteger gas,
                                       HexBigInteger value)
 {
     return(TransactionManager.SendTransactionAsync(new TransactionInput(contractByteCode, null, from, gas,
                                                                         value)));
 }
コード例 #17
0
 public TransactionInput(string data, HexBigInteger gas, string adddressFrom) : base(data, gas, adddressFrom)
 {
 }
コード例 #18
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
        public Task <HexBigInteger> EstimateGasAsync <TConstructorParams>(string contractByteCode, string from,
                                                                          HexBigInteger gas, HexBigInteger value,
                                                                          TConstructorParams inputParams)
        {
            var callInput =
                _deployContractTransactionBuilder.BuildTransaction(contractByteCode, from, gas, null, value,
                                                                   inputParams);

            return(TransactionManager.EstimateGasAsync(callInput));
        }
コード例 #19
0
 public virtual void ShouldEncode0as0x0()
 {
     var x = new HexBigInteger(new BigInteger(0));
     Assert.Equal("0x0", x.HexValue);
 }
コード例 #20
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
        public Task <string> SendRequestAsync(string abi, string contractByteCode, string from, HexBigInteger gas,
                                              HexBigInteger gasPrice,
                                              HexBigInteger value,
                                              params object[] values)
        {
            var transaction =
                _deployContractTransactionBuilder.BuildTransaction(abi, contractByteCode, from, gas, gasPrice, value,
                                                                   values);

            return(TransactionManager.SendTransactionAsync(transaction));
        }
コード例 #21
0
ファイル: BlockParameter.cs プロジェクト: Nethereum/Nethereum
 public BlockParameter(HexBigInteger blockNumber)
 {
     SetValue(blockNumber);
 }
コード例 #22
0
        public void GetBlocksWithTransactionHashes()
        {
            // Setup.
            var sched  = new TestScheduler();
            var poller = sched.CreateColdObservable(
                OnNext(100, Unit.Default),
                OnNext(200, Unit.Default));

            var filterService      = new Mock <IEthApiFilterService>();
            var transactionService = new Mock <IEthApiTransactionsService>();

            var provider = new PendingTransactionStreamProvider(
                poller,
                filterService.Object,
                transactionService.Object);

            var filterId = new HexBigInteger(1337);

            filterService
            .Setup(x => x.NewPendingTransactionFilter.SendRequestAsync(null))
            .Returns(Task.FromResult(filterId));

            filterService
            .Setup(x => x.UninstallFilter.SendRequestAsync(filterId, null))
            .Returns(Task.FromResult(true));

            // Setup incoming pending transactions.
            var expectedTransactions = new[]
            {
                new[]
                {
                    new Transaction
                    {
                        TransactionHash = "0x1"
                    }
                },
                new[]
                {
                    new Transaction
                    {
                        TransactionHash = "0x2"
                    },
                    new Transaction
                    {
                        TransactionHash = "0x3"
                    }
                }
            };

            filterService.SetupSequence(x => x.GetFilterChangesForBlockOrTransaction.SendRequestAsync(filterId, null))
            .Returns(Task.FromResult(new[]
            {
                expectedTransactions[0][0].TransactionHash
            }))
            .Returns(Task.FromResult(new[]
            {
                expectedTransactions[1][0].TransactionHash, expectedTransactions[1][1].TransactionHash
            }));

            transactionService.Setup(x => x.GetTransactionByHash.SendRequestAsync(expectedTransactions[0][0].TransactionHash, null))
            .Returns(Task.FromResult(expectedTransactions[0][0]));
            transactionService.Setup(x => x.GetTransactionByHash.SendRequestAsync(expectedTransactions[1][0].TransactionHash, null))
            .Returns(Task.FromResult(expectedTransactions[1][0]));
            transactionService.Setup(x => x.GetTransactionByHash.SendRequestAsync(expectedTransactions[1][1].TransactionHash, null))
            .Returns(Task.FromResult(expectedTransactions[1][1]));

            // Record incoming data.
            var res = sched.Start(() => provider.GetPendingTransactions());

            res.Messages.AssertEqual(
                OnNext(100 + Subscribed, expectedTransactions[0][0]),
                OnNext(200 + Subscribed, expectedTransactions[1][0]),
                OnNext(200 + Subscribed, expectedTransactions[1][1]));

            filterService.Verify(x => x.NewPendingTransactionFilter.SendRequestAsync(null), Times.Once);
            filterService.Verify(x => x.UninstallFilter.SendRequestAsync(filterId, null), Times.Once);
        }
コード例 #23
0
ファイル: CallInput.cs プロジェクト: ffabrizio/Nethereum
 public CallInput(string data, string addressTo, string adddressFrom, HexBigInteger gas, HexBigInteger value) : this(data, addressTo, value)
 {
     this.From = adddressFrom;
     this.Gas = gas;
 }
コード例 #24
0
        public Task <string> InvalidateNameAsync(string addressFrom, string unhashedName, HexBigInteger gas = null,
                                                 HexBigInteger valueAmount = null)
        {
            var function = GetFunctionInvalidateName();

            return(function.SendTransactionAsync(addressFrom, gas, valueAmount, unhashedName));
        }
コード例 #25
0
ファイル: CallInput.cs プロジェクト: Nethereum/Nethereum
 public CallInput(string data, string adddressFrom, HexBigInteger gas, HexBigInteger value)
     : this(data, null, value)
 {
     From = adddressFrom;
     Gas = gas;
 }
コード例 #26
0
        public Task <string> StartAuctionsAsync(string addressFrom, byte[][] _hashes, HexBigInteger gas = null,
                                                HexBigInteger valueAmount = null)
        {
            var function = GetFunctionStartAuctions();

            return(function.SendTransactionAsync(addressFrom, gas, valueAmount, _hashes));
        }
コード例 #27
0
ファイル: IDService.cs プロジェクト: olibd/EphemerisLynxLib
        public async Task <string> CreateCertificateAsync(string _location, string _hash, string _owningAttribute, HexBigInteger gasPrice = null, HexBigInteger valueAmount = null)
        {
            var    function = GetFunctionCreateCertificate();
            string data     = function.GetData(_location, _hash, _owningAttribute);

            return(await _transactionService.SignAndSendTransaction(data, contract.Address, valueAmount, gasPrice));
        }
コード例 #28
0
        public Task <string> TransferRegistrarsAsync(string addressFrom, byte[] _hash, HexBigInteger gas = null,
                                                     HexBigInteger valueAmount = null)
        {
            var function = GetFunctionTransferRegistrars();

            return(function.SendTransactionAsync(addressFrom, gas, valueAmount, _hash));
        }
コード例 #29
0
ファイル: IDService.cs プロジェクト: olibd/EphemerisLynxLib
        public async Task <string> ChangeOwnerAsync(string newOwner, HexBigInteger gasPrice = null, HexBigInteger valueAmount = null)
        {
            var    function = GetFunctionChangeOwner();
            string data     = function.GetData(newOwner);

            return(await _transactionService.SignAndSendTransaction(data, contract.Address, valueAmount, gasPrice));
        }
コード例 #30
0
        public static async Task <string> TransferOfflineAsync(Web3 web3, string contractAddress, string recipient, BigInteger amount, HexBigInteger nonce, BigInteger gas, BigInteger gasPrice, string fromAddress = null)
        {
            IContractTransactionHandler <TransferFunction> transferHandler = web3.Eth.GetContractTransactionHandler <TransferFunction>();

            var transfer = new TransferFunction
            {
                To          = recipient,
                TokenAmount = amount,
                // Nethereum internally calls its Ethereum client by default to set the GasPrice, Nonce and estimate the Gas,
                // so if we want to sign the transaction for the contract completely offline we will need to set those values ourselves.
                Nonce    = nonce.Value,
                Gas      = gas,
                GasPrice = Web3.Convert.ToWei(gasPrice, UnitConversion.EthUnit.Gwei)
            };

            if (fromAddress != null)
            {
                transfer.FromAddress = fromAddress;
            }

            string result = await transferHandler.SignTransactionAsync(contractAddress, transfer).ConfigureAwait(false);

            return(result);
        }
コード例 #31
0
ファイル: EtherAsset.cs プロジェクト: HopeWallet/Hope-Desktop
 /// <summary>
 /// Transfers a specified amount of ether from the input UserWallet to a specified address.
 /// </summary>
 /// <param name="userWalletManager"> The wallet to send the ether from. </param>
 /// <param name="gasLimit"> The gas limit to use for this ether send transaction. </param>
 /// <param name="gasPrice"> The gas price to use for this ether send transaction. </param>
 /// <param name="address"> The address to send the ether to. </param>
 /// <param name="amount"> The amount of ether to send. </param>
 public override void Transfer(UserWalletManager userWalletManager, HexBigInteger gasLimit, HexBigInteger gasPrice, string address, decimal amount)
 {
     userWalletManager.SignTransaction <ConfirmTransactionPopup>(
         request => EthUtils.SendEther(request, gasLimit, gasPrice, userWalletManager.GetWalletAddress(), address, amount),
         gasLimit,
         gasPrice,
         SolidityUtils.ConvertToUInt(amount, 18),
         address,
         "",
         address,
         AssetAddress,
         amount,
         "ETH");
 }
コード例 #32
0
        public async Task <string> ChangeRequirementAsync(BigInteger _newRequired, HexBigInteger gasPrice = null, HexBigInteger valueAmount = null)
        {
            var    function = GetFunctionChangeRequirement();
            string data     = function.GetData(_newRequired);

            return(await _transactionService.SignAndSendTransaction(data, contract.Address, valueAmount, gasPrice));
        }
コード例 #33
0
 public TransactionInput(string data, string adddressFrom, HexBigInteger gas,
     HexBigInteger value) : base(data, adddressFrom, gas, value)
 {
 }
コード例 #34
0
ファイル: Event.cs プロジェクト: spaciousmtness/Nethereum
        public async Task <List <EventLog <T> > > GetFilterChanges <T>(HexBigInteger filterId) where T : new()
        {
            var logs = await EthGetFilterChanges.SendRequestAsync(filterId).ConfigureAwait(false);

            return(DecodeAllEvents <T>(logs));
        }
コード例 #35
0
ファイル: EnsService.cs プロジェクト: Nethereum/Nethereum
 public Task<string> SetSubnodeOwnerAsync(string addressFrom, byte[] node, byte[] label, string owner, HexBigInteger gas = null, HexBigInteger valueAmount = null) {
     var function = GetFunctionSetSubnodeOwner();
     return function.SendTransactionAsync(addressFrom, gas, valueAmount, node, label, owner);
 }
コード例 #36
0
        private void m_updateMinerTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                var miningParameters = GetMiningParameters();
                if (miningParameters == null)
                {
                    OnGetMiningParameterStatusEvent(this, false, null);
                    return;
                }

                var address   = miningParameters.EthAddress;
                var challenge = miningParameters.ChallengeNumberByte32String;
                var target    = miningParameters.MiningTargetByte32String;

                if (m_lastParameters == null || miningParameters.ChallengeNumber.Value != m_lastParameters.ChallengeNumber.Value)
                {
                    Program.Print(string.Format("[INFO] New challenge detected {0}...", challenge));
                    OnNewMessagePrefixEvent(this, challenge + address.Replace("0x", string.Empty));
                }

                if (m_customDifficulity == 0)
                {
                    DifficultyHex = miningParameters.MiningDifficulty.HexValue;

                    if (m_lastParameters == null || miningParameters.MiningTarget.Value != m_lastParameters.MiningTarget.Value)
                    {
                        Program.Print(string.Format("[INFO] New target detected {0}...", target));
                        OnNewTargetEvent(this, target);
                    }

                    if (m_lastParameters == null || miningParameters.MiningDifficulty.Value != m_lastParameters.MiningDifficulty.Value)
                    {
                        Program.Print(string.Format("[INFO] New difficulity detected ({0})...", miningParameters.MiningDifficulty.Value));
                        Difficulty = Convert.ToUInt64(miningParameters.MiningDifficulty.Value.ToString());

                        var calculatedTarget = m_maxTarget.Value / Difficulty;
                        if (calculatedTarget != miningParameters.MiningTarget.Value)
                        {
                            var newTarget = calculatedTarget.ToString();
                            Program.Print(string.Format("[INFO] Update target {0}...", newTarget));
                            OnNewTargetEvent(this, newTarget);
                        }
                    }
                }
                else
                {
                    Difficulty = m_customDifficulity;
                    var calculatedTarget = m_maxTarget.Value / m_customDifficulity;
                    var newTarget        = new HexBigInteger(new BigInteger(m_customDifficulity)).HexValue;

                    OnNewTargetEvent(this, newTarget);
                }

                m_lastParameters = miningParameters;
                OnGetMiningParameterStatusEvent(this, true, miningParameters);
            }
            catch (Exception ex)
            {
                Program.Print(string.Format("[ERROR] {0}", ex.Message));
            }
        }
コード例 #37
0
        public virtual void ShouldEncodeCompactNoTraillingZeros()
        {
            var x = new HexBigInteger(new BigInteger(1024));
            Assert.Equal("0x400", x.HexValue); // not "0x0400"

        }
コード例 #38
0
        public void SubmitSolution(string digest, string fromAddress, string challenge, string difficulty, string target, string solution, Miner.IMiner sender)
        {
            if (m_runFailover)
            {
                ((INetworkInterface)SecondaryPool).SubmitSolution(digest, fromAddress, challenge, difficulty, target, solution, sender);
                return;
            }

            if (string.IsNullOrWhiteSpace(solution) || solution == "0x")
            {
                return;
            }

            difficulty = new HexBigInteger(difficulty).Value.ToString(); // change from hex to base 10 numerics

            var success = false;
            var submitted = false;
            int retryCount = 0, maxRetries = 10;
            var devFee = (ulong)Math.Round(100 / Math.Abs(DevFee.UserPercent));

            do
            {
                try
                {
                    var poolAddress = fromAddress;
                    lock (this)
                    {
                        if (SubmittedShares == ulong.MaxValue)
                        {
                            SubmittedShares = 0u;
                        }
                        var minerAddress = ((SubmittedShares) % devFee) == 0 ? DevFee.Address : s_MinerAddress;

                        JObject submitShare;
                        submitShare = GetPoolParameter("submitShare", solution, minerAddress, digest, difficulty, challenge,
                                                       m_customDifficulity > 0 ? "true" : "false", Miner.Work.GetKingAddressString());

                        var response = Utils.Json.InvokeJObjectRPC(s_PoolURL, submitShare);
                        var result   = response.SelectToken("$.result")?.Value <string>();

                        success = (result ?? string.Empty).Equals("true", StringComparison.OrdinalIgnoreCase);
                        if (!success)
                        {
                            RejectedShares++;
                        }
                        SubmittedShares++;

                        Program.Print(string.Format("[INFO] {0} [{1}] submitted: {2}",
                                                    (minerAddress == DevFee.Address ? "Dev. fee share" : "Miner share"),
                                                    SubmittedShares,
                                                    (success ? "success" : "failed")));
#if DEBUG
                        Program.Print(submitShare.ToString());
                        Program.Print(response.ToString());
#endif
                    }
                    submitted = true;
                }
                catch (Exception ex)
                {
                    Program.Print(string.Format("[ERROR] {0}", ex.Message));

                    retryCount += 1;
                    if (retryCount < maxRetries)
                    {
                        Task.Delay(500);
                    }
                }
            } while (!submitted && retryCount < maxRetries);

            if (!success)
            {
                UpdateMiningParameters();
            }
        }
コード例 #39
0
 public virtual void ShouldDecode0x0()
 {
     var x = new HexBigInteger("0x0");
     Assert.Equal(0, x.Value);
 }
コード例 #40
0
        public async Task <Tuple <string, string> > DeployContract(int id, string address1, string address2, decimal amount1, decimal amount2, decimal totalAmount, HexBigInteger fee, string address, string pass)
        {
            var wallet  = new Wallet(Words, Password);
            var account = wallet.GetAccount(id);
            var web3    = new Web3(account, this.Network);

            var abi      = File.ReadAllText(this.AbiPath);
            var contract = File.ReadAllText(this.Contract);

            var estimateGas = await web3.Eth.DeployContract.EstimateGasAsync(abi, contract, address, new string[] { address1, address2 }, new[] { CurrencyConverter.EtherToWei(amount1), CurrencyConverter.EtherToWei(amount2) }, new BigInteger(this.RequiredSign), CurrencyConverter.EtherToWei(totalAmount));

            BigInteger price          = fee.Value / estimateGas;
            var        contractDeploy = await web3.Eth.DeployContract.SendRequestAsync(abi, contract, address, estimateGas, new HexBigInteger(price), new HexBigInteger(new BigInteger(Decimal.Zero)), new string[] { address1, address2 }, new [] { CurrencyConverter.EtherToWei(amount1), CurrencyConverter.EtherToWei(amount2) }, new BigInteger(this.RequiredSign), CurrencyConverter.EtherToWei(totalAmount));

            var receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(contractDeploy);

            try
            {
                while (receipt == null)
                {
                    Thread.Sleep(5000);
                    receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(contractDeploy);
                }
            }
            catch (Exception e)
            {
                return(null);
            }

            var contractAddress = receipt.ContractAddress;

            return(new Tuple <string, string>(contractAddress, abi));
        }
コード例 #41
0
ファイル: BlockParameter.cs プロジェクト: Nethereum/Nethereum
 public void SetValue(string blockNumberHex)
 {
     ParameterType = BlockParameterType.blockNumber;
     BlockNumber = new HexBigInteger(blockNumberHex);
 }
コード例 #42
0
ファイル: PublicResolver.cs プロジェクト: Nethereum/Nethereum
 public static Task<string> DeployContractAsync(Web3.Web3 web3, string addressFrom, string ensAddr, HexBigInteger gas = null, HexBigInteger valueAmount = null) 
 {
     return web3.Eth.DeployContract.SendRequestAsync(ABI, BYTE_CODE, addressFrom, gas, valueAmount , ensAddr);
 }
コード例 #43
0
ファイル: BlockParameter.cs プロジェクト: Nethereum/Nethereum
 public void SetValue(BigInteger blockNumber)
 {
     ParameterType = BlockParameterType.blockNumber;
     BlockNumber = new HexBigInteger(blockNumber);
 }
コード例 #44
0
ファイル: PublicResolver.cs プロジェクト: Nethereum/Nethereum
 public Task<string> SetAddrAsync(string addressFrom, byte[] node, string addr, HexBigInteger gas = null, HexBigInteger valueAmount = null) {
     var function = GetFunctionSetAddr();
     return function.SendTransactionAsync(addressFrom, gas, valueAmount, node, addr);
 }
コード例 #45
0
            public Task <string> RaiseEventMetadataAsync(string addressFrom, string creator, BigInteger id,
                                                         string description, string metadata, HexBigInteger gas = null, HexBigInteger valueAmount = null)
            {
                var function = GetFunctionRaiseEventMetadata();

                return(function.SendTransactionAsync(addressFrom, gas, valueAmount, creator, id, description, metadata));
            }
コード例 #46
0
ファイル: DeployContract.cs プロジェクト: huyen-pk/Nethereum
        public Task <string> SendRequestAsync(HexBigInteger type, string abi, string contractByteCode, string from,
                                              HexBigInteger gas, HexBigInteger maxFeePerGas, HexBigInteger maxPriorityFeePerGas, HexBigInteger value, HexBigInteger nonce, params object[] values)
        {
            var transaction = _deployContractTransactionBuilder.BuildTransaction(type, abi, contractByteCode, from, gas, maxFeePerGas, maxPriorityFeePerGas, value, nonce, values);

            return(TransactionManager.SendTransactionAsync(transaction));
        }
コード例 #47
0
ファイル: PublicResolver.cs プロジェクト: Nethereum/Nethereum
 public Task<string> SetContentAsync(string addressFrom, byte[] node, byte[] hash, HexBigInteger gas = null, HexBigInteger valueAmount = null) {
     var function = GetFunctionSetContent();
     return function.SendTransactionAsync(addressFrom, gas, valueAmount, node, hash);
 }
コード例 #48
0
 public static Task <string> DeployContractAsync(Web3.Web3 web3, string addressFrom, HexBigInteger gas = null,
                                                 HexBigInteger valueAmount = null)
 {
     return(web3.Eth.DeployContract.SendRequestAsync(ABI, BYTE_CODE, addressFrom, gas, valueAmount));
 }
コード例 #49
0
ファイル: CallInput.cs プロジェクト: Nethereum/Nethereum
 public CallInput(string data, string addressTo, HexBigInteger value) : this(data, addressTo)
 {
     Value = value;
 }
コード例 #50
0
        protected void HandleEvents(Event poRuleTreeEvent, Event poRuleSetEvent, Event poRuleEvent, HexBigInteger rtFilter, HexBigInteger rsFilter, HexBigInteger rlFilter)
        {
            var ruleTreeLog = poRuleTreeEvent.GetFilterChanges <CallRuleTreeEvent>(rtFilter).Result;
            var ruleSetLog  = poRuleSetEvent.GetFilterChanges <CallRuleSetEvent>(rsFilter).Result;
            var ruleLog     = poRuleEvent.GetFilterChanges <CallRuleEvent>(rlFilter).Result;

            // var ruleTreeLog = callRuleTreeEvent.GetAllChanges<CQS.Validation.CallRuleTreeEvent>(filterCRTAll).Result;
            // var ruleSetLog  = callRuleSetEvent.GetAllChanges<CQS.Validation.CallRuleSetEvent>(filterCRSAll).Result;
            // var ruleLog     = callRuleSetEvent.GetAllChanges<CQS.Validation.CallRuleEvent>(filterCRAll).Result;

            //
            //for (int i = 0; i < 5; ++i)
            //{
            //    System.Threading.Thread.Sleep(10000);
            //
            //    ruleTreeLog = callRuleTreeEvent.GetFilterChanges<CQS.Validation.CallRuleTreeEvent>(filterCRTAll).Result;
            //    ruleSetLog  = callRuleSetEvent.GetFilterChanges<CQS.Validation.CallRuleSetEvent>(filterCRSAll).Result;
            //    ruleLog     = callRuleSetEvent.GetFilterChanges<CQS.Validation.CallRuleEvent>(filterCRAll).Result;
            //}

            // Assert.Equal(1, ruleTreeLog.Count);

            if (ruleTreeLog.Count > 0)
            {
                System.Console.WriteLine("RuleTree Called that Belongs to : (" + ruleTreeLog[0].Event.TreeOwner + ")");
            }

            if (ruleSetLog.Count > 0)
            {
                foreach (EventLog <CallRuleSetEvent> TmpRuleSetEvent in ruleSetLog)
                {
                    System.Console.WriteLine("RuleSet Called with ID : (" + TmpRuleSetEvent.Event.RuleSetId + ")");
                }
            }

            if (ruleLog.Count > 0)
            {
                foreach (EventLog <CallRuleEvent> TmpRuleEvent in ruleLog)
                {
                    System.Console.WriteLine("Rule Called with ID : (" + TmpRuleEvent.Event.RuleId + ") and RuleType(" + TmpRuleEvent.Event.RuleType + ")");
                }
            }
        }
コード例 #51
0
ファイル: CallInput.cs プロジェクト: Nethereum/Nethereum
 public CallInput(string data, HexBigInteger gas, string addressFrom)
 {
     Data = data;
     Gas = gas;
     From = addressFrom;
 }
コード例 #52
0
ファイル: IDService.cs プロジェクト: olibd/EphemerisLynxLib
        public static async Task <string> DeployContractAsync(Web3 web3, string keyFrom, HexBigInteger gasPrice = null, HexBigInteger valueAmount = null)
        {
            string data = web3.Eth.DeployContract.GetData(BYTE_CODE, ABI);
            ITransactionService transactionService = new ConstantGasTransactionService(keyFrom, web3);

            return(await transactionService.SignAndSendTransaction(data, "", new HexBigInteger(0), gasPrice));
        }