dn404 icon indicating copy to clipboard operation
dn404 copied to clipboard

✨ Add support for custom base unit for DN404 tokens.

Open codebuster22 opened this issue 2 years ago • 1 comments

User story

As a developer creating new DN404 token with custom base unit, I want to have built in compatibility to set base unit (WAD) value for my project rather than using the default WAD=10**18 value.

Why

I was building a DN404 token and I realized that my requires base unit to be set as 10**24 instead of the default value.

Status Quo

Currently, I cannot override the value of _WAD as it is a constant value used in multiple functions

Potential Solution

Instead of using _WAD as a constant variable, create a view function that can be overwritten by developers.

Note: The choice for view function over pure is to allow community to create factory contracts for DN404 where the base unit can be set as a state variable which is then used inside _WAD internal function.

codebuster22 avatar Feb 14 '24 11:02 codebuster22

We might add it, if the compiler is able to zero-cost abstract it. Not sure why you need 10**24 tho.

Vectorized avatar Feb 14 '24 11:02 Vectorized

Added in #63. Thanks for the issue!

Vectorized avatar Feb 15 '24 04:02 Vectorized