skyge pfp
skyge
@skyge
For the zero address check, when executing `transfer` and `transferFrom` functions in token contracts, I will check whether the recipient address is the zero address. This check is necessary because the zero address is a special address that no one controls. Transferring tokens to the zero address is akin to burning tokens, but not in the traditional sense of burning tokens. To ensure a more reasonable token circulation, I will include a check for the zero address in these cases. However, in the `constructor` function, if the intention is to set a contract address, such as a treasury contract, I may not perform the zero address check. Instead, I would prefer to have a separate function that can update this contract address later. This approach allows for more flexibility because not only is `address(0)` considered invalid, but `address(1)` is also invalid. Therefore, having a dedicated function to modify the contract address provides a better solution.
0 reply
0 recast
0 reaction