@@ -96,7 +96,7 @@ struct Lp:
96
96
emissions_token: address
97
97
98
98
pool_fee: uint256 # staked fee % on v3, fee % on v2
99
- unstaked_fee: uint256 # unstaked fee % on v3, fee % on v2
99
+ unstaked_fee: uint256 # unstaked fee % on v3, 0 on v2
100
100
token0_fees: uint256
101
101
token1_fees: uint256
102
102
@@ -399,15 +399,15 @@ def all(_limit: uint256, _offset: uint256, _account: address) \
399
399
token1: address = pool.token1 ()
400
400
401
401
is_cl_pool: bool = False
402
- is_stable: bool = factory.getPool (token0, token1, 0 ) == pools[index][ 1 ]
402
+ is_stable: bool = factory.getPool (token0, token1, 0 ) == pool. address
403
403
404
- if not is_stable and factory.getPool (token0, token1, 1 ) != pools[index][ 1 ] :
404
+ if not is_stable and factory.getPool (token0, token1, 1 ) != pool. address :
405
405
is_cl_pool = True
406
406
407
407
if is_cl_pool:
408
- col.append (self ._byDataCL (pools[index], _account))
408
+ col.append (self ._byDataCL (pools[index], token0, token1, _account))
409
409
else :
410
- col.append (self ._byData (pools[index], _account))
410
+ col.append (self ._byData (pools[index], token0, token1, _account))
411
411
412
412
return col
413
413
@@ -428,18 +428,18 @@ def byIndex(_index: uint256, _account: address) -> Lp:
428
428
token1: address = pool.token1 ()
429
429
430
430
is_cl_pool: bool = False
431
- is_stable: bool = factory.getPool (token0, token1, 0 ) == pools[_index][ 1 ]
431
+ is_stable: bool = factory.getPool (token0, token1, 0 ) == pool. address
432
432
433
- if not is_stable and factory.getPool (token0, token1, 1 ) != pools[_index][ 1 ] :
433
+ if not is_stable and factory.getPool (token0, token1, 1 ) != pool. address :
434
434
is_cl_pool = True
435
435
436
436
if is_cl_pool:
437
- return self ._byDataCL (pools[_index], _account)
438
- return self ._byData (pools[_index], _account)
437
+ return self ._byDataCL (pools[_index], token0, token1, _account)
438
+ return self ._byData (pools[_index], token0, token1, _account)
439
439
440
440
@internal
441
441
@view
442
- def _byData (_data: address [3 ], _account: address ) -> Lp:
442
+ def _byData (_data: address [3 ], _token0: address , _token1: address , _account: address ) -> Lp:
443
443
"""
444
444
@notice Returns pool data based on the factory, pool and gauge addresses
445
445
@param _address The addresses to lookup
@@ -457,8 +457,8 @@ def _byData(_data: address[3], _account: address) -> Lp:
457
457
is_stable: bool = pool.stable ()
458
458
pool_fee: uint256 = IPoolFactory (_data[0 ]).getFee (_data[1 ], is_stable)
459
459
pool_fees: address = pool.poolFees ()
460
- token0: IERC20 = IERC20 (pool. token0 () )
461
- token1: IERC20 = IERC20 (pool. token1 () )
460
+ token0: IERC20 = IERC20 (_token0 )
461
+ token1: IERC20 = IERC20 (_token1 )
462
462
gauge_alive: bool = self .voter.isAlive (gauge.address )
463
463
464
464
type: int24 = - 1
@@ -519,7 +519,7 @@ def _byData(_data: address[3], _account: address) -> Lp:
519
519
emissions_token: emissions_token,
520
520
521
521
pool_fee: pool_fee,
522
- unstaked_fee: pool_fee ,
522
+ unstaked_fee: 0 ,
523
523
token0_fees: token0.balanceOf (pool_fees),
524
524
token1_fees: token1.balanceOf (pool_fees),
525
525
@@ -528,7 +528,7 @@ def _byData(_data: address[3], _account: address) -> Lp:
528
528
529
529
@internal
530
530
@view
531
- def _byDataCL (_data: address [3 ], _account: address ) -> Lp:
531
+ def _byDataCL (_data: address [3 ], _token0: address , _token1: address , _account: address ) -> Lp:
532
532
"""
533
533
@notice Returns CL pool data based on the factory, pool and gauge addresses
534
534
@param _data The addresses to lookup
@@ -544,12 +544,11 @@ def _byDataCL(_data: address[3], _account: address) -> Lp:
544
544
fee_voting_reward: address = empty (address )
545
545
emissions: uint256 = 0
546
546
emissions_token: address = empty (address )
547
- token0: IERC20 = IERC20 (pool. token0 () )
548
- token1: IERC20 = IERC20 (pool. token1 () )
547
+ token0: IERC20 = IERC20 (_token0 )
548
+ token1: IERC20 = IERC20 (_token1 )
549
549
550
- if gauge.address != empty (address ):
551
- fee_voting_reward = gauge.feesVotingReward ()
552
- emissions_token = gauge.rewardToken ()
550
+ fee_voting_reward = gauge.feesVotingReward ()
551
+ emissions_token = gauge.rewardToken ()
553
552
554
553
if gauge_alive:
555
554
emissions = gauge.rewardRate ()
0 commit comments