Package Logo
indexer_stake_tracker
indexer-stake-tracker@v0.0.4
Total Downloads
21644
Published
1 months ago
Publisher
User Avatar sduchesneau

Readme

Indexer Staked Tokens Tracker

This is a substreams which can be used to track the staked tokens of an indexer.

This is a first draft and the which recalculates the staked tokens of an indexer every time an allocation is closed.

Future work could include:

  • Tracking when a stake is directly added to an indexer's account

Usage

By default, this substreams tracks all indexers, but you can filter the indexers you want to track by setting the params on the map_allocation_closed module.

The default parameter is '*' to track all indexers. To track specific indexers, set this value to a json list of indexer addresses. For example: '["35917c0eb91d2e21bef40940d028940484230c06"]'

Deployment

This substreams has a db_out module which can be used with the substreams-sink-sql to store the data in a SQL database.

For more information on how to deploy this way, refer to https://github.com/streamingfast/substreams-sink-sql

You can use devel/up.sh (rm -rf devel/data if you want) and you will get an instance with this DSN:

DSN=psql://dev-node:insecure-change-me-in-prod@localhost:5432/dev-node?sslmode=disable

In short: If you have a postgres database running and the dsn is $DSN, you can deploy this substream with the following command:

substreams-sink-sql setup $DSN https://spkg.io/streamingfast/indexer-stake-tracker-v0.0.1.spkg

This will set up the tables on the database.

Then you can deploy the substream with the following command:

substreams-sink-sql run $DSN https://spkg.io/streamingfast/indexer-stake-tracker-v0.0.1.spkg

Documentation

Modules

Maps icon
Maps

map
map_stake_deposited

2dec7235085d30276579d2e1b9498680428e0153
map map_stake_deposited (
blocksf.ethereum.type.v2.Block
)  -> allocations.types.v1.OwnedStakeTokenChanges
substreams gui indexer-stake-tracker@v0.0.4 map_stake_deposited

map
map_stake_withdrawn

d07db8633cf809a5a5106606e3b3e4a7a0aadd94
substreams gui indexer-stake-tracker@v0.0.4 map_stake_withdrawn

map
map_allocation_closed1

96c39981781278fd7df429167c341e7c9f1d9ba4
substreams gui indexer-stake-tracker@v0.0.4 map_allocation_closed1

map
map_allocation_closed2

1ad21280fa02d5c92111d73e2d7b435c23fa63ed
substreams gui indexer-stake-tracker@v0.0.4 map_allocation_closed2

map
map_allocation_closed

ff5471823f93a06f730b6b6b1f8f538421911d6e
Default param : ["35917c0eb91d2e21bef40940d028940484230c06"]
substreams gui indexer-stake-tracker@v0.0.4 map_allocation_closed

map
map_query_fees_collected

f20d4a3f512b93e2663bab4fce9de67cbc6716e0
map map_query_fees_collected (
paramsstring
)  -> allocations.types.v1.QueryFeesCollecteds
Default param : ["35917c0eb91d2e21bef40940d028940484230c06"]
substreams gui indexer-stake-tracker@v0.0.4 map_query_fees_collected

map
map_staked_tokens_changes

b44fb63713b22c27ed50568fa12af4549e96f07a
substreams gui indexer-stake-tracker@v0.0.4 map_staked_tokens_changes

map
db_out

365cc73069ee4345a1f6bee10575e7a3ae610db0
substreams gui indexer-stake-tracker@v0.0.4 db_out
Stores icon
Stores

store
store_stake_token_changes

b55a7fe6de79f971808d51954c4a10358d9ea393
Default param : ["35917c0eb91d2e21bef40940d028940484230c06"]
substreams gui indexer-stake-tracker@v0.0.4 store_stake_token_changes

store
store_query_fees_collected

459d795db76abcb1032827acd7f03645726fa188
store <add,bigint> store_query_fees_collected (
)
substreams gui indexer-stake-tracker@v0.0.4 store_query_fees_collected
Protobuf

Protobuf Docs Explorer

allocations.types.v1