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

Balance is always treated like network currency #472

Open
wottpal opened this issue May 4, 2023 · 3 comments
Open

Balance is always treated like network currency #472

wottpal opened this issue May 4, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@wottpal
Copy link

wottpal commented May 4, 2023

Hey, when working with fungible token contracts (i.e. PSP-22) we've noticed that contracts-ui is statically assuming that values with the Balance type are always the native chain currency with it's decimals & token identifier.

In the PSP-22 interface, Balance is just an alias type for u128 and can have any decimal & any token identifier. And as the input field is already denominating with the networks decimals (e.g. 12) it's super confusing that it assumes the same for other tokens Balances.

Maybe adding a "Network Currency" switch that switches between networks decimals & token symbol between just the plain u128 value w/o any decimals applied would help here?

Screenshot 2023-05-04 at 17 14 33

@wottpal wottpal added the bug Something isn't working label May 4, 2023
@andropixels
Copy link

i guess thats not a bug
you can enable transfer or other psp22 functions in your contract by importing your contract as dependancy

@peetzweg peetzweg added enhancement New feature or request and removed bug Something isn't working labels Mar 19, 2024
@peetzweg
Copy link
Collaborator

Agree this can be confusing. It's blindly stating the chains token symbol for any Balance type inputs. That's probably often true but not always, therefore this ticket.

Adding some custom logic for detecting an interaction with a psp22 contract could help here, however imho the actual benefits are a bit limited. I would almost rather opt for not showing any Symbol on a Balance input. 🤔

@wottpal
Copy link
Author

wottpal commented Mar 22, 2024

IMO the most simple fix would be a little toggle in the input field that either denominates the value as a balance (12 decimals) or doesn't denominate at all. Just removing the symbol still leaves up the question: Is this value denominated or now? And if yes, how many decimals?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants