Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positions pagination messup #83

Open
wants to merge 2 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions contracts/LpSugar.vy
Original file line number Diff line number Diff line change
Expand Up @@ -692,20 +692,15 @@ def _positions(
positions.append(pos)

else:
# fetch unstaked CL positions
# Fetch unstaked CL positions.
# Since we can't iterate over pools, offset and limit don't apply here.
# TODO: figure out a better way to paginate over unstaked positions.
positions_count: uint256 = nfpm.balanceOf(_account)

for pindex in range(0, MAX_POSITIONS):
if pindex >= positions_count or pools_done >= _limit:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if pool iteration doesn't apply here, is pools_done >= _limit still valid?

break

# Basically skip calls for offset records...
if to_skip > 0:
to_skip -= 1
continue
else:
pools_done += 1

pos_id: uint256 = nfpm.tokenOfOwnerByIndex(_account, pindex)
pos: Position = self._cl_position(
pos_id,
Expand Down
2 changes: 1 addition & 1 deletion env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RELAY_REGISTRY_ADDRESSES=0xe9F00f2e61CB0c6fb00A2e457546aCbF0fC303C2,0x6b1253B116
SLIPSTREAM_HELPER_ADDRESS=0x5Bd7E2221C2d59c99e6A9Cd18D80A5F4257D0f32
ALM_FACTORY_ADDRESS=0xeD8b81E3fF6c54951621715F5992CA52007D88bA
GOVERNOR_ADDRESS=0x1F82e10D58aEf03DeA2e478029fB0387A1cbE989
LP_SUGAR_ADDRESS=0x0937DA94887472239Ada5483c6DBd2904FfD4ACF
LP_SUGAR_ADDRESS=0x5115ED0C19aecaB35BdA73e5795AfdB48d6165B3
VE_SUGAR_ADDRESS=0x94f913362b232e31daB49a1aFB775cfd25DaA6a1
RELAY_SUGAR_ADDRESS=0xb8307e5842B9aeE75C704183F0355076aa74b4e2

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Below is the list of datasets we support.
### Liquidity Pools Data

> [!NOTE]
> `LpSugar.vy` is deployed at `0x0937DA94887472239Ada5483c6DBd2904FfD4ACF`
> `LpSugar.vy` is deployed at `0x5115ED0C19aecaB35BdA73e5795AfdB48d6165B3`

It allows fetching on-chain pools data.
The returned data/struct of type `Lp` values represent:
Expand Down