Skip to content
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

feat(backend): record custom user ICRC tokens #1037

Merged
merged 32 commits into from
Apr 9, 2024
Merged

Conversation

peterpeterparker
Copy link
Member

@peterpeterparker peterpeterparker commented Apr 8, 2024

Description

Similar to how users interact with ERC20 tokens, we aim to provide the capability to add, remove, and list ICRC tokens. Considering the differences between these token types, we've introduced a new storage mechanism tailored for a stable, yet more generic structure. This decision anticipates the potential to support additional token types in the future. Consequently, we may consider migrating existing ERC20 tokens into this new, more adaptable map.

Feature

  • new function to add, remove and list tokens
  • introduce enum UserToken, struct IcrcToken and implementation for equality purpose when adding or removing entry
  • add implementation for UserTokenId to be able to identity token uniquely
  • related tests (similar for ERC20 custom tokens test as well)
  • generate did files

peterpeterparker and others added 14 commits April 8, 2024 09:09

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
peterpeterparker and others added 15 commits April 8, 2024 12:58
@peterpeterparker peterpeterparker marked this pull request as ready for review April 8, 2024 14:24
Copy link
Member

@bitdivine bitdivine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!


mutate_state(|s| remove_from_user_token(stored_principal, &mut s.user_custom_token, &find));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would make the query below a certified query but I see that it is the same as the query above. And who knows, there are shiny new certification methods coming that don't require you to keep all your data in a merkle tree!

@peterpeterparker peterpeterparker merged commit 40b1179 into main Apr 9, 2024
6 checks passed
@peterpeterparker peterpeterparker deleted the feat/icrc-tokens branch April 9, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants