You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overriding asset() function which is defined as virtual might be kinda common practice.
If a project wants to do so it would be nice that all the places that uses the internal variables _asset will be overrided as well.
📝 Details
The internal variable _asset is used in: totalAssets, _deposit and _withdraw. I suggest to replace them with the function asset(), to have a more consistent override
The text was updated successfully, but these errors were encountered:
invocamanman
changed the title
ERC4626 replace _asset with asset() in order to be easily override-able
ERC4626 replace _asset with asset() in order to be easily overrideable
Nov 26, 2024
I opened a PR for this in #5322. My first impression is that the change would be breaking if an ERC4626Upgradeable contract overrode asset() and then performs an upgrade. Though, I haven't found a concrete security concern.
Another thing that came to my mind is that I've found it weird to call a public function inside an internal one. Nothing wrong with it but I remember we had a similar conversation in another issue.
Another thing that came to my mind is that I've found it weird to call a public function inside an internal one. Nothing wrong with it but I remember we had a similar conversation in another issue.
We do that quite often. I don't think it is an issue.
🧐 Motivation
Overriding
asset()
function which is defined as virtual might be kinda common practice.If a project wants to do so it would be nice that all the places that uses the internal variables
_asset
will be overrided as well.📝 Details
The internal variable
_asset
is used in:totalAssets
,_deposit
and_withdraw
. I suggest to replace them with the functionasset()
, to have a more consistent overrideThe text was updated successfully, but these errors were encountered: