Reduce reliance on underlying decimals in ERC4626
See original GitHub issue4626 uses _asset.decimals()
to calculate initial share/asset conversions
EIP4626 states:
All ERC-4626 tokenized Vaults MUST implement ERC-20’s optional metadata extensions.
But EIP20 states for decimals
:
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.
So even if the vault exposes decimals
for shares, the 20 spec says not to expect assets to expose decimals
.
Even if both tokens expose decimals
the method is for usability, not for onchain calculations.
Maybe a virtual _initialShareRatio()
function could be exposed that implementing contracts can override without needing to override the entire conversion process
Issue Analytics
- State:
- Created a year ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
ERC-4626: Extending ERC-20 for Interest Management
The new standard ERC-4626 extends ERC-20 for interest bearing accounts. We'll explore how the standard works and how it can help you with...
Read more >Vaults and the ERC-4626 token contract - Crypto Market Pool
Surely the ERC-4626 token standard reduces the amount of time and work ... external requiresAuth { // Ensure the underlying token's decimals match...
Read more >Decimals Operations: Multiplying - Extranet
Multiplying decimals relies on adapting multiplication of whole numbers. When one of the numbers being multiplied is reduced to a tenth of its...
Read more >What is Defactor (FACTR) | What is Defactor token | What is FACT ...
Defactor reduces the barriers to entry for Real World Asset Originators by providing tools to manage and scale their processes and giving investors ......
Read more >Cellar | Address 0x6b7f87279982d919bbf85182ddeab179b366d8f2 ...
@author Brian Le */ contract Cellar is ERC4626, Owned, ... contract * @param _asset address of underlying token used for the for accounting,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So we could do
and no possibility to override decimal … or
That way devs can still override
Really like the first option @Amxx