These are chat archives for Nethereum/Nethereum

4th
Oct 2018
TarrahArshad
@TarrahArshad
Oct 04 2018 03:33
@juanfranblanco hi i will take get all transaction for erc20 or ether can u help me how to ?
and one question ur sdk have a webhook notification for notify my code for i know wallet deposited ? i will charg my client wallet if deposit
Culé
@ngocketit_twitter
Oct 04 2018 07:02
Hi. I'm trying to use Nethereum 3.0.0-rc1 with Unity 2018, net461 and got this error: "Loading script assembly "Assets/Plugins/System.Net.Http.dll" failed!". Any ideas? Thanks!
Culé
@ngocketit_twitter
Oct 04 2018 07:37
Anyone pls? I could also use the latest 2.x version but how can I get the DLLs?
Christ0ff
@Christ0ff
Oct 04 2018 07:46
I still need some help with calling the Proxy contract. Each of the trials you can see below ends up with "VM Exception while processing transaction: revert". I must do something wrong, but don't know yet. I'm running it on ganache-cli newest version.
The function in the original contract does not return value (and QueryAsync<FunctionMessage, TReturn> expects it) it only emits the event with those passed parameters.
My code:
     var proxyContract = _fixture.Web3.Eth.GetContract(msAbi, "0xf82070eb79c3216a9945fe7086a6ee2099b90e1d");
            var encoder = new Bytes32TypeEncoder();

            PublishBidFunction publishBidFunction = new PublishBidFunction()
            {
                BidderId = encoder.Encode("1"),
                BidId = encoder.Encode("10"),
                Date = DateTimeOffset.UtcNow.AddDays(1).ToUnixTimeMilliseconds(),
                Volumes = new List<BigInteger>() { new BigInteger(10)},
                Prices = new List<BigInteger>() { new BigInteger(20) }
                };


            var contractHandler = _fixture.Web3.Eth.GetContractHandler(proxyContract.Address);
            var result = await contractHandler.QueryAsync<PublishBidFunction, byte[]>(publishBidFunction)
                .ConfigureAwait(false);

            //var z = await contractHandler.SendRequestAndWaitForReceiptAsync(publishBidFunction,null);

            //var handler = _fixture.Web3.Eth.GetContractTransactionHandler<PublishBidFunction>();
            //var res = await handler.SendRequestAndWaitForReceiptAsync(proxyContract.Address, publishBidFunction);

[Function("publishLocalBidDayAhead")]
    public class PublishBidFunction : FunctionMessage
    {
        [Parameter("bytes32", "bidderID", 1, true)]
        public byte[] BidderId { get; set; }

        [Parameter("bytes32", "bidID", 2, true)]
        public byte[] BidId { get; set; }

        [Parameter("uint256", "date", 3, true)]
        public BigInteger Date { get; set; }

        [Parameter("int256[]", "volumes", 4)]
        public List<BigInteger> Volumes { get; set; }

        [Parameter("uint256[]", "prices", 5)]
        public List<BigInteger> Prices { get; set; }
    }
Juan Blanco
@juanfranblanco
Oct 04 2018 09:02
@TarrahArshad no we don't have any, but we may in the future (that was one of the first thoughts about Nethereum :) )
@ngocketit_twitter let me update the net461 sample
you can use the normal sample here
if you want
@Christ0ff can you check in Geth
Juan Blanco
@juanfranblanco
Oct 04 2018 09:07
oh ignore that..
can you post your contracts so i can see what you want to do
if you are pointing to the proxy this is not going to work with a query (that was my example of interacting with other contracts)
so if your proxy has a default function just
SendTransactionAsync to your contract
BTW your byte[] can be a string and it will be converted from string to a utf8 byte array
(might change that in the future.. so it can be overriden using partials)
Juan Blanco
@juanfranblanco
Oct 04 2018 09:12
also you don't need the indexed as true as that is only for events
Culé
@ngocketit_twitter
Oct 04 2018 09:12
@juanfranblanco Thanks a lot! I am actually playing around with that "normal" version of the sample but now wanna add support for HD wallet. So I downloaded the DLLs for 3.0.0-rc1, put them in the Plugins folder but then Unity game me that error.
Christ0ff
@Christ0ff
Oct 04 2018 09:15

@juanfranblanco Here is a proxy one:
contract BidsProxy is Proxy {

constructor(int256 _initialVersion, address _initialImplementation)
Proxy(_initialVersion, _initialImplementation)
public
{
}

}

