Consensys / Tokens

Ethereum Token Contracts
MIT License
2.06k stars 1.19k forks source link

Prevent Transferring to 0x0 and Contract Address #120

Closed Muhammad-Altabba closed 6 years ago

Muhammad-Altabba commented 6 years ago

Prevent transferring to the 0x0 address, and the contract address, according to Token Implementation Best Practices. Reference: https://consensys.github.io/smart-contract-best-practices/tokens/

maurelian commented 6 years ago

@Muhammad-Altabba I'd ask you to also implement tests to verify the behaviour you've introduced, but first...

@skmgoldin If we added these protections (ie. prevent send to 0x0 and address(this)), I think we should do so in a child contract that inherits from EIP20.sol. What do you think?

Muhammad-Altabba commented 6 years ago

I will be happy to implement tests to verify the behavior. And if we need to add the proposed check in a child contract I will also be happy to implement (even I prefer it to be inside the same EIP20.sol contract). Please direct me with your recommendation and I will do the needed. Thanks,

skmgoldin commented 6 years ago

I feel it definitely should not be in EIP20.sol. Perhaps a different implementation called something like SafeEIP20.sol or something.

Muhammad-Altabba commented 6 years ago

Dear @maurelian and @skmgoldin, I added SafeEIP20.sol and changed EIP20Factory to use SafeEIP20. And I wrote JavaScript Truffle Tests for the new contract: SafeEIP20. Please let me know if you think that more things are needed to be done or modified. Thanks,

Muhammad-Altabba commented 6 years ago

Hello, Is there anything, I can help with, to speed up accepting this Pull Request? Thanks,

Muhammad-Altabba commented 6 years ago

Hi, Could I help regarding this pull request?

maurelian commented 6 years ago

Done. Apologies for the delay Muhammad.

Muhammad-Altabba commented 6 years ago

No problem, Many thanks,