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

Intentional use of accounting terms? #23

Open charles-cooper opened 6 years ago

charles-cooper commented 6 years ago

I'm wondering if the use of the words 'debit' and 'credit' in the definitions of 'mint' and 'burn' are intentionally used in the technical accounting sense of the term or not. The current wording implies that accounts are credit-normal (like a liability) and the total supply is debit-normal (like an asset). If that's the case, I think that that should be made explicit in the readme and the verbiage on https://github.com/dapphub/ds-token/blob/13e09345fb459103875a6266705a14ab6f72b6d3/README.md#L18-L24 should change to read more like

#### `mint`
increase (credit) tokens at an address whilst simultaneously increasing (debiting) `totalSupply`  
(requires auth) 

#### `burn` 
decrease (debit) tokens at an address whilst simultaneously decreasing (crediting) `totalSupply`  
(requires auth)
rainbreak commented 6 years ago

No, this is not intentional and there is no relation to the technical terms. We should probably change the wording to avoid confusion.

Perhaps drop the terms entirely:

#### `mint`
increase the `totalSupply` by increasing the balance of a specific address
(requires auth) 

#### `burn` 
decrease the `totalSupply` by decreasing the balance of a specific address
(requires auth)
charles-cooper commented 6 years ago

Cool, thanks!

My own two cents is that using the double entry accounting terms can lend a lot of clarity since they have implications about money supply invariants - in this case totalSupply == sum(balances). The only question would be which accounts are debit/credit normal but I think making user balances credit normal would be most natural.