-
Notifications
You must be signed in to change notification settings - Fork 242
Split the notions of "token balances" and "token accounts" #311
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
Conversation
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Rather than separate "from" and "to" operations, this should be a single operation for the database plugin (since it must happen transactionally). Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
This isn't a full-fledged view of accounts, but it provides a way to query all unique addresses that have (or have had) a non-zero token balance. Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Codecov Report
@@ Coverage Diff @@
## main #311 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 229 230 +1
Lines 12562 12582 +20
=========================================
+ Hits 12562 12582 +20
Continue to review full report at Codecov.
|
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
peterbroadhurst
left a comment
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.
Looks great.
I note even thinking back to the comment above, we’re not committing NoSQL to implement this using distinct. Just putting it into the framework for this implementation 👍
| sel = sel.Limit(fi.Limit) | ||
| } | ||
| } | ||
| if fi.Distinct { |
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.
Can’t think of any reason this will be problematic for NoSQL in the future. But an observation that we’re putting another requirement on the truck here
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.
You know what, I actually don't have any need to expose this here. I thought I would, but as it played out, this is only used in the database layer (where it has access to the full SelectBuilder anyway).
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.
I removed this requirement from the "Filter" interface. It's now only confined to the SQL code.
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
This reverts commit 7ae1afa. Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Part of #218.
The thing that has up to now been known as an "account" is really just a "balance" - ie given an identity, a pool, and optionally a token index, it tracks a number stating how many of that token are owned. All of this existing functionality has therefore been renamed from "token accounts" to "token balances".
This PR also introduces a new concept of what is a "token account" - currently just a filtered, distinct list of all the identities tracked in "token balances". Eventually this may evolve to include more aggregate details on each identity's holdings, but this is the simplest start without adding another table.