{"id":28095949,"url":"https://github.com/evmos/decay-data","last_synced_at":"2025-10-08T08:52:56.676Z","repository":{"id":128189776,"uuid":"602943440","full_name":"evmos/decay-data","owner":"evmos","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-23T20:54:17.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T19:50:40.225Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evmos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-17T09:26:27.000Z","updated_at":"2023-03-23T23:38:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc016ac7-e698-4999-a011-d4351af4da77","html_url":"https://github.com/evmos/decay-data","commit_stats":null,"previous_names":["evmos/decay-data","facs95/decay-data"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evmos/decay-data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmos%2Fdecay-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmos%2Fdecay-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmos%2Fdecay-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmos%2Fdecay-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evmos","download_url":"https://codeload.github.com/evmos/decay-data/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evmos%2Fdecay-data/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278916436,"owners_count":26068090,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-13T16:17:17.955Z","updated_at":"2025-10-08T08:52:56.671Z","avatar_url":"https://github.com/evmos.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repo tries to collect migrated and merged events over a specified block range.\n\n## Results\n\nThe collected data will be generated under an `account.db` sqlite3 database containing the following tables:\n\n```go\ntype MergedEvent struct {\n\tID                       int\n\tRecipient                string\n\tSender                   string\n\tClaimedCoins             string\n\tFundCommunityPool        string\n\tSenderEvmosPrefix        string\n\tSenderGenesisClaimRecord string\n\tHeight                   int\n}\n\ntype ClaimEvent struct {\n\tID     int\n\tSender string\n\tAction string\n\tAmount string\n\tHeight int\n}\n\ntype DecayAmount struct {\n\tID                     int\n\tSender                 string\n\tVoteAction             string\n\tDelegateAction         string\n\tEVMAction              string\n\tIBCAction              string\n\tTotalClaimed           string\n\tTotalLost              string\n\tInitialClaimableAmount string\n\tTotalLostEvmos         float64\n}\n\ntype Error struct {\n\tID         int\n\tHeight     int\n\tEventType  string\n\tTxIndex    string\n\tEventIndex string\n}\n```\n\n## Instructions\n\n1. Run `go build` to install the binary\n2. Run `./decay-data collect-events FROM_BLOCK TO_BLOCK`  with the block range you want to collect the events from\n    - Note that this will take some time depending on the number of blocks that wants to be inspected\n3. Run `./decay-data collect-merge-senders`\n4. Run `./decay-data calculate-decay-loss`\n5. Run `./decay-data sender-evmos-prefix`\n6. New database `accounts.db` should be generated in the root directory.\n\n## How it works\n\n- `collect-events`\n    - Collects `claim` and `merge_claims_records` into a sqlite3 database through the following steps on every block within the specified range:\n        1. Creates `accounts.db` sqlite3 database\n        2. Queries `BlockResults` of every block within range\n        3. For every `BlockResult` it iterates over all of the Txs within the block\n            - If `Tx` emitted either `merge_claims_records` then it decodes the attributes of the event and stores the event in `merged_event` table\n            - If `Tx` emitted either `claim` then it decodes the attributes of the event and stored the event in `claim_event` table\n    - Required Params\n        - `fromBlock`\n            - Block height to start collecting events from\n        - `toBlock`\n            - End height of block range\n    - Results\n        - Generates a sqlite3 database, `accounts.db`\n        - There are three tables within the database with the following models\n\n            ```go\n            type MergedEvent struct {\n            \tID                 int\n            \tRecipient          string\n            \tSender             string\n            \tClaimedCoins       string\n            \tFundCommunityPool  string\n            \tSenderEvmosPrefix  string\n            \tSenderGenesisClaimRecord string\n            \tHeight             int\n            }\n\n            type ClaimEvent struct {\n            \tID     int\n            \tSender string\n            \tAction string\n            \tAmount string\n            \tHeight int\n            }\n\n            type Error struct {\n            \tID         int\n            \tHeight     int\n            \tEventType  string\n            \tTxIndex    string\n            \tEventIndex string\n            }\n            ```\n\n- `collect-merge-senders`\n    - Because the `sender` of the transaction is not present on the `merge_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:\n        - Iterate over all the events on the `merged_event` table in `accounts.db`\n        - For every event, query `BlockResult` at event `height`\n        - Find `Tx` within block\n        - Find `recv_packet` event within `Tx`\n        - Decode attributes of the event and add the `sender` to the row record within `MergeEvent` table\n- `calculate-decay-loss`\n    - 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.\n    - NOTE: Requires `genesis.json` file to be downloaded.\n    - Using Evmos’s genesis file claims records and the acquired data on `claim_event`, calculate per address:\n        - `TotalClaimed` - Total amount of `aevmos` claimed\n        - `InitialClaimableAmount` - Claimable amount at genesis\n        - `TotalLost` - Total amount lost in `aevmos`\n        - `TotalLostEvmos` - Total amount lost in `evmos`\n        - `EVMAction` - Amount claimed through `EVMAction` claim type\n        - `IBCAction` - Amount claimed through `IBCAction` claim type\n        - `VoteAction` - Amount claimed through `VoteAction` claim type\n        - `DelegateAction` - Amount claimed through `DelegateAction` claim type\n    - Results\n        - A New `DecayAmount` table gets generated with the following model\n\n            ```go\n            type DecayAmount struct {\n            \tID                     int\n            \tSender                 string\n            \tVoteAction             string\n            \tDelegateAction         string\n            \tEVMAction              string\n            \tIBCAction              string\n            \tTotalClaimed           string\n            \tTotalLost              string\n            \tInitialClaimableAmount string\n            \tTotalLostEvmos         float64\n            }\n            ```\n\n- `sender-evmos-prefix`\n    - This script will basically populate the `SenderEvmosPrefix` column in `MergedEvent` table. This is because the sender on each `merge_claims_records` event is on `osmosis` denomination, we need to find the equivalent `evmos` address to be able to find its respective `initial_claimable_record` in genesis.\n    - It also populates `SenderGenesisClaimRecord` column finding the information of the sender in the genesis file’s claim records.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevmos%2Fdecay-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevmos%2Fdecay-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevmos%2Fdecay-data/lists"}