Skip to content

Implement sugar-sdk pool snapshot data pull #1393

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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

Conversation

dioptx
Copy link
Collaborator

@dioptx dioptx commented Feb 21, 2025

Implements the Sugar SDK puller that currently pulls snapshot data for the Base and OP chains.

@dioptx dioptx requested review from MSilb7 and lithium323 February 21, 2025 09:24
@dioptx dioptx self-assigned this Feb 21, 2025
@MSilb7
Copy link
Member

MSilb7 commented Feb 21, 2025

We can try more Chain IDs as well: https://github.com/velodrome-finance/sugar-sdk?tab=readme-ov-file#configuration

We store the OP Chain chain IDs in the chain metadata file (however is best to pull that). Not all will have Velodrome implementations.

Also want to validate if we can pull things like votes, fees, etc before merging - since it's most valuable to have the full suite of metrics that you can pull from the UI (preferably at a token level for rewards and tvl).

@callmephilip
Copy link

Howdy. We've just added some more pool stats. This matches what velo/aerodrome display on liquidity screens. Do let us know what other stats you might need. And thank you for your patience since all this is very much WIP at the moment

@callmephilip
Copy link

sugar-sdk 0.0.2 now supports both sync and async mode for existing readonly APIs. we are going to make sure that we support both modes moving forward. See docs: https://github.com/velodrome-finance/sugar-sdk?tab=readme-ov-file#pools

this will break your current setup since async chains must be prefixed with Async* now (e.g. OPChain became AsyncOpChain, its sync version is now called OpChain)

@dioptx
Copy link
Collaborator Author

dioptx commented Feb 26, 2025

sugar-sdk 0.0.2 now supports both sync and async mode for existing readonly APIs. we are going to make sure that we support both modes moving forward. See docs: https://github.com/velodrome-finance/sugar-sdk?tab=readme-ov-file#pools

this will break your current setup since async chains must be prefixed with Async* now (e.g. OPChain became AsyncOpChain, its sync version is now called OpChain)

Thank you for flagging @callmephilip , we will review the new docs and reimplement.

@dioptx dioptx requested a review from lithium323 February 26, 2025 12:17
@@ -120,7 +113,7 @@ async def _sugar_pools(chain: str, sugar_chain: Chain) -> VelodromePools:
lps = []
missing = []
for pool in pools:
lp = LiquidityPool.from_tuple(pool, tokens_index)
lp = LiquidityPool.from_tuple(pool, tokens_index, prices)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lithium323

We have a bunch of missing Token information for native tokens mostly. Not sure how to fix this yet.

Sample data:

Exception: possible error, token info not found for pools
[MissingTokenInfo(token0='0x4200000000000000000000000000000000000006', token1='0x557929D1d015F4B30E9C0E68cDF6e8a86B308E18', pool_type=-1),
 MissingTokenInfo(token0='0x2C00f7fF36c3591340b7DB47c22C4a413b925E5F', token1='0x4200000000000000000000000000000000000006', pool_type=-1),
 MissingTokenInfo(token0='0x4200000000000000000000000000000000000006', token1='0xF6A35217F35220efF1e3E1c489C30817245bc7cf', pool_type=-1),
 MissingTokenInfo(token0='0x4200000000000000000000000000000000000006', token1='0x92A062bB26A0Cbc704BF7dcD4C833d4e1beeb83d', pool_type=-1),
 MissingTokenInfo(token0='0x505269DA224Db7C3497A9799Fee06BbfbD0D40D2', token1='0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', pool_type=-1),
 MissingTokenInfo(token0='0x06ef35365c3FA9125E94b4657E671FDaA0cB7B70', token1='0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', pool_type=-1),

Copy link
Collaborator

Choose a reason for hiding this comment

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

I brought this up with the velodrome team on telegram. At first setting listed_only=False made all pools with missing tokens go away. We should check again with them if that isn't working anymore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've tried with both "listed_only" options, and this issue persists. I think this requires patching on the sugar-sdk side.

@MSilb7
Copy link
Member

MSilb7 commented Mar 24, 2025

Priorities to pull by pool:

  • TVL
    • Breakdown by token if possible as well, but not ideal
  • Trade Volume
  • veVELO votes
  • Rewards (Fees + Incentives)
    • If this is by token, then this would be great to pull
    • Also, ideally we segment out fees from trade volume, versus fees from incentives/bribes.

If this is a super light pull, we can try to run ~hourly.

Also, if this shows data for each weekly epoch, then we could build a view on top that gets the amount that happens in each hour (i.e. if there's $100 volume now, $90 last hour, then $10 happened in the period elapsed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants