added price oracle

This commit is contained in:
JulesCrown 2024-06-07 11:22:22 +02:00
parent 5d209e5e19
commit ec71bcd287
3 changed files with 83 additions and 7 deletions

View file

@ -98,6 +98,10 @@ contract BaseLineLPTest is PoolSerializer {
vm.expectRevert();
lm.shift();
// have some time pass to record prices in uni oracle
uint256 timeBefore = block.timestamp;
vm.warp(timeBefore + (60 * 60 * 5));
// Setup of liquidity
lm.slide();
appendPossitions(lm, pool, token0isWeth);
@ -114,6 +118,10 @@ contract BaseLineLPTest is PoolSerializer {
token0isWeth ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1,
abi.encode(account, int256(0.5 ether), true)
);
// have some time pass to record prices in uni oracle
timeBefore = block.timestamp;
vm.warp(timeBefore + (60 * 60 * 5));
lm.shift();
appendPossitions(lm, pool, token0isWeth);
@ -126,6 +134,10 @@ contract BaseLineLPTest is PoolSerializer {
token0isWeth ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1,
abi.encode(account, int256(3 ether), true)
);
// have some time pass to record prices in uni oracle
timeBefore = block.timestamp;
vm.warp(timeBefore + (60 * 60 * 5));
lm.shift();
appendPossitions(lm, pool, token0isWeth);
@ -141,6 +153,9 @@ contract BaseLineLPTest is PoolSerializer {
!token0isWeth ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1,
abi.encode(account, int256(300000 ether), false)
);
// have some time pass to record prices in uni oracle
timeBefore = block.timestamp;
vm.warp(timeBefore + (60 * 60 * 5));
lm.slide();
appendPossitions(lm, pool, token0isWeth);
@ -157,6 +172,9 @@ contract BaseLineLPTest is PoolSerializer {
!token0isWeth ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1,
abi.encode(account, int256(3600000 ether), false)
);
// have some time pass to record prices in uni oracle
timeBefore = block.timestamp;
vm.warp(timeBefore + (60 * 60 * 5));
// add to CSV
lm.slide();