Skip to content

Commit

Permalink
chore: canonical chains mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrovalido committed Oct 22, 2024
1 parent 2d711e5 commit faed8cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/LpSugar.vy
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ registry: public(IFactoryRegistry)
convertor: public(address)
cl_helper: public(ISlipstreamHelper)
alm_factory: public(IAlmFactory)
canonical_chains: public(HashMap[uint256, bool])

# Methods

Expand All @@ -278,6 +279,8 @@ def __init__(_voter: address, _registry: address,\
self.convertor = _convertor
self.cl_helper = ISlipstreamHelper(_slipstream_helper)
self.alm_factory = IAlmFactory(_alm_factory)
self.canonical_chains[10] = True
self.canonical_chains[8453] = True

@internal
@view
Expand Down Expand Up @@ -714,7 +717,7 @@ def _positions(
positions_count: uint256 = nfpm.balanceOf(_account)

chainid: uint256 = chain.id
if chainid == 10 or chainid == 8453:
if self.canonical_chains[chainid]:
for pindex in range(0, MAX_POSITIONS):
if pindex >= positions_count:
break
Expand Down Expand Up @@ -750,7 +753,7 @@ def _positions(

# Fetch unstaked CL positions.
# Efficient on leaf
if chainid != 10 and chainid != 8453:
if not self.canonical_chains[chainid]:
positions_ids: DynArray[uint256, MAX_POSITIONS] = \
nfpm.userPositions(_account, pool_addr)

Expand Down

0 comments on commit faed8cd

Please sign in to comment.