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

models for new queries, tests #40

Merged
merged 7 commits into from
Sep 25, 2024

Conversation

jalbrekt85
Copy link
Collaborator

No description provided.

"""
query all pools from the apiv3 subgraph
filters out disabled pools
"""
data = self.subgraph.fetch_graphql_data("apiv3", "get_pools", {"chain": self.chain.upper()})
all_pools = []
for pool in data["poolGetPools"]:
if pool['dynamicData']['swapEnabled']:
all_pools.append({"address": pool['id'], "symbol": pool['symbol']})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note the pool['id'] data here is now referenced with id rather than address

Copy link
Member

Choose a reason for hiding this comment

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

yea i kept it as address because that is how it is used in bal_addresses, but i think to make it uniform with pool makes more sense. we just need to make sure we propagate this change downstream then

Copy link
Member

@Tritium-VLK Tritium-VLK Sep 25, 2024

Choose a reason for hiding this comment

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

Think PoolID and Address are different. Suggest we not remove whatever was already there from results, but it could make sense to add the other. Maybe this was already resolved.

Copy link
Member

Choose a reason for hiding this comment

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

good catch; fixed in 90061d0

"""
query all pools from the apiv3 subgraph
filters out disabled pools
"""
data = self.subgraph.fetch_graphql_data("apiv3", "get_pools", {"chain": self.chain.upper()})
all_pools = []
for pool in data["poolGetPools"]:
if pool['dynamicData']['swapEnabled']:
all_pools.append({"address": pool['id'], "symbol": pool['symbol']})
Copy link
Member

Choose a reason for hiding this comment

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

yea i kept it as address because that is how it is used in bal_addresses, but i think to make it uniform with pool makes more sense. we just need to make sure we propagate this change downstream then

class PoolData(BaseModel):
id: str
symbol: str
dynamicData: dict
Copy link
Member

Choose a reason for hiding this comment

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

i think this can be dropped too. we are always filtering on pool_data.dynamicData['swapEnabled'], so the attribute is useless no?

Copy link
Collaborator Author

@jalbrekt85 jalbrekt85 Sep 24, 2024

Choose a reason for hiding this comment

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

this is independent from whatever the query_all_pools method is doing, the model is for modeling the data from the api. in this case, each element in the poolGetPools query

Copy link
Member

Choose a reason for hiding this comment

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

hmm ok, i guess we could pop it before returning at the end of query_all_pools but it is not that important

@jalbrekt85
Copy link
Collaborator Author

implemented a __json__method for CorePools so it can be implicitly json serializable. introduces json-fix module - 0a3e8d3

@gosuto-inzasheru gosuto-inzasheru merged commit d7c3c9b into feat/query_all_gauges Sep 25, 2024
2 of 4 checks passed
@gosuto-inzasheru gosuto-inzasheru deleted the add-models/tests branch September 25, 2024 10:04
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.

3 participants