Skip to content

Commit

Permalink
fix gauge balances query which was broken in BalPoolsGauges
Browse files Browse the repository at this point in the history
  • Loading branch information
BIP Bot committed Apr 21, 2024
1 parent 7172ce0 commit 64a68f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 15 additions & 0 deletions bal_addresses/graphql/gauges/fetch_gauge_shares.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
query FetchGaugeShares($gaugeAddress: String!, $block: Int) {
gaugeShares(
block: { number: $block }
where: { gauge_contains_nocase: $gaugeAddress, balance_gt: "0" }
orderBy: balance
orderDirection: desc
first: 1000
) {
balance
id
user {
id
}
}
}
8 changes: 3 additions & 5 deletions bal_addresses/pools_gauges.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ def get_gauge_deposit_shares(
) -> Dict[str, int]:
gauge_address = to_checksum_address(gauge_address)
variables = {"gaugeAddress": gauge_address, "block": int(block)}
data = self.subgraph.fetch_graphql_data(
self.subgraph.BALANCER_GAUGES_SHARES_QUERY, variables
)
data = self.subgraph.fetch_graphql_data("gauges", "fetch_gauge_shares", variables)
results = {}
if "data" in data and "gaugeShares" in data["data"]:
for share in data["data"]["gaugeShares"]:
if "gaugeShares" in data:
for share in data["gaugeShares"]:
user_address = to_checksum_address(share["user"]["id"])
results[user_address] = float(share["balance"])
return results
Expand Down

0 comments on commit 64a68f0

Please sign in to comment.