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:
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"]'
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
substreams gui indexer-stake-tracker@v0.0.4 map_stake_deposited
substreams gui indexer-stake-tracker@v0.0.4 map_stake_withdrawn
substreams gui indexer-stake-tracker@v0.0.4 map_allocation_closed1
substreams gui indexer-stake-tracker@v0.0.4 map_allocation_closed2
substreams gui indexer-stake-tracker@v0.0.4 map_allocation_closed
substreams gui indexer-stake-tracker@v0.0.4 map_query_fees_collected
substreams gui indexer-stake-tracker@v0.0.4 map_staked_tokens_changes
substreams gui indexer-stake-tracker@v0.0.4 db_out
substreams gui indexer-stake-tracker@v0.0.4 store_stake_token_changes
substreams gui indexer-stake-tracker@v0.0.4 store_query_fees_collected
message
FileDescriptorSet
message
FileDescriptorProto
message
DescriptorProto
message
ExtensionRangeOptions
message
FieldDescriptorProto
message
OneofDescriptorProto
message
EnumDescriptorProto
message
EnumValueDescriptorProto
message
ServiceDescriptorProto
message
MethodDescriptorProto
message
FileOptions
message
MessageOptions
message
FieldOptions
message
OneofOptions
message
EnumOptions
message
EnumValueOptions
message
ServiceOptions
message
MethodOptions
message
UninterpretedOption
message
SourceCodeInfo
message
GeneratedCodeInfo
message
Any
message
Timestamp
message
Service
message
DBTConfig
message
HasuraFrontend
message
PostgraphileFrontend
message
PGWebFrontend
message
RESTFrontend
message
DatabaseChanges
message
TableChange
message
CompositePrimaryKey
message
Field
message
Modules
message
Binary
message
Module
message
Package
message
PackageMetadata
message
ModuleMetadata
message
Clock
message
BlockRef
message
Request
message
Response
message
BlockUndoSignal
message
BlockScopedData
message
SessionInit
message
InitialSnapshotComplete
message
InitialSnapshotData
message
MapModuleOutput
message
StoreModuleOutput
message
OutputDebugInfo
message
ModulesProgress
message
ProcessedBytes
message
Error
message
Job
message
Stage
message
ModuleStats
message
ExternalCallMetric
message
StoreDelta
message
BlockRange
message
DeployRequest
message
EnvironmentVariable
message
DeployResponse
message
UpdateRequest
message
UpdateResponse
message
InfoRequest
message
InfoResponse
message
SinkProgress
message
PackageInfo
message
ListRequest
message
ListResponse
message
DeploymentWithStatus
message
RemoveRequest
message
RemoveResponse
message
PauseRequest
message
PauseResponse
message
StopRequest
message
StopResponse
message
ResumeRequest
message
ResumeResponse
enum
DeploymentStatus
message
EntityChanges
message
EntityChange
message
Value
message
Array
message
Field
message
OwnedStakeTokenChange
message
OwnedStakeTokenChanges
message
AllocationClosedData
message
AllocationClosedDatas
message
AllocationClosedResult
message
StakedTokensChange
message
StakedTokensChanges
message
QueryFeesCollected
message
QueryFeesCollecteds