This substream processes Orca Whirlpool transactions on the Solana blockchain, extracting and organizing data related to liquidity pools, swaps, deposits, and withdrawals.
The Orca-Whirlpool substream is designed to:
Refer to the Repository README for instructions on how to build and run the substream.
map_block
: Processes raw Solana blocks to extract Orca Whirlpool eventsmap_pools
: Extracts and processes pool-related datamap_deposits
: Processes deposit (increase liquidity) eventsmap_withdraws
: Processes withdrawal (decrease liquidity) eventsmap_swaps
: Processes swap eventsgraph_out
: Generates entity changes for the Graph protocolThe substream handles various Orca Whirlpool instructions, including:
The main data structures are defined in the output.proto
file.
The substream uses several stores to maintain state:
store_pools
: Stores pool datastore_deposits
: Stores deposit datastore_withdraws
: Stores withdrawal datastore_swaps
: Stores swap datastore_unique_users
: Tracks unique usersstore_cumulative_users
: Maintains cumulative user countstore_total_pool_count
: Tracks total pool countstore_pool_balances
: Stores pool token balancesstore_pool_liquidity
: Tracks pool liquidityTo add support for new Orca Whirlpool instructions:
src/pb/orca.whirlpool.v1.rs
file to include the new instruction definition.map_block
function in src/lib.rs
to handle the new instruction type.map_pools.rs
, map_deposits.rs
, etc.) to process the new instruction data.graph_out
module to include the new data in the entity changes if necessary.graph TD;
map_block[map: map_block];
solana:blocks_without_votes --> map_block;
map_pools[map: map_pools];
map_block --> map_pools;
store_pools[store: store_pools];
map_pools --> store_pools;
map_deposits[map: map_deposits];
map_block --> map_deposits;
store_pools --> map_deposits;
store_deposits[store: store_deposits];
map_block --> store_deposits;
map_withdraws[map: map_withdraws];
map_block --> map_withdraws;
store_pools --> map_withdraws;
store_withdraws[store: store_withdraws];
map_block --> store_withdraws;
map_swaps[map: map_swaps];
map_block --> map_swaps;
store_pools --> map_swaps;
store_swaps[store: store_swaps];
map_swaps --> store_swaps;
store_unique_users[store: store_unique_users];
map_block --> store_unique_users;
store_cumulative_users[store: store_cumulative_users];
store_unique_users -- deltas --> store_cumulative_users;
store_total_pool_count[store: store_total_pool_count];
store_pools -- deltas --> store_total_pool_count;
store_pool_balances[store: store_pool_balances];
map_deposits --> store_pool_balances;
map_withdraws --> store_pool_balances;
map_swaps --> store_pool_balances;
store_pool_liquidity[store: store_pool_liquidity];
map_deposits --> store_pool_liquidity;
map_withdraws --> store_pool_liquidity;
graph_out[map: graph_out];
sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> graph_out;
map_pools --> graph_out;
store_pools --> graph_out;
store_cumulative_users -- deltas --> graph_out;
store_total_pool_count -- deltas --> graph_out;
store_pool_balances -- deltas --> graph_out;
store_pool_liquidity -- deltas --> graph_out;
solana:blocks_without_votes[map: solana:blocks_without_votes];
sf.solana.type.v1.Block[source: sf.solana.type.v1.Block] --> solana:blocks_without_votes;
solana:blocks_without_votes --> solana:program_ids_without_votes;
solana:filtered_transactions_without_votes[map: solana:filtered_transactions_without_votes];
solana:filtered_transactions_without_votes:params[params] --> solana:filtered_transactions_without_votes;
solana:blocks_without_votes --> solana:filtered_transactions_without_votes;
substreams gui orca-whirlpool-substream@v0.1.0 map_block
substreams gui orca-whirlpool-substream@v0.1.0 map_pools
substreams gui orca-whirlpool-substream@v0.1.0 map_deposits
substreams gui orca-whirlpool-substream@v0.1.0 map_withdraws
substreams gui orca-whirlpool-substream@v0.1.0 map_swaps
substreams gui orca-whirlpool-substream@v0.1.0 graph_out
blocks_without_votes
allows you to consume a full Solana Block without Vote instructions (Vote111111111111111111111111111111111111111
).
If you consume it on HISTORICAL data (+1000 blocks from HEAD), you will be reading from the StreamingFast cache, thus saving costs on the amount of TB read.
substreams gui orca-whirlpool-substream@v0.1.0 solana:blocks_without_votes
substreams gui orca-whirlpool-substream@v0.1.0 store_pools
substreams gui orca-whirlpool-substream@v0.1.0 store_deposits
substreams gui orca-whirlpool-substream@v0.1.0 store_withdraws
substreams gui orca-whirlpool-substream@v0.1.0 store_swaps
substreams gui orca-whirlpool-substream@v0.1.0 store_unique_users
substreams gui orca-whirlpool-substream@v0.1.0 store_cumulative_users
substreams gui orca-whirlpool-substream@v0.1.0 store_total_pool_count
substreams gui orca-whirlpool-substream@v0.1.0 store_pool_balances
substreams gui orca-whirlpool-substream@v0.1.0 store_pool_liquidity
substreams gui orca-whirlpool-substream@v0.1.0 store_activity_counts
substreams gui orca-whirlpool-substream@v0.1.0 store_volume_by_token_amount
program_ids_without_votes
creates a cache to efficiently retrieve instructions based on the program ID.
For example, the following sets keys for the Token program:
substreams gui orca-whirlpool-substream@v0.1.0 solana:program_ids_without_votes