Skip to content

Commit 5ad76d9

Browse files
committed
feat: add ALM filler data to LpSugar
1 parent d20e685 commit 5ad76d9

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

contracts/LpSugar.vy

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct Position:
5252
emissions_earned: uint256 # staked liq emissions earned on both v2 and v3
5353
tick_lower: int24 # Position lower tick on v3, 0 on v2
5454
tick_upper: int24 # Position upper tick on v3, 0 on v2
55+
alm: bool # True if Position is deposited into ALM on v3, False on v2
5556

5657
struct Token:
5758
token_address: address
@@ -100,6 +101,10 @@ struct Lp:
100101
token0_fees: uint256
101102
token1_fees: uint256
102103

104+
alm_vault: address # ALM vault address on v3, empty address on v2
105+
alm_reserve0: uint256 # ALM token0 reserves on v3, 0 on v2
106+
alm_reserve1: uint256 # ALM token1 reserves on v3, 0 on v2
107+
103108
positions: DynArray[Position, MAX_POSITIONS]
104109

105110
struct LpEpochReward:
@@ -206,11 +211,12 @@ voter: public(IVoter)
206211
convertor: public(address)
207212
router: public(address)
208213
v1_factory: public(address)
214+
alm_registry: public(address) # todo: add ALM interface when ALM contracts are ready
209215

210216
# Methods
211217

212218
@external
213-
def __init__(_voter: address, _registry: address, _convertor: address, _router: address):
219+
def __init__(_voter: address, _registry: address, _convertor: address, _router: address, _alm_registry: address):
214220
"""
215221
@dev Sets up our external contract addresses
216222
"""
@@ -219,6 +225,7 @@ def __init__(_voter: address, _registry: address, _convertor: address, _router:
219225
self.convertor = _convertor
220226
self.router = _router
221227
self.v1_factory = self.voter.v1Factory()
228+
self.alm_registry = _alm_registry
222229

223230
@internal
224231
@view
@@ -486,7 +493,8 @@ def _byData(_data: address[3], _token0: address, _token1: address, _account: add
486493
unstaked_earned1: pool.claimable1(_account),
487494
emissions_earned: earned,
488495
tick_lower: 0,
489-
tick_upper: 0
496+
tick_upper: 0,
497+
alm: False
490498
})
491499
)
492500

@@ -523,6 +531,10 @@ def _byData(_data: address[3], _token0: address, _token1: address, _account: add
523531
token0_fees: token0.balanceOf(pool_fees),
524532
token1_fees: token1.balanceOf(pool_fees),
525533

534+
alm_vault: empty(address),
535+
alm_reserve0: 0,
536+
alm_reserve1: 0,
537+
526538
positions: positions
527539
})
528540

@@ -583,7 +595,8 @@ def _byDataCL(_data: address[3], _token0: address, _token1: address, _account: a
583595
unstaked_earned1: convert(position_data.unstaked_earned1, uint256),
584596
emissions_earned: emissions_earned,
585597
tick_lower: position_data.tick_lower,
586-
tick_upper: position_data.tick_upper
598+
tick_upper: position_data.tick_upper,
599+
alm: False # todo: populate real ALM data when ALM contracts are ready
587600
})
588601
)
589602

@@ -620,6 +633,11 @@ def _byDataCL(_data: address[3], _token0: address, _token1: address, _account: a
620633
token0_fees: convert(gauge_fees.token0, uint256),
621634
token1_fees: convert(gauge_fees.token1, uint256),
622635

636+
# todo: populate real ALM data when ALM contracts are ready
637+
alm_vault: empty(address),
638+
alm_reserve0: 0,
639+
alm_reserve1: 0,
640+
623641
positions: positions
624642
})
625643

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ The returned data/struct of type `Lp` values represent:
6464
* `unstaked_fee` - unstaked fee percentage on v3 pools, 0 on v2 pools
6565
* `token0_fees` - current epoch token0 accrued fees (next week gauge fees)
6666
* `token1_fees` - current epoch token1 accrued fees (next week gauge fees)
67+
* `alm_vault` - ALM vault address on v3 if it exists, empty address on v2
68+
* `alm_reserve0` - ALM vault token0 reserves on v3, 0 on v2
69+
* `alm_reserve1` - ALM vault token1 reserves on v3, 0 on v2
6770
* `positions` - a list of account pool position data, it is a struct of type `Position`
6871

6972
---

0 commit comments

Comments
 (0)