-
Notifications
You must be signed in to change notification settings - Fork 42
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
NNS1-2849: Add derived token stores #4461
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dskloetd
force-pushed
the
kloet/sns-token-store
branch
from
February 12, 2024 13:39
ee00305
to
7ec32dd
Compare
lmuntaner
approved these changes
Feb 12, 2024
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.
Thanks!
Just a few comments, but it looks good!
mstrasinskis
approved these changes
Feb 12, 2024
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, thank you!
dskloetd
changed the title
Add derived token stores
NNS1-2849: Add derived token stores
Feb 12, 2024
1 task
1 task
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 9, 2024
# Motivation This function `fillTokensStoreFromAggregatorData` was initially added in #4455 and later removed in #4461. It appears to have been a temporary function that is no longer necessary. # Changes - Removes `fillTokensStoreFromAggregatorData` # Tests - Deletes tests # Todos - [ ] Add entry to changelog (if necessary). Not necessary
yhabib
added a commit
that referenced
this pull request
Dec 9, 2024
# Motivation This function `fillTokensStoreFromAggregatorData` was initially added in #4455 and later removed in #4461. It appears to have been a temporary function that is no longer necessary. # Changes - Removes `fillTokensStoreFromAggregatorData` # Tests - Deletes tests # Todos - [ ] Add entry to changelog (if necessary). Not necessary
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
tokensStore
used to be keyed by universe ID but in order to reuse the IcrcWalletPage for the SnsWallet, it needed to be keyed by ledger canister ID. But there are other context where it is still more convenient to access the token by universe ID or root canister ID. It is currently temporarily keyed by both, which means it has the same tokens multiple times. But converting root canister ID to ledger canister ID every time would be tedious.Additionally, the SNS tokens data already exists in the aggregator data, which means we now have several sources of truth for the tokens data.
The clean solution is to have 1 source of truth, and derived stores for everything else.
So with this PR:
tokensStore
only holds non-SNS tokenssnsAggregatorStore
becomes the only source of truth for SNS tokensChanges
tokensStore
in bothlib/services/$public/sns.services.ts
(for production) andtests/utils/sns.test-utils.ts
for testing.snsTokensByRootCanisterIdStore
,snsTokensByLedgerCanisterIdStore
,tokensByUniverseIdStore
andtokensByLedgerCanisterIdStore
.tokensStore
was used directly before.loadIcrcToken
andloadToken
, don't load the token if it's a known SNS token as it should already be available in the appropriate derived stores.fee
in the aggregator test token data.lifecycle
optional in the aggregator test data.Tests
loadIcrcToken
doesn't load SNS tokens.Todos