@@ -73,10 +73,6 @@ struct Price:
73
73
tick_price: int24
74
74
liquidity_gross: uint128
75
75
76
- struct LpPrice :
77
- lp: address
78
- prices: DynArray[Price, MAX_PRICES]
79
-
80
76
struct Token :
81
77
token_address: address
82
78
symbol: String[100 ]
@@ -999,37 +995,20 @@ def _is_cl_factory(_factory: address) -> (bool):
999
995
1000
996
@external
1001
997
@view
1002
- def prices (_limit: uint256 , _offset: uint256 ) -> DynArray[LpPrice, MAX_POOLS ]:
998
+ def price (_pool: address , _factory: address ) -> DynArray[Price, MAX_PRICES ]:
1003
999
"""
1004
- @notice Returns a collection of tick price data for pools
1005
- @param _limit The max amount of pools to return
1006
- @param _offset The amount of pools to skip
1007
- @return Array of LpPrice structs
1000
+ @notice Returns price data at surrounding ticks for a pool
1001
+ @param _pool The pool to check price data of
1002
+ @param _factory The factory of the pool
1003
+ @return Array of Price structs
1008
1004
"""
1009
- col: DynArray[LpPrice, MAX_POOLS] = empty (DynArray[LpPrice, MAX_POOLS])
1010
- pools: DynArray[address [3 ], MAX_POOLS] = self ._pools ()
1011
- pools_count: uint256 = len (pools)
1012
-
1013
- for index in range (_offset, _offset + MAX_POOLS):
1014
- if len (col) == _limit or index >= pools_count:
1015
- break
1016
-
1017
- factory: IPoolFactory = IPoolFactory (pools[index][0 ])
1018
- is_cl_factory: bool = self ._is_cl_factory (pools[index][0 ])
1005
+ is_cl_factory: bool = self ._is_cl_factory (_factory)
1019
1006
1020
- if is_cl_factory:
1021
- col.append (LpPrice ({
1022
- lp: pools[index][1 ],
1023
- prices: self ._price (pools[index][1 ])
1024
- }))
1025
- else :
1026
- empty_prices: DynArray[Price, MAX_PRICES] = empty (DynArray[Price, MAX_PRICES])
1027
- col.append (LpPrice ({
1028
- lp: pools[index][1 ],
1029
- prices: empty_prices
1030
- }))
1031
-
1032
- return col
1007
+ if is_cl_factory:
1008
+ return self ._price (_pool)
1009
+ else :
1010
+ empty_prices: DynArray[Price, MAX_PRICES] = empty (DynArray[Price, MAX_PRICES])
1011
+ return empty_prices
1033
1012
1034
1013
@internal
1035
1014
@view
0 commit comments