Open deemru opened 2 years ago
lastCumulativePrice
else
TWAP_INTERVAL
getTwapSpotPrice()
throw()
valueOrElse(0)
lastCumulativePrice
calculation inelse
branch: https://github.com/Tsunami-Exchange/tsunami-contracts/blob/6858c82c92dc31f45b8294c6fc4239e9f9f64714/contracts/ride/vAMM2.ride#L588-L595 You only need to update the price in this branch: https://github.com/Tsunami-Exchange/tsunami-contracts/blob/6858c82c92dc31f45b8294c6fc4239e9f9f64714/contracts/ride/vAMM2.ride#L596TWAP_INTERVAL
+ 1 to guarantee you always have a value out ofTWAP_INTERVAL
range: https://github.com/Tsunami-Exchange/tsunami-contracts/blob/6858c82c92dc31f45b8294c6fc4239e9f9f64714/contracts/ride/vAMM2.ride#L577getTwapSpotPrice()
if it is not possible it would be better tothrow()
here (and do not usevalueOrElse(0)
in this function at all): https://github.com/Tsunami-Exchange/tsunami-contracts/blob/6858c82c92dc31f45b8294c6fc4239e9f9f64714/contracts/ride/vAMM2.ride#L486