-
Notifications
You must be signed in to change notification settings - Fork 21
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): set user token #1554
Conversation
This PR blocks several other PRs (#1557, #1566, #1570, #1572, #1573, #1574), which are all blocking each other and conflicting with the realization of #1568 and #1578. As a result, it has become too cumbersome to develop the expected features based on the draft work. That's why I am merging this PR. Please, @bitdivine, review it as it was not merged yet, and let's improve or correct what's needed in separate PRs afterward. |
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, thanks. There are a couple of small tweaks that could be made but that is all.
Motivation
Given that we are required to extend the dApp to allow users to enable and disable ERC20 tokens as well, we decided to take a simplistic approach - i.e., extending the current entities with a similar mechanism as the one we implemented for
CustomToken
by adding an "enabled" flag toUserToken
. We discussed using the "custom token" types, but extending the stable tree map we already have allows us to avoid a migration at this time that does not necessarily add value for end users. This new approach also means that user tokens (ERC20) won't be added and deleted anymore in the state, which is why this PR deprecates the related function and adds a setter, again similar to the custom token approach.Changes
add_user_token
andremove_user_token
set_user_token
andset_many_user_tokens
for Erc20 tokens. Pattern similar to "custom token" which we added recently and are using for Icrc on the ICenabled: Option<bool>
inUserToken
typeNotes
In another PR soon, I'll remove the deprecated functions.
Tests
Provide related tests and upgrade as well.