-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New tables for staking pools and delegators #2036
Conversation
Pull Request Test Coverage Report for Build bc053e24-e932-43e2-9ea9-ff51693d3a99
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only left a nitpick comment about name
s
apps/explorer/lib/explorer/chain/import/runner/staking_pools.ex
Outdated
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/import/runner/staking_pools_delegators.ex
Outdated
Show resolved
Hide resolved
[pool], | ||
pool.is_active == true and | ||
pool.is_deleted == false and | ||
pool.is_validator == true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a minor comment, and the PR is merged anyway, but if you decide to change this code at some point, I would suggest using simplified where
syntax here:
where(query, is_active: true, is_deleted: false, is_validator: true)
pool.delegators | ||
|> Enum.map(&Map.get(&1, :changes)) | ||
|> Enum.concat(acc) | ||
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum.flat_map(pools, & &1.delegators.changes)
?
#1709
Motivation
There is a need to store
staking pools
anddelegators
list in the separate tables.In this PR I migrate
staking pools
fromaddress_names
table to thestaking_pools
table and addstaking_pools_delegators
table to storedelegators
.Changelog
staking_pools
table and schemastaking_pools_delegators
table and schemaaddress_names
table to thestaking_pools
tablePoolsReader
to fetchdelegators
delegators
inserting