Uniswap / v3-periphery

🦄 🦄 🦄 Peripheral smart contracts for interacting with Uniswap v3
https://uniswap.org
GNU General Public License v2.0
1.17k stars 1.09k forks source link

Consult passes an invalid argument to IUniswapV3Pool.observe #258

Closed Developer5600 closed 2 years ago

Developer5600 commented 2 years ago
   uint32[] memory secondsAgos = new uint32[](2);
        secondsAgos[0] = secondsAgo;
        secondsAgos[1] = 0;

        (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) =
            IUniswapV3Pool(pool).observe(secondsAgos);

https://etherscan.io/address/0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8#readContract

Try passing in 32, it works Try passing in [32, 0] it reverts

confusion

.

hm... I am having trouble getting this to work in Remix, unfortunately, even trying to replicate the Oracle code.

Is there any example contract which implements this price oracle?

moodysalem commented 2 years ago

pass in 32,0, not [32, 0]

image

i could tell this was a js error in etherscan because the message looks like it's from ethers

Developer5600 commented 2 years ago

@moodysalem thank you. How can I call this in solidity? I'm trying


import "https://raw.githubusercontent.com/Uniswap/v3-periphery/main/contracts/libraries/OracleLibrary.sol";

  function getEthPriceTick() public view returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity) {
    return OracleLibrary.consult(poolAddress(), 32);
  }

and still get an error