vkonst / ctd-token

Smart-contracts for Cointed Token and Token Sale
11 stars 9 forks source link

Mark functions with a specific access level #3

Closed pauliax closed 6 years ago

pauliax commented 6 years ago

For example, in Upgradable contract make these functions "external" instead of "public": setUpgradeMaster() upgrade()

in CtdToken, function create() should be "internal", as it is the best to call it from a Fallback function. returnWei should be "external" and so on...

As for best practices, you should use external if you expect that the function will only ever be called externally, and use public if you also need to call this function internally.

It is always suggested to explicitly mark function's visibility, as, for instance, calling external function consumes less gas than public function. This would save you some money.

vkonst commented 6 years ago

Considered as code enhancement Code updated

Not a security issue. Minor gas differences. However we considered it as a good point to follow style-guides and respect users.

Thanks for your input.