dapphub / ds-token

A simple and sufficient ERC20 implementation
https://dapp.tools/dappsys/ds-token.html
GNU General Public License v3.0
224 stars 76 forks source link

Use string for name and symbol #28

Closed brianmcmichael closed 3 years ago

brianmcmichael commented 4 years ago

Recent versions of solc do not treat bytes32 and string in the same way that it used to, they are no longer comparable or directly castable. Therefore, creating token integrations with more recent versions of solc have difficulty processing the DS-Token's bytes32 return from name and string. The ERC20 standard does call for string types to be used for these optional returns so I'm just putting this forth as a suggestion.

d-xo commented 4 years ago

Is there some nice way to have these strings be constant? dynamic types and memory parameters are quite annoying for FV.

brianmcmichael commented 4 years ago

@xwvvvvwx that gets into a philosophical discussion. In ds-token now, they symbol is set via the constructor and the name is set via a setter function. To be constant you'd have to hard-code them into the contract prior to deployment and you wouldn't be able to pass them as params. I don't want to change those patterns without the blessing of the maintainers. solc 0.6.5+ allows for immutable variables to be set via a constructor, but I'm not sure if that would achieve any benefit by way of formal verification, and the existing ds-token isn't 0.6.x compatible anyways.

gbalabasquer commented 4 years ago

Unfortunately immutable doesn't work with string type.

d-xo commented 3 years ago

@brianmcmichael If you rebase this onto latest master I will merge

brianmcmichael commented 3 years ago

Rebased.

d-xo commented 3 years ago

oops, looks like merging the decimals PR created a conflict here, can you rebase again.

brianmcmichael commented 3 years ago

Rebased again.