Vectorized / dn404

Implementation of a co-joined ERC20 and ERC721 pair.
MIT License
476 stars 158 forks source link

✨ Add support for custom base unit for DN404 tokens. #59

Closed codebuster22 closed 9 months ago

codebuster22 commented 9 months ago

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.

Vectorized commented 9 months ago

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

Vectorized commented 9 months ago

Added in #63. Thanks for the issue!