and the Proxied contract itself

contract Bids is LocalBidderRole,WholesaleBidderRole {
event LogLocalBidDayAhead(bytes32 indexed bidderID,
bytes32 indexed bidID,
uint256 indexed date,
int256[] volumes,
uint256[] prices);

function publishLocalBidDayAhead(bytes32 bidderID, 
                                 bytes32 bidID,
                                 uint256 date,
                                 int256[] volumes,
                                 uint256[] prices) 
onlyLocalBidder
public 
{
    require (volumes.length > 0, "Arrays must be non-empty.");
    require (volumes.length == prices.length, "Arrays must be of equal length.");
    emit LogLocalBidDayAhead(bidderID, 
                             bidID,
                             date,
                             volumes,
                             prices);
}

the Proxy contract you already know:
/**

* @dev Fallback function allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
function () 
payable 
public 
{
    address _impl = _currentImplementation;
    require(_impl != address(0));
    bytes memory data = msg.data;

    assembly {
      let result := delegatecall(gas, _impl, add(data, x20), mload(data), 0, 0)
      let size := returndatasize
      let ptr := mload(x40)
      returndatacopy(ptr, 0, size)
      switch result
      case 0 { revert(ptr, size) }
      default { return(ptr, size) }
    }
}
Juan Blanco
@juanfranblanco
Oct 04 2018 10:01
@Christ0ff yes the query wont work, have you tried SendTransactionAndWaitForReceipt
you should see the LogLocalBidDayAhead in the receipt
Juan Blanco
@juanfranblanco
Oct 04 2018 11:18
i have removed system.net.http and unity library
also added another workaround for https connection with infura
Culé
@ngocketit_twitter
Oct 04 2018 11:20
Excellent @juanfranblanco! I'll give it a try and let you know if it works.
Culé
@ngocketit_twitter
Oct 04 2018 11:57
@juanfranblanco It seems to work nicely, at least for the HD wallet part. Thanks a lot! Btw, do you know why this doesn't work, though it seems to work in the old sample version: Web3 web3 = new Web3(account, "https://ropsten.infura.io/<api_key>"); string[] accounts = await web3.Eth.Accounts.SendRequestAsync();. The returned accounts has zero items.
Juan Blanco
@juanfranblanco
Oct 04 2018 12:10
@ngocketit_twitter you wont get any accounts from ropsten
in infura, that is aimed for your local client
mainly all the accounts you have in your keystore
Culé
@ngocketit_twitter
Oct 04 2018 12:12
Alright! That is. I was testing with local ganache-cli back then. Thank you!
hawthornetr
@hawthornetr
Oct 04 2018 13:57
Anyone know how to enumerate all tokens (scanning the node) from neth? Basically I am just trying to build a list of tokens, I know how to get the contract address, just not sure how to use that contract address to get the symbol and name, just trying to get basic info about tokens (erc 20+)
im already spinning blocks, getting each block , each tx, checking if its a creation contract, but not sure how to pull symbol etc from the contract
hawthornetr
@hawthornetr
Oct 04 2018 14:41
Maybe I should also upgrade my api ;)
thanks for the link
Sergio Piedrahita
@spied001
Oct 04 2018 17:52
@juanfranblanco is there a limit when sending rpc requests, I am getting "Error occurred when trying to send rpc requests(s)" when I call EstimateGasAsync?
Juan Blanco
@juanfranblanco
Oct 04 2018 18:09
@spied001 what are you connecting to? what client? or what test chain? infura?
Sergio Piedrahita
@spied001
Oct 04 2018 18:31
@juanfranblanco is test chain, I am using geth
I have one node just sending transactions and a couple of other nodes mining, the code I have calculates the gas before calling SendTransactionAndWaitForReceiptAsync
Sergio Piedrahita
@spied001
Oct 04 2018 18:39
From testing right now I know that the limit is between 500-1000 requests, so I was wondering if the limit can be set or if it is just a limitation the implementation of geth or nethereum or some other library
Sergio Piedrahita
@spied001
Oct 04 2018 18:45
@juanfranblanco is a private chain where all the development/testing is being done
hawthornetr
@hawthornetr
Oct 04 2018 20:56
@Dave-Whiffin \u0006��\u0003 that is the result of var name = Task.Run(async () => await contractHandler.QueryRawAsync<NameFunction, StringBytes32Decoder, string>()).Result; for 0x3c7771db7f343b79003e8c9ba787bbe47764ed05 using the sample provided in that code
any ideas whats up?