enforce oracle check
This commit is contained in:
parent
ec71bcd287
commit
0d7a8e4814
2 changed files with 27 additions and 25 deletions
|
|
@ -347,7 +347,7 @@ contract BaseLineLP {
|
|||
}
|
||||
|
||||
|
||||
function _checkPriceStability(int24 currentTick) internal view returns (bool) {
|
||||
function _isPriceStable(int24 currentTick) internal view returns (bool) {
|
||||
uint32 timeInterval = 300; // 5 minutes in seconds
|
||||
uint32[] memory secondsAgo = new uint32[](2);
|
||||
secondsAgo[0] = timeInterval; // 5 minutes ago
|
||||
|
|
@ -366,7 +366,7 @@ contract BaseLineLP {
|
|||
// Fetch the current tick from the Uniswap V3 pool
|
||||
(uint160 sqrtPriceX96, int24 currentTick, , , , , ) = pool.slot0();
|
||||
// check slippage with oracle
|
||||
_checkPriceStability(currentTick);
|
||||
require(_isPriceStable(currentTick), "price deviated from oracle");
|
||||
|
||||
// ## check price moved up
|
||||
{
|
||||
|
|
@ -423,7 +423,7 @@ contract BaseLineLP {
|
|||
// Fetch the current tick from the Uniswap V3 pool
|
||||
(uint160 sqrtPriceX96, int24 currentTick, , , , , ) = pool.slot0();
|
||||
// check slippage with oracle
|
||||
_checkPriceStability(currentTick);
|
||||
require(_isPriceStable(currentTick), "price deviated from oracle");
|
||||
|
||||
// ## check price moved down
|
||||
if (positions[Stage.ANCHOR].liquidity > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue