These are chat archives for Nethereum/Nethereum

1st
Feb 2018
Art1987
@Art1987
Feb 01 2018 07:31
@juanfranblanco thanks for the info, after sending request I get an error or transaction fails
@jsheely did you find any solution?
Juan Blanco
@juanfranblanco
Feb 01 2018 12:01
@Art1987 there is a problem with the data you are sending, hence it reverts ( throws an exception)
Art1987
@Art1987
Feb 01 2018 13:20
thanks @juanfranblanco I have fixed - I have set hard coded gas and gasprice see bellow my code
    public virtual async Task<TransactionReceipt> SendTransactionAndWaitForReceiptAsync(string abi, string contractAddress, string methodName, int gas, int gasPrice, params object[] arguments)
        {
            try
            {
                var contract = _web3.Eth.GetContract(abi, contractAddress);
                var gasPriceHex = new HexBigInteger(UnitConversion.Convert.ToWei(gasPrice, UnitConversion.EthUnit.Kwei));
                var gasLimit = new HexBigInteger(UnitConversion.Convert.ToWei(gas, UnitConversion.EthUnit.Gwei));

                var multiplyFunction = contract.GetFunction(methodName);
                //Maybe we need to pass CancellationTokenSource
                var result = await multiplyFunction.SendTransactionAndWaitForReceiptAsync(_account.Address, gasPriceHex, gasLimit, null, null, arguments);

                return result;
            }
            catch (Exception exp)
            {
                //TODO: log here                
                Debug.Write(exp);
                throw;
            }

        }
Juan Blanco
@juanfranblanco
Feb 01 2018 17:44
@Art1987 but your issue was not that..
wasn't it
your issue was the multisignature that you could not deploy due to errors
check your transactions
Juan Blanco
@juanfranblanco
Feb 01 2018 17:55
"deploy" i mean send the transaction / estimate gas
AdamMacDon
@AdamMacDon
Feb 01 2018 21:24
Hello
I'm wondering if anyone know how to transfer ETH to a contract when deploying it
AdamMacDon
@AdamMacDon
Feb 01 2018 21:30
public IEnumerator CashOutTPW(string PrivateKey, decimal Value, string SenderAddress, System.Action<string> callback)
{
    // Amount of gas required to create the contract
    var gas = new HexBigInteger(900000);

    //this value var should equal 0.1 ether, it's in wei
    var TransValue = new decimal(100000000000000000);

    //build the transaction
    var transactionInput = contractTransactionBuilder.BuildTransaction(ABI, Bytecode, EthereumAddress, gas, null);
    var transactionSignedRequest = new TransactionSignedUnityRequest(NodeURL, EthereumPrivateKey, EthereumAddress);
    Debug.Log("Sending Deploy contract transaction...");
    yield return transactionSignedRequest.SignAndSendTransaction(transactionInput);
    if (transactionSignedRequest.Exception == null)
    {
        callback(transactionSignedRequest.Result);
    }
    else
    {
        throw new System.InvalidOperationException("Deploy contract tx failed:" + transactionSignedRequest.Exception.Message);
    }
}
This is my current code, I'm deploying the contract successfully, but can't figure out how to send ETH to it
AdamMacDon
@AdamMacDon
Feb 01 2018 21:46
nevermind, I figured it out
Thanks Juan for all the tutorials by the way!@