@@ -129,6 +129,8 @@ test('increase liquidity before transfer uses cached mint amounts', async () =>
129129 sqrtPriceX96 : 0n ,
130130 token0Price : PRICE_E8 ,
131131 token1Price : PRICE_E8 ,
132+ feeProtocol0 : 0 ,
133+ feeProtocol1 : 0 ,
132134 lastUpdate : 0 ,
133135 } ) ;
134136 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -239,6 +241,8 @@ test('increase liquidity uses pool mint data when eth_call is unavailable', asyn
239241 sqrtPriceX96 : 0n ,
240242 token0Price : PRICE_E8 ,
241243 token1Price : PRICE_E8 ,
244+ feeProtocol0 : 0 ,
245+ feeProtocol1 : 0 ,
242246 lastUpdate : 0 ,
243247 } ) ;
244248 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -398,6 +402,8 @@ test('swap accrues lp points when position stays in range', async () => {
398402 sqrtPriceX96 : 0n ,
399403 token0Price : PRICE_E8 ,
400404 token1Price : PRICE_E8 ,
405+ feeProtocol0 : 0 ,
406+ feeProtocol1 : 0 ,
401407 lastUpdate : 0 ,
402408 } ) ;
403409 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -515,6 +521,8 @@ test('swap updates fee apr stats', async () => {
515521 sqrtPriceX96 : 0n ,
516522 token0Price : PRICE_E8 ,
517523 token1Price : PRICE_E8 ,
524+ feeProtocol0 : 0 ,
525+ feeProtocol1 : 0 ,
518526 lastUpdate : 0 ,
519527 } ) ;
520528 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -552,9 +560,10 @@ test('swap updates fee apr stats', async () => {
552560
553561 const feeStats = mockDb . entities . LPPoolFeeStats . get ( ADDRESSES . pool ) ;
554562 assert . ok ( feeStats ) ;
555- assert . equal ( feeStats ?. volumeUsd24h , 200000000n ) ;
556- assert . equal ( feeStats ?. feesUsd24h , 2000000n ) ;
557- assert . equal ( feeStats ?. feeAprBps , 73n ) ;
563+ // Volume is average: amount0=1M, amount1=2M at same price → (100000000 + 200000000) / 2 = 150000000
564+ assert . equal ( feeStats ?. volumeUsd24h , 150000000n ) ;
565+ assert . equal ( feeStats ?. feesUsd24h , 1500000n ) ;
566+ assert . equal ( feeStats ?. feeAprBps , 54n ) ;
558567} ) ;
559568
560569test ( 'increase/decrease liquidity update existing position' , async ( ) => {
@@ -601,6 +610,8 @@ test('increase/decrease liquidity update existing position', async () => {
601610 sqrtPriceX96 : 2n ** 96n ,
602611 token0Price : PRICE_E8 ,
603612 token1Price : PRICE_E8 ,
613+ feeProtocol0 : 0 ,
614+ feeProtocol1 : 0 ,
604615 lastUpdate : 0 ,
605616 } ) ;
606617 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -828,6 +839,8 @@ test('swap handles ausd pricing and empty positions', async () => {
828839 sqrtPriceX96 : 2n ** 96n ,
829840 token0Price : 0n ,
830841 token1Price : 0n ,
842+ feeProtocol0 : 0 ,
843+ feeProtocol1 : 0 ,
831844 lastUpdate : 0 ,
832845 } ) ;
833846 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -903,6 +916,8 @@ test('swap handles out-of-range positions', async () => {
903916 sqrtPriceX96 : 2n ** 96n ,
904917 token0Price : PRICE_E8 ,
905918 token1Price : PRICE_E8 ,
919+ feeProtocol0 : 0 ,
920+ feeProtocol1 : 0 ,
906921 lastUpdate : 0 ,
907922 } ) ;
908923 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -1097,6 +1112,8 @@ test('increase liquidity updates in-range transitions', async () => {
10971112 sqrtPriceX96 : 2n ** 96n ,
10981113 token0Price : PRICE_E8 ,
10991114 token1Price : PRICE_E8 ,
1115+ feeProtocol0 : 0 ,
1116+ feeProtocol1 : 0 ,
11001117 lastUpdate : 0 ,
11011118 } ) ;
11021119 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -1157,6 +1174,8 @@ test('increase liquidity updates in-range transitions', async () => {
11571174 sqrtPriceX96 : 2n ** 96n ,
11581175 token0Price : PRICE_E8 ,
11591176 token1Price : PRICE_E8 ,
1177+ feeProtocol0 : 0 ,
1178+ feeProtocol1 : 0 ,
11601179 lastUpdate : 0 ,
11611180 } ) ;
11621181 const exit = TestHelpers . NonfungiblePositionManager . IncreaseLiquidity . createMockEvent ( {
@@ -1218,6 +1237,8 @@ test('decrease liquidity updates in-range transitions', async () => {
12181237 sqrtPriceX96 : 2n ** 96n ,
12191238 token0Price : PRICE_E8 ,
12201239 token1Price : PRICE_E8 ,
1240+ feeProtocol0 : 0 ,
1241+ feeProtocol1 : 0 ,
12211242 lastUpdate : 0 ,
12221243 } ) ;
12231244 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -1278,6 +1299,8 @@ test('decrease liquidity updates in-range transitions', async () => {
12781299 sqrtPriceX96 : 2n ** 96n ,
12791300 token0Price : PRICE_E8 ,
12801301 token1Price : PRICE_E8 ,
1302+ feeProtocol0 : 0 ,
1303+ feeProtocol1 : 0 ,
12811304 lastUpdate : 0 ,
12821305 } ) ;
12831306 const exit = TestHelpers . NonfungiblePositionManager . DecreaseLiquidity . createMockEvent ( {
@@ -1329,6 +1352,8 @@ test('transfer mint uses ausd pricing for token0', async () => {
13291352 sqrtPriceX96 : 2n ** 96n ,
13301353 token0Price : PRICE_E8 ,
13311354 token1Price : 0n ,
1355+ feeProtocol0 : 0 ,
1356+ feeProtocol1 : 0 ,
13321357 lastUpdate : 0 ,
13331358 } ) ;
13341359 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -1444,6 +1469,8 @@ test('transfer mint selects matching pool config when multiple fees exist', asyn
14441469 sqrtPriceX96 : 0n ,
14451470 token0Price : PRICE_E8 ,
14461471 token1Price : PRICE_E8 ,
1472+ feeProtocol0 : 0 ,
1473+ feeProtocol1 : 0 ,
14471474 lastUpdate : 0 ,
14481475 } ) ;
14491476 mockDb = mockDb . entities . TokenInfo . set ( {
@@ -1520,6 +1547,8 @@ test('swap leaves out-of-range positions untouched', async () => {
15201547 sqrtPriceX96 : 2n ** 96n ,
15211548 token0Price : PRICE_E8 ,
15221549 token1Price : PRICE_E8 ,
1550+ feeProtocol0 : 0 ,
1551+ feeProtocol1 : 0 ,
15231552 lastUpdate : 0 ,
15241553 } ) ;
15251554 mockDb = mockDb . entities . TokenInfo . set ( {
0 commit comments