-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
token-cli: set-transfer-fee
has different granularity than create-token
#7020
Comments
Hey! I'm interested in working on this issue. Can you give me more context so I can start working on it? |
@Hrushi20 that would be great! Essentially, the problem is that solana-program-library/token/cli/src/clap_app.rs Lines 2253 to 2260 in 821c55b
And parsed at: solana-program-library/token/cli/src/command.rs Line 4339 in 821c55b
But when creating the token, the maximum fee is taken as a raw token amount: solana-program-library/token/cli/src/clap_app.rs Lines 760 to 770 in 821c55b
and parsed at: solana-program-library/token/cli/src/command.rs Lines 3474 to 3485 in 821c55b
So we want that second case to take in a UI amount instead of a raw token amount. The problem becomes the deprecation process, since it would be bad if we just change how the So the complete work would be:
And I think that would do it! Let me know if you have any other questions |
Thanks for the detailed response. Almost done with implementation. Quick question, what does |
That's great news! And both flags must be specified. You have a fraction of the fee (--transfer-fee-basis-points), and a ceiling (--transfer-fee-maximum-fee), as both values are currently set with the |
Thanks for working on this! There should also be a failure if one attempts to set a maximum fee which isn't representable, e.g. 1.23456 if there are only 4 decimal places. But no failure if someone sets the maximum fee to something larger than fixed suppy. Ideally one would specify the amounts in tokens instead of minimum granularity units, i.e. 1.23456 instead of 123456. "let maximum_fee = value_t_or_exit!(arg_matches, "maximum_fee", f64);" -> f64 doesn't have enough precision to represent a maximum-precision maximum fee (38.18 or whatever it is). Also be careful not to create a bug where rounding the result will push it outside the representable range on Solana, or wrap it to 0 or something bad. Rounding shouldn't be involved at all because this is fixed-point, but I assume you're stuck with f64 due to a design compromise affecting the entire codebase. |
As reported at anza-xyz/agave#2135:
Problem
set-transfer-fee works in whole tokens. create-token with "--transfer-fee" works in 10^(-decimals) tokens.
Proposed Solution
Either make them equal or document this more clearly. The way things are now is just asking for errors.
cc @SolBugz
The text was updated successfully, but these errors were encountered: