diff --git a/contracts/LpSugar.vy b/contracts/LpSugar.vy index 3b6753d..83edd2a 100644 --- a/contracts/LpSugar.vy +++ b/contracts/LpSugar.vy @@ -263,15 +263,12 @@ 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, _root_pool_factory: address, _root_pool_factory_slipstream: address): + _convertor: address, _slipstream_helper: address, _alm_factory: address): """ @dev Sets up our external contract addresses """ @@ -280,8 +277,6 @@ 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 @@ -307,7 +302,7 @@ 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: + if self._is_root_factory(factory.address): continue pools_count: uint256 = factory.allPoolsLength() @@ -356,7 +351,7 @@ 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: + if self._is_root_factory(factory.address): continue nfpm: address = self._fetch_nfpm(factory.address) @@ -677,7 +672,7 @@ def _positions( break factory: IPoolFactory = IPoolFactory(_factories[index]) - if factory.address == self.root_pool_factory or factory.address == self.root_pool_factory_slipstream: + if self._is_root_factory(factory.address): continue nfpm: INFPositionManager = \ @@ -1446,3 +1441,21 @@ def _safe_symbol(_token: address) -> String[100]: return IERC20(_token).symbol() return "-NA-" + +@internal +@view +def _is_root_factory(_factory: address) -> bool: + """ + @notice Returns true if the factory is a root pool factory and false if it is a leaf pool factory. + @param _factory The factory address + """ + success: bool = raw_call( + _factory, + method_id("bridge()"), + max_outsize=32, + is_delegate_call=False, + is_static_call=True, + revert_on_failure=False + )[0] + + return success diff --git a/env.example b/env.example index 458851a..fa06485 100644 --- a/env.example +++ b/env.example @@ -10,8 +10,6 @@ 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 @@ -30,8 +28,6 @@ ALM_FACTORY_8453=0x5B1b1aaC71bDca9Ed1dCb2AA357f678584db4029 DIST_8453=0x227f65131A261548b057215bB1D5Ab2997964C7d RELAY_REGISTRY_ADDRESSES_8453=0x05e41604B9463e2224227053980dfF3f57fb6dB5,0xD308aBCe663302d3b86b36d332CEFd8A4F62C5Ed GOVERNOR_8453=0x94C012A23A8A65A6f40608dA30534a46a433F410 -ROOT_POOL_FACTORY_8453=0x1111111111111111111111111111111111111111 -ROOT_POOL_FACTORY_SLIPSTREAM_8453=0x1111111111111111111111111111111111111111 TEST_FACTORY_ADDRESS_8453=0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A TEST_ADDRESS_8453=0xEeE7FB850D28f5cabd5f1EDF540646b5bEA17CE5 @@ -50,8 +46,6 @@ ALM_FACTORY_34443=0x0000000000000000000000000000000000000000 DIST_34443=0x0000000000000000000000000000000000000000 RELAY_REGISTRY_ADDRESSES_34443= GOVERNOR_34443=0x1111111111111111111111111111111111111111 -ROOT_POOL_FACTORY_34443=0x1111111111111111111111111111111111111111 -ROOT_POOL_FACTORY_SLIPSTREAM_34443=0x1111111111111111111111111111111111111111 LP_SUGAR_ADDRESS_34443= VE_SUGAR_ADDRESS_34443= @@ -66,8 +60,6 @@ ALM_FACTORY_60808=0x0000000000000000000000000000000000000000 DIST_60808=0x0000000000000000000000000000000000000000 RELAY_REGISTRY_ADDRESSES_60808= GOVERNOR_60808=0x1111111111111111111111111111111111111111 -ROOT_POOL_FACTORY_60808=0x1111111111111111111111111111111111111111 -ROOT_POOL_FACTORY_SLIPSTREAM_60808=0x1111111111111111111111111111111111111111 LP_SUGAR_ADDRESS_60808= VE_SUGAR_ADDRESS_60808= diff --git a/scripts/deploy.py b/scripts/deploy.py index 97c85d1..f93e89c 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -20,8 +20,6 @@ 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}'), - os.getenv(f'ROOT_POOL_FACTORY_SLIPSTREAM_{chain_id}'), {'from': account} )