"My public address" included in the message: https://etherscan.io/address/0x0000006f0994c53C5D63E72dfA8Cf38412E874A4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| contract C { | |
| function transfer(address recipient, uint256 amount) public override returns (bool) { | |
| _transfer(_msgSender(), recipient, amount); | |
| return true; | |
| } | |
| function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { | |
| _transfer(sender, recipient, amount); | |
| _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); | |
| return true; |
Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!
The advantages of versions 0.8.* over <0.8.0 are:
- Safemath by default from
0.8.0(can be more gas efficient than some library based safemath). - Low level inliner from
0.8.2, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For example, OpenZeppelin libraries typically have a lot of small helper functions and if they are not inlined, they cost an additional 20 to 40 gas because of 2 extra jump instructions and additional stack operations needed for function calls. - Optimizer improvements in packed structs: Before
0.8.3, storing packed structs, in some cases used an additional storage read operation. After [EIP-