When trying to mock an UniswapV3Pool, to be accessed through the Oracle library, we're pointing to the observe(secondsAgo) function.
Code to be used in our contract:
(int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) = IUniswapV3Pool(pool).observe(secondsAgos);
UniswapV3Pool.sol :
Oracle.Observation[65535] public override observations;
[...]
/// LINE 236
function observe(uint32[] calldata secondsAgos)
external
view
override
noDelegateCall
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s)
{ ... }
When trying to smock the answer of the address, have tried multiple options:
pool.smocked.observe.will.return.with([ 1, 1 ])
pool.smocked.observe.will.return.with([ [1], [1] ])
'tickCumulatives':1,
'secondsPerLiquidityCumulativeX128s':1
})
pool.smocked.observe.will.return.with({
'tickCumulatives':[1,2,3],
'secondsPerLiquidityCumulativeX128s':[1,2,3]
})
I've tried also replacing the numbers with BigNumber.from(0) but still, every try I'm getting the following error Error: Transaction reverted: function returned an unexpected amount of data
When trying to mock an UniswapV3Pool, to be accessed through the Oracle library, we're pointing to the
observe(secondsAgo)function.Code to be used in our contract:
(int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) = IUniswapV3Pool(pool).observe(secondsAgos);UniswapV3Pool.sol :
When trying to smock the answer of the address, have tried multiple options:
pool.smocked.observe.will.return.with([ 1, 1 ])pool.smocked.observe.will.return.with([ [1], [1] ])I've tried also replacing the numbers with BigNumber.from(0) but still, every try I'm getting the following error
Error: Transaction reverted: function returned an unexpected amount of data