This repo tries to collect migrated and merged events over a specified block range.
The collected data will be generated under an account.db
sqlite3 database containing the following tables:
type MergedEvent struct {
ID int
Recipient string
Sender string
ClaimedCoins string
FundCommunityPool string
SenderEvmosPrefix string
SenderGenesisClaimRecord string
Height int
}
type ClaimEvent struct {
ID int
Sender string
Action string
Amount string
Height int
}
type DecayAmount struct {
ID int
Sender string
VoteAction string
DelegateAction string
EVMAction string
IBCAction string
TotalClaimed string
TotalLost string
InitialClaimableAmount string
TotalLostEvmos float64
}
type Error struct {
ID int
Height int
EventType string
TxIndex string
EventIndex string
}
- Run
go build
to install the binary - Run
./decay-data collect-events FROM_BLOCK TO_BLOCK
with the block range you want to collect the events from- Note that this will take some time depending on the number of blocks that wants to be inspected
- Run
./decay-data collect-merge-senders
- Run
./decay-data calculate-decay-loss
- Run
./decay-data sender-evmos-prefix
- New database
accounts.db
should be generated in the root directory.
-
collect-events
- Collects
claim
andmerge_claims_records
into a sqlite3 database through the following steps on every block within the specified range:- Creates
accounts.db
sqlite3 database - Queries
BlockResults
of every block within range - For every
BlockResult
it iterates over all of the Txs within the block- If
Tx
emitted eithermerge_claims_records
then it decodes the attributes of the event and stores the event inmerged_event
table - If
Tx
emitted eitherclaim
then it decodes the attributes of the event and stored the event inclaim_event
table
- If
- Creates
- Required Params
fromBlock
- Block height to start collecting events from
toBlock
- End height of block range
- Results
-
Generates a sqlite3 database,
accounts.db
-
There are three tables within the database with the following models
type MergedEvent struct { ID int Recipient string Sender string ClaimedCoins string FundCommunityPool string SenderEvmosPrefix string SenderGenesisClaimRecord string Height int } type ClaimEvent struct { ID int Sender string Action string Amount string Height int } type Error struct { ID int Height int EventType string TxIndex string EventIndex string }
-
- Collects
-
collect-merge-senders
- Because the
sender
of the transaction is not present on themerge_claims_records
event, an extra step was necessary to collect the sender and track the claims properly. To accomplish this the following steps were followed:- Iterate over all the events on the
merged_event
table inaccounts.db
- For every event, query
BlockResult
at eventheight
- Find
Tx
within block - Find
recv_packet
event withinTx
- Decode attributes of the event and add the
sender
to the row record withinMergeEvent
table
- Iterate over all the events on the
- Because the
-
calculate-decay-loss
- The reason why this table was computed was to compared the results from those gather by a validator. This way we were able to validate the data from multiple sources.
- NOTE: Requires
genesis.json
file to be downloaded. - Using Evmos’s genesis file claims records and the acquired data on
claim_event
, calculate per address:TotalClaimed
- Total amount ofaevmos
claimedInitialClaimableAmount
- Claimable amount at genesisTotalLost
- Total amount lost inaevmos
TotalLostEvmos
- Total amount lost inevmos
EVMAction
- Amount claimed throughEVMAction
claim typeIBCAction
- Amount claimed throughIBCAction
claim typeVoteAction
- Amount claimed throughVoteAction
claim typeDelegateAction
- Amount claimed throughDelegateAction
claim type
- Results
-
A New
DecayAmount
table gets generated with the following modeltype DecayAmount struct { ID int Sender string VoteAction string DelegateAction string EVMAction string IBCAction string TotalClaimed string TotalLost string InitialClaimableAmount string TotalLostEvmos float64 }
-
-
sender-evmos-prefix
- This script will basically populate the
SenderEvmosPrefix
column inMergedEvent
table. This is because the sender on eachmerge_claims_records
event is onosmosis
denomination, we need to find the equivalentevmos
address to be able to find its respectiveinitial_claimable_record
in genesis. - It also populates
SenderGenesisClaimRecord
column finding the information of the sender in the genesis file’s claim records.
- This script will basically populate the