by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 07 12:38

    juanfranblanco on master

    #646 fix hdwallet added blazor … (compare)

  • Aug 28 15:28

    juanfranblanco on master

    Signing performance (start) + … Merge branch 'master' of https:… (compare)

  • Aug 19 20:23

    juanfranblanco on master

    boolean flag to get compressed … Merge pull request #642 from me… (compare)

  • Aug 07 16:28

    juanfranblanco on master

    Handling empty reponses eom, re… (compare)

  • Aug 07 15:54

    juanfranblanco on master

    Websocket client, allow to rece… Merge branch 'master' of https:… (compare)

  • Aug 03 10:57

    juanfranblanco on master

    Revert "JsonRpc/Logger: fix pos… Merge pull request #638 from Ne… (compare)

  • Aug 03 10:57

    juanfranblanco on revert-637-fixPossibleNRE

    Revert "JsonRpc/Logger: fix pos… (compare)

  • Aug 03 10:12

    juanfranblanco on master

    JsonRpc/Logger: fix possible Nu… Merge pull request #637 from kn… (compare)

  • Jul 27 16:14

    juanfranblanco on master

    Removing rogue struct (compare)

  • Jul 27 16:11

    juanfranblanco on master

    Updating the streaming websocke… Removing tuples to support 3.5 … (compare)

  • Jul 10 09:36

    juanfranblanco on master

    Extra signature validation on t… Continue trying to get data eve… (compare)

  • Jul 06 06:22

    juanfranblanco on master

    Adding Geth txn Pool (compare)

  • Jul 06 06:22

    juanfranblanco on 3.8.0

    (compare)

  • Jul 06 05:32

    juanfranblanco on master

    refactors GSNTransactionManager… updates GSN readme added descriptive exceptions, r… and 1 more (compare)

  • Jul 06 05:31

    juanfranblanco on master

    Update Frameworks.props (compare)

  • Jul 02 19:15

    juanfranblanco on master

    Changing error return (compare)

  • Jul 02 17:32

    juanfranblanco on master

    Removing 1.1 from ENS EIP712 tuples do not support ne… (compare)

  • Jul 02 16:44

    juanfranblanco on master

    Upgrading versions (compare)

  • Jun 15 16:46

    juanfranblanco on master

    removing comment (compare)

  • Jun 15 16:44

    juanfranblanco on master

    #629 Adding Public Wallet + Ad… (compare)

Juan Blanco
@juanfranblanco
also check the pricing..
maybe that is why is failing
ohhh
and remember the Units
Dai needs to be converted to 18 decimals
Behemoth
@notBehemoth_twitter
var swapHandler = web3.Eth.GetContractTransactionHandler<SwapExactTokensForETHFunction>();
            var swapDTO = new SwapExactTokensForETHFunction()
            {                
                AmountIn = Web3.Convert.ToWei(30),
                AmountOutMin = 0,
                Path = new List<string>
                {
                    "0xad6d458402f60fd3bd25163575031acdce07538d", //DAI
                    "0xc778417e063141139fce010982780140aa0cd5ab" //WETH
                },
                To = myWallet,
                Deadline = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds() + 20
            };

            var transactionSwapReceipt = await swapHandler.SendRequestAndWaitForReceiptAsync(uniswapContractAddress, swapDTO);

            Console.WriteLine("Transaction hash is: " + transactionSwapReceipt.TransactionHash);
I'm doing this and keep on getting 'TRANSFER_FROM_FAILED' error
ohh
18 decimals
how do I do that?
Juan Blanco
@juanfranblanco
same as Web3.Convert.ToWei(30)
Eth is 18 decimals
Behemoth
@notBehemoth_twitter
yeah ok so I am doing it the right way
Juan Blanco
@juanfranblanco
yeah but you have approved
9999
and you are trying to convert
Behemoth
@notBehemoth_twitter
ohh damn the approval also has to be in Web3.Convert.ToWei(9999) ???
Juan Blanco
@juanfranblanco
30 * 1000000000000000000
Behemoth
@notBehemoth_twitter
if i want to approve 9999 DAI
Juan Blanco
@juanfranblanco
you need to convert 9999 to wei
Behemoth
@notBehemoth_twitter
haha super
will try now
Juan Blanco
@juanfranblanco
most tokens have the same number of decimals
Behemoth
@notBehemoth_twitter
yeah 18
Juan Blanco
@juanfranblanco
to make it easier
but some don't like USDT which has 6 i believe
Mad_Crude_Trader
@MadCrudeTrader_twitter
Hi all, how can I get the gas used for a transaction?
When i call a function on a contract, I would like to find out how much gas I sed? Thanks
just use web3.Eth.Trasansactions.GetTransactionReceipt.SendRequestAsync(txnHash)
Mad_Crude_Trader
@MadCrudeTrader_twitter
thank you very much
Behemoth
@notBehemoth_twitter

@juanfranblanco Thank you very much. I am now successfully able to swap both ways on uniswap - WETH <--> DAI, unless the transaction fails due to gas shortage. Is this the correct way to supply gas values to the transaction? -

var ethSwapHandler = web3.Eth.GetContractTransactionHandler<SwapExactETHForTokensFunction>();
            var ethSwapDTO = new SwapExactETHForTokensFunction()
            {
                AmountToSend = Web3.Convert.ToWei(1),
                AmountOutMin = 0,
                Path = new List<string>
                {
                    "0xc778417e063141139fce010982780140aa0cd5ab", //WETH
                    "0xad6d458402f60fd3bd25163575031acdce07538d" //DAI
                },
                To = myWallet,
                Deadline = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds() + 20,
                Gas = 1000000, //high value so transaction never fails. unless gas limits go real crazy.
                GasPrice = 300 //max gas from etherscan gas oracle + 200
            };

Since the mission here is to have highly performant code and fastest transaction times, is it better to let Nethereum decide the gas values or should I fetch the gas values from Etherscan gas api, add 100-200 to it and input them above?
Also, same question about the transaction nonce.

I will of course add a failover that incase Etherscan api fails to return data then it'll just let Nethereum decide on gas values.
Juan Blanco
@juanfranblanco
All depends
Nonce is much easier to let it Nethereum manage it for you
Gas.. this will be estimated for you by Nethereum before making the call, you can do what you have done and set a high gas amount and get it returned
If set it won't estimate it, it will use the amount given
GasPrice, Nethereum uses GetGasPrice from the client, using the Etherscan api it will give you better results
note the GasPrice is in wei
Behemoth
@notBehemoth_twitter
yeah since I want the whole code to run as fast as possible, I want to remove calculations from Nethereum that I can do myself faster and maybe better.
Coming to Nonce, yes it is easier for me to let Nethereum manage it, but if I want faster timings should I calculate it myself somehow?
Ohh damn, I keep forgetting the wei conversion :P
Juan Blanco
@juanfranblanco
yeah you could have your own nonce counter
here is the nonce manager of Nethereum that can be assigned if wanted
mainly modify it so it does not make the call
to get the latest to verify
Behemoth
@notBehemoth_twitter
@juanfranblanco for now I'm letting Nethereum take care of the nonce for me. I'll revisit it after I am done building my app.
On https://uniswap.org/docs/v2/smart-contracts/router02/ for the function 'swapExactETHForTokens' we can see that the function returns an array of amounts (The input token amount and all subsequent output token amounts). How can I get these values? Thanks.
sz.sahaj
@saszer
through unity nethereum(following 461 example).
Is there a way to get time to a particular block? or otherway around like blocknumber of 1 minute from now?
Juan Blanco
@juanfranblanco
@notBehemoth_twitter you cannot get the values for a transaction
you can get the values if you query it
first
Juan Blanco
@juanfranblanco
@saszer check this.. https://blog.cotten.io/timing-future-events-in-ethereum-5fbbb91264e7 is not an easy answer as there is average as blocks are not mined exactly every 12 seconds