BalancerMaxis/protocol_fee_allocator

Update Token Price History query in Fee allocator

Closed this issue · 3 comments

Certain queries are deprecated and it is not clear how long they are still supported.

Following queries are known to be "deprecated":

E.g. https://github.com/BalancerMaxis/arbitrum_grants_distributor/blob/354bdd7b6ab78d5a7deabdbf4ea43c02f80c36eb/automation/helpers.py#L66C1-L75C4

BAL_GQL_QUERY = """
query {{
  tokenGetPriceChartData(address:"{token_addr}", range: NINETY_DAY)   
   {{
    id
    price
    timestamp
  }}
}}
"""

Also take a look at the protocol_fee_allocator for historical prices.

@Xeonus can you please provide an example of a new query/method to do this?

Thanks

Example of new Query layout:

query getTokenPrice{tokenGetHistoricalPrices(addresses:["0xed65c5085a18fa160af0313e60dcc7905e944dc7"], range: NINETY_DAY, chain: ARBITRUM)   
   {
    prices {
      price
      timestamp
    }
  }
}

To refactor the above mentioned query, do something like this:

BAL_GQL_QUERY = """
query {{
  tokenGetHistoricalPrices(addresses:"{token_address_array}", range: NINETY_DAY, chain: "{chain_id}" )   
   {{
    prices {{
      price
      timestamp
    }}
  }}
}}
"""