Output
sf.substreams.sink.entity.v1.EntityChanges
Package ref
orca-whirlpool-substream@v0.1.0Run package
CLI
Run graph_out from the command line.
substreams run orca-whirlpool-substream@v0.1.0 graph_out -e solanasubstreams auth or directly on thegraph.market (see docs).README
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;
Modules
Output
sf.substreams.sink.entity.v1.EntityChanges
Inputs
Inputs
Inputs
Inputs
Store value
bigint
Update policy
add
Inputs
Store value
int64
Update policy
add
Inputs
Store value
proto:messari.orca_whirlpool.v1.DepositUpdate policy
set_if_not_exists
Inputs
Store value
bigint
Update policy
set
Store value
bigint
Update policy
add
Store value
proto:messari.orca_whirlpool.v1.PoolUpdate policy
set_if_not_exists
Inputs
Store value
proto:messari.orca_whirlpool.v1.SwapUpdate policy
set_if_not_exists
Inputs
Store value
int64
Update policy
add
Inputs
Store value
bigint
Update policy
set_if_not_exists
Inputs
Store value
bigint
Update policy
add
Inputs
Store value
proto:messari.orca_whirlpool.v1.WithdrawUpdate policy
set_if_not_exists
Inputs
`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.
Output
sf.solana.type.v1.BlockInputs
Output
sf.substreams.index.v1.Keys