@@ -12,10 +12,10 @@ abstract contract ERC20 {
1212
1313 /// @notice Thrown when attempting to transfer more tokens than available balance
1414 error InsufficientBalance (address from , uint256 balance , uint256 amount );
15-
15+
1616 /// @notice Thrown when attempting to transfer more tokens than allowed
1717 error InsufficientAllowance (address owner , address spender , uint256 allowance , uint256 amount );
18-
18+
1919 /// @notice Thrown when minting would cause overflow
2020 error MintOverflow (uint256 currentSupply , uint256 amount );
2121
@@ -61,11 +61,7 @@ abstract contract ERC20 {
6161 CONSTRUCTOR
6262 //////////////////////////////////////////////////////////////*/
6363
64- constructor (
65- string memory _name ,
66- string memory _symbol ,
67- uint8 _decimals
68- ) {
64+ constructor (string memory _name , string memory _symbol , uint8 _decimals ) {
6965 name = _name;
7066 symbol = _symbol;
7167 decimals = _decimals;
@@ -89,7 +85,7 @@ abstract contract ERC20 {
8985 function transfer (address to , uint256 amount ) public virtual returns (bool ) {
9086 uint256 fromBalance = balanceOf[msg .sender ];
9187 if (fromBalance < amount) revert InsufficientBalance (msg .sender , fromBalance, amount);
92-
88+
9389 balanceOf[msg .sender ] = fromBalance - amount;
9490
9591 // Cannot overflow because the sum of all user
@@ -103,11 +99,7 @@ abstract contract ERC20 {
10399 return true ;
104100 }
105101
106- function transferFrom (
107- address from ,
108- address to ,
109- uint256 amount
110- ) public virtual returns (bool ) {
102+ function transferFrom (address from , address to , uint256 amount ) public virtual returns (bool ) {
111103 uint256 allowed = allowance[from][msg .sender ]; // Saves gas for limited approvals.
112104 uint256 fromBalance = balanceOf[from];
113105
@@ -130,7 +122,6 @@ abstract contract ERC20 {
130122 return true ;
131123 }
132124
133-
134125 /*//////////////////////////////////////////////////////////////
135126 EIP-2612 LOGIC
136127 //////////////////////////////////////////////////////////////*/
@@ -192,7 +183,6 @@ abstract contract ERC20 {
192183 );
193184 }
194185
195-
196186 /*//////////////////////////////////////////////////////////////
197187 INTERNAL MINT/BURN LOGIC
198188 //////////////////////////////////////////////////////////////*/
@@ -214,7 +204,7 @@ abstract contract ERC20 {
214204 function _burn (address from , uint256 amount ) internal virtual {
215205 uint256 fromBalance = balanceOf[from];
216206 if (fromBalance < amount) revert InsufficientBalance (from, fromBalance, amount);
217-
207+
218208 balanceOf[from] = fromBalance - amount;
219209
220210 // Cannot underflow because a user's balance
@@ -228,11 +218,7 @@ abstract contract ERC20 {
228218}
229219
230220contract MockERC20 is ERC20 {
231- constructor (
232- string memory _name ,
233- string memory _symbol ,
234- uint8 _decimals
235- ) ERC20 (_name, _symbol, _decimals) {}
221+ constructor (string memory _name , string memory _symbol , uint8 _decimals ) ERC20 (_name, _symbol, _decimals) {}
236222
237223 function mint (address to , uint256 value ) public virtual {
238224 _mint (to, value);
@@ -241,4 +227,4 @@ contract MockERC20 is ERC20 {
241227 function burn (address from , uint256 value ) public virtual {
242228 _burn (from, value);
243229 }
244- }
230+ }
0 commit comments