The UniV3 TWAP window can be a different size than the ChainlinkTWAP window, unless the ChainlinkTWAP has already been updated in the current block.
Even if the ChainlinkTWAP was updated in the current block, the total length of the ChainlinkTWAP(and what should be passed to UniV3.getMedian()) would be now - chainlinkObservations[earliestObservationIndex()-1].timestamp
To cover all cases, the UniV3 TWAP should be calculated from
chainlinkObservations[earliestObservationIndex()-1].timestamp to chainlinkObservations[chainlinkObservations.length-1].timestamp
However, the start and stop of a window isn't possible w/ current OracleLibrary.consult()
Would need to create another version of OracleLibrary.consult() that will take a beginning and start time as parameters.
The UniV3 TWAP window can be a different size than the
ChainlinkTWAP
window, unless theChainlinkTWAP
has already been updated in the current block.Even if the ChainlinkTWAP was updated in the current block, the total length of the ChainlinkTWAP(and what should be passed to
UniV3.getMedian()
) would benow - chainlinkObservations[earliestObservationIndex()-1].timestamp
To cover all cases, the UniV3 TWAP should be calculated from
chainlinkObservations[earliestObservationIndex()-1].timestamp
tochainlinkObservations[chainlinkObservations.length-1].timestamp
However, the start and stop of a window isn't possible w/ current
OracleLibrary.consult()
Would need to create another version ofOracleLibrary.consult()
that will take a beginning and start time as parameters.https://github.com/money-god/geb-uniswap-median/blob/b78acc31df43692dcc08796f971350f63bf5757d/src/UniV3ChainlinkTWAPConverterFeed.sol#L97