Skip to content

Commit

Permalink
feat: filter root pool factory on optimism
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrovalido committed Oct 6, 2024
1 parent 4158617 commit 3ce3cc2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
16 changes: 15 additions & 1 deletion contracts/LpSugar.vy
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,15 @@ registry: public(IFactoryRegistry)
convertor: public(address)
cl_helper: public(ISlipstreamHelper)
alm_factory: public(IAlmFactory)
root_pool_factory: public(address)
root_pool_factory_slipstream: public(address)

# Methods

@external
def __init__(_voter: address, _registry: address,\
_convertor: address, _slipstream_helper: address, _alm_factory: address):
_convertor: address, _slipstream_helper: address,\
_alm_factory: address, _root_pool_factory: address, _root_pool_factory_slipstream: address):
"""
@dev Sets up our external contract addresses
"""
Expand All @@ -277,6 +280,8 @@ def __init__(_voter: address, _registry: address,\
self.convertor = _convertor
self.cl_helper = ISlipstreamHelper(_slipstream_helper)
self.alm_factory = IAlmFactory(_alm_factory)
self.root_pool_factory = _root_pool_factory
self.root_pool_factory_slipstream = _root_pool_factory_slipstream

@internal
@view
Expand All @@ -302,6 +307,9 @@ def _pools(_limit: uint256, _offset: uint256)\
break

factory: IPoolFactory = IPoolFactory(factories[index])
if factory.address == self.root_pool_factory or factory.address == self.root_pool_factory_slipstream:
continue

pools_count: uint256 = factory.allPoolsLength()
nfpm: address = self._fetch_nfpm(factory.address)

Expand Down Expand Up @@ -348,6 +356,9 @@ def forSwaps(_limit: uint256, _offset: uint256) -> DynArray[SwapLp, MAX_POOLS]:
break

factory: IPoolFactory = IPoolFactory(factories[index])
if factory.address == self.root_pool_factory or factory.address == self.root_pool_factory_slipstream:
continue

nfpm: address = self._fetch_nfpm(factory.address)
pools_count: uint256 = factory.allPoolsLength()

Expand Down Expand Up @@ -666,6 +677,9 @@ def _positions(
break

factory: IPoolFactory = IPoolFactory(_factories[index])
if factory.address == self.root_pool_factory or factory.address == self.root_pool_factory_slipstream:
continue

nfpm: INFPositionManager = \
INFPositionManager(self._fetch_nfpm(factory.address))

Expand Down
2 changes: 2 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ALM_FACTORY_10=0xeD8b81E3fF6c54951621715F5992CA52007D88bA
DIST_10=0x9D4736EC60715e71aFe72973f7885DCBC21EA99b
RELAY_REGISTRY_ADDRESSES_10=0xe9F00f2e61CB0c6fb00A2e457546aCbF0fC303C2,0x6b1253B116B5919932399295C75116d33F8EfF96
GOVERNOR_10=0x1F82e10D58aEf03DeA2e478029fB0387A1cbE989
ROOT_POOL_FACTORY_10=0x1111111111111111111111111111111111111111
ROOT_POOL_FACTORY_SLIPSTREAM_10=0x1111111111111111111111111111111111111111

TEST_FACTORY_ADDRESS_10=0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F
TEST_ADDRESS_10=0xEeE7FB850D28f5cabd5f1EDF540646b5bEA17CE5
Expand Down
1 change: 1 addition & 0 deletions scripts/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def main():
os.getenv(f'CONVERTOR_{chain_id}'),
os.getenv(f'SLIPSTREAM_HELPER_{chain_id}'),
os.getenv(f'ALM_FACTORY_{chain_id}'),
os.getenv(f'ROOT_POOL_FACTORY_{chain_id}'),
{'from': account}
)

Expand Down

0 comments on commit 3ce3cc2

Please sign in to comment.