Spells
Introduction
Unlock the power of Balancer data with our meticulously crafted Dune Spells! Balancer Labs' data team is dedicated to the relentless pursuit of excellence, continuously refining and updating our Dune Spells to deliver the most accurate, insightful, and up-to-date analytics for the Balancer community.
Explore the Spellbook
Embark on your journey through the world of Balancer's data by exploring our Spellbook. Visit https://github.com/duneanalytics/spellbook/tree/main/models/balancer to delve into the intricacies of our models, gaining access to the very spells that empower your understanding of Balancer's ecosystem.
Here are the updated dashboards:
Spell | Description | Upstream Spells | Chains |
---|---|---|---|
balancer_trades | All trades on Balancer, with information on date, tx_hash, tx_from, tx_to, tokens, amounts, version of Balancer in which the trade happened, the pool and its respective swap fee | balancer_v1_ethereum_trades, balancer_v2_[chain]trades, balancer_cowswap_amm[chain]_trades | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_liquidity | Daily liquidity information for balancer pools, by each token contained in a pool. It is also divided in pool_liquidity_usd, which also includes BPTs (Balancer Pool Tokens) balances and and protocol_liquidity_usd, which excludes BPTs. | balancer_v1_ethereum_liquidity, balancer_v2_[chain]liquidity, balancer_cowswap_amm[chain]_liquidity | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_pools_fees | Balancer v2 swap fees stored at the pool level, including information on the transaction where the fee was set. | balancer_v2_[chain]_pools_fees | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_protocol_fees | Daily Protocol Fee collected and Treasury Revenue by pool and token. | balancer_v2_[chain]_protocol_fees | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_bpt_supply | BPT supply over time of ComposableStablePools versions 4+ | balancer_v2_[chain]_bpt_supply | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_bpt_prices | Balancer Pool Token (BPT) hourly median price by pool. | balancer_v2_[chain]_bpt_prices | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_flashloans | All Balancer flashloans | balancer_v2_[chain]_flashloans | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_transfers_bpt | Balancer Pool Token (BPT) transfer logs on Balancer, | balancer_v2_[chain]_transfers_bpt | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_bpt_supply_changes | All BPTs mints and burns | balancer_[chain]_token_balance_changes | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_bpt_supply_changes_daily | Daily Deltas in BPT supply | balancer_[chain]_token_balance_changes_daily | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_pools_tokens_weights | Token weights in Balancer’s weighted pools | balancer_[chain]_pools_tokens_weights | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_token_balance_changes | All token adds and removes on Balancer pools | balancer_[chain]_token_balance_changes | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_token_balance_changes_daily | Daily Deltas in token balances per pool | balancer_[chain]_token_balance_changes_daily | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
balancer_ethereum_balances | Daily running cumulative balance for ERC20 tokens on balancer v1 pools | Ethereum | |
balancer_ethereum_vebal_slopes | Slope and bias of veBAL per wallet after each balance update | Ethereum | |
balancer_ethereum_vebal_balances_day | Daily balances of veBAL per wallet | Ethereum | |
balancer_ethereum_vebal_votes | Records of votes for Balancer gauges by provider at each voting round | Ethereum | |
balancer_cowswap_amm_balances | Daily running cumulative balance for ERC20 tokens on Balancer CoWSwap AMM pools pools | Arbitrum, Ethereum, Gnosis | |
labels_balancer_v1_pools | Names Balancer v1 pools, based on tokens and weights | labels_balancer_v1_pools_ethereum | Ethereum |
labels_balancer_v2_pools | Names Balancer v2 pools, based on tokens and weights. Also returns pool type. | labels_balancer_v2_pools_ | Arbitrum, Avalanche, Base, Ethereum, Gnosis, Optimism, Polygon PoS, Polygon ZkEVM |
labels_balancer_cowswap_amm_pools | Names Balancer CoWSwap AMM pools, based on tokens and weights. Also returns pool type. | labels_balancer_cowswap_amm_pools_ | Arbitrum, Ethereum, Gnosis |
labels_balancer_v2_gauges | Names Balancer v2 gauges, based on their respective blockchain and pool | labels_balancer_v2_gauges_ |
Contribute to the Magic
We invite you to not only explore but also contribute to the magic. As we strive for excellence, collaboration is at the heart of our mission. Your insights, feedback, and contributions are invaluable in shaping the future of Balancer's data analytics. To do so, you can create pull requests to Dune's spellbook or reach out to Balancer Labs' data team directly on Discord.
You can leverage our spells with queries such as:
1, 7 and 30 day volume on Balancer
SELECT
SUM(amount_usd)/1e6 AS "Volume on Balancer"
, 1 AS rn
FROM balancer.trades
WHERE block_time >= CAST(NOW() AS TIMESTAMP) - INTERVAL '1' DAY
UNION ALL
SELECT
SUM(amount_usd)/1e6 AS "Volume on Balancer"
, 2 AS rn
FROM balancer.trades
WHERE block_time >= CAST(NOW() AS TIMESTAMP) - INTERVAL '7' DAY
UNION ALL
SELECT
SUM(amount_usd)/1e6 AS "Volume on Balancer"
, 3 AS rn
FROM balancer.trades
WHERE block_time >= CAST(NOW() AS TIMESTAMP) - INTERVAL '30' DAY
ORDER BY rn ASC
All swaps on the last 24 hours
SELECT
block_date
, tx_hash
, project_contract_address AS pool_address
, token_bought_address
, token_bought_amount
, token_sold_address
, token_sold_amount
, tx_from
, tx_to
, amount_usd
, swap_fee
FROM balancer.trades
WHERE block_time >= now() - interval '24' hour
ORDER BY 1 ASC
Daily TVL by Blockchain
SELECT
blockchain
, CAST(day AS TIMESTAMP) AS day
, sum(protocol_liquidity_usd) AS chain_tvl
FROM balancer.liquidity x
GROUP BY 1, 2
ORDER BY 2 DESC, 3 DESC
Current TVL by pool, from highest to lowest
SELECT
blockchain
, pool_id
, pool_symbol
, sum(pool_liquidity_usd) AS pool_tvl
FROM balancer.liquidity x
WHERE day >= current_date
GROUP BY 1, 2, 3
ORDER BY 4 DESC
Daily Liquidity Utilization
WITH
swaps AS (
SELECT
date_trunc('day', d.block_time) AS day
, SUM(amount_usd) AS volume
FROM balancer.trades d
)
GROUP BY 1
),
total_tvl AS (
SELECT
CAST(day as timestamp) as day
, SUM(protocol_liquidity_usd) AS tvl
FROM balancer.liquidity
)
GROUP BY 1
)
SELECT
CAST(t.day as timestamp) as day,
(s.volume)/(t.tvl) AS liquidity_utilization,
FROM total_tvl t
LEFT JOIN swaps s ON s.day = t.day
ORDER BY 1