-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Inherit asset decimals in ERC4626 #3639
Conversation
The current tests already check decimal overriding. We don't have a test where the fallback is done. Will work on that. |
Testing should be good now |
This is an improvement over the status quo because it will work for tokens with no decimals. However, one of the points raised in #3549 was:
I find this pretty compelling, but to stop using decimals in the conversion functions would be a breaking change now... From #3549 (comment):
The reason for those functions was to define conversion without reference to the decimals values. |
Co-authored-by: Francisco <frangio.1@gmail.com>
Initial conversion function added. They are tests trough our current test suite (that checks decimals mismatch). Need a breaking change description |
Co-authored-by: Francisco <frangio.1@gmail.com>
I changed the variable name in the constructor which was |
this breaks upgradability from previous implementations to some extent because the initializer is not called on upgrading and therefore_decimals is never set. so decimals() needs to be overridden with a hardcoded value instead of calling super.decimals() |
@alexflorence This is a good point we didn't notice. It's solved by calling the initializer though in a function like this: function migrateToV48() public reinitializer(2) {
__ERC4626_init(asset);
} We should add a note in the changelog for this. We can consider defaulting to @alexflorence Let us know your thoughts. |
Inherit the decimal value from the asset (if any) while still supporting customization on top of ERC4626
Fixes #3549
PR Checklist