1

When fetching Uniswap v3 pool prices from its quoter contract via web3 I'm calling contract function which is not labeled as view or pure, however with web3 I'm doing like this:

price = quoter.functions.quoteExactInputSingle(
                token0,
                token1,
                feeTier,
                decimals,
                0
            ).call()

It is calling quoteExactInputSingle function without broadcasting a transaction and with no gas fees.

With Brownie, however, the function call looks like this:

price = quoter.quoteExactInputSingle(
                token0,
                token1,
                feeTier,
                decimals,
                0,
                {'from' : accounts[0]}
            ).return_value

and this sends a transaction, resulting in gas spendings. How can I make a function call similar to web3 example above but with Brownie?

Thank you!

1 Answer 1

1

ok, I figured that out, to explicitly make a call but not a transaction you need to pass all arguments in "call" method like that:

price = quoter.quoteExactInputSingle.call(
                token0,
                token1,
                feeTier,
                decimals,
                0
            )
1
  • Nice work. just remember to mark your answer as correct! Sep 23, 2021 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.