@@ -51,9 +51,7 @@ contract ERC20Mock is Context, IERC20 {
51
51
/**
52
52
* @dev See {IERC20-balanceOf}.
53
53
*/
54
- function balanceOf (
55
- address account
56
- ) public view virtual override returns (uint256 ) {
54
+ function balanceOf (address account ) public view virtual override returns (uint256 ) {
57
55
return _balances[account];
58
56
}
59
57
@@ -69,10 +67,7 @@ contract ERC20Mock is Context, IERC20 {
69
67
* - `to` cannot be the zero address.
70
68
* - the caller must have a balance of at least `amount`.
71
69
*/
72
- function transfer (
73
- address to ,
74
- uint256 amount
75
- ) public virtual override returns (bool ) {
70
+ function transfer (address to , uint256 amount ) public virtual override returns (bool ) {
76
71
address owner = _msgSender ();
77
72
_transfer (owner, to, amount);
78
73
return true ;
@@ -81,10 +76,7 @@ contract ERC20Mock is Context, IERC20 {
81
76
/**
82
77
* @dev See {IERC20-allowance}.
83
78
*/
84
- function allowance (
85
- address owner ,
86
- address spender
87
- ) public view virtual override returns (uint256 ) {
79
+ function allowance (address owner , address spender ) public view virtual override returns (uint256 ) {
88
80
return _allowances[owner][spender];
89
81
}
90
82
@@ -98,10 +90,7 @@ contract ERC20Mock is Context, IERC20 {
98
90
*
99
91
* - `spender` cannot be the zero address.
100
92
*/
101
- function approve (
102
- address /*spender*/ ,
103
- uint256 /*amount*/
104
- ) public virtual override returns (bool ) {
93
+ function approve (address , /*spender*/ uint256 /*amount*/ ) public virtual override returns (bool ) {
105
94
return true ;
106
95
}
107
96
@@ -121,11 +110,7 @@ contract ERC20Mock is Context, IERC20 {
121
110
* - the caller must have allowance for ``from``'s tokens of at least
122
111
* `amount`.
123
112
*/
124
- function transferFrom (
125
- address from ,
126
- address to ,
127
- uint256 amount
128
- ) public virtual override returns (bool ) {
113
+ function transferFrom (address from , address to , uint256 amount ) public virtual override returns (bool ) {
129
114
_transfer (from, to, amount);
130
115
return true ;
131
116
}
@@ -144,20 +129,13 @@ contract ERC20Mock is Context, IERC20 {
144
129
* - `to` cannot be the zero address.
145
130
* - `from` must have a balance of at least `amount`.
146
131
*/
147
- function _transfer (
148
- address from ,
149
- address to ,
150
- uint256 amount
151
- ) internal virtual {
132
+ function _transfer (address from , address to , uint256 amount ) internal virtual {
152
133
require (from != address (0 ), "ERC20: transfer from the zero address " );
153
134
require (to != address (0 ), "ERC20: transfer to the zero address " );
154
135
155
136
_beforeTokenTransfer (from, to, amount);
156
137
157
- require (
158
- _balances[from] >= amount,
159
- "ERC20: transfer amount exceeds balance "
160
- );
138
+ require (_balances[from] >= amount, "ERC20: transfer amount exceeds balance " );
161
139
unchecked {
162
140
_balances[from] = _balances[from] - amount;
163
141
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
@@ -170,7 +148,8 @@ contract ERC20Mock is Context, IERC20 {
170
148
_afterTokenTransfer (from, to, amount);
171
149
}
172
150
173
- /** @dev Creates `amount` tokens and assigns them to `account`, increasing
151
+ /**
152
+ * @dev Creates `amount` tokens and assigns them to `account`, increasing
174
153
* the total supply.
175
154
*
176
155
* Emits a {Transfer} event with `from` set to the zero address.
@@ -232,11 +211,7 @@ contract ERC20Mock is Context, IERC20 {
232
211
* - `owner` cannot be the zero address.
233
212
* - `spender` cannot be the zero address.
234
213
*/
235
- function _approve (
236
- address owner ,
237
- address spender ,
238
- uint256 amount
239
- ) internal virtual {
214
+ function _approve (address owner , address spender , uint256 amount ) internal virtual {
240
215
require (owner != address (0 ), "ERC20: approve from the zero address " );
241
216
require (spender != address (0 ), "ERC20: approve to the zero address " );
242
217
@@ -252,17 +227,10 @@ contract ERC20Mock is Context, IERC20 {
252
227
*
253
228
* Might emit an {Approval} event.
254
229
*/
255
- function _spendAllowance (
256
- address owner ,
257
- address spender ,
258
- uint256 amount
259
- ) internal virtual {
230
+ function _spendAllowance (address owner , address spender , uint256 amount ) internal virtual {
260
231
uint256 currentAllowance = allowance (owner, spender);
261
232
if (currentAllowance != type (uint256 ).max) {
262
- require (
263
- currentAllowance >= amount,
264
- "ERC20: insufficient allowance "
265
- );
233
+ require (currentAllowance >= amount, "ERC20: insufficient allowance " );
266
234
}
267
235
}
268
236
@@ -280,11 +248,7 @@ contract ERC20Mock is Context, IERC20 {
280
248
*
281
249
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
282
250
*/
283
- function _beforeTokenTransfer (
284
- address from ,
285
- address to ,
286
- uint256 amount
287
- ) internal virtual {}
251
+ function _beforeTokenTransfer (address from , address to , uint256 amount ) internal virtual {}
288
252
289
253
/**
290
254
* @dev Hook that is called after any transfer of tokens. This includes
@@ -300,9 +264,5 @@ contract ERC20Mock is Context, IERC20 {
300
264
*
301
265
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
302
266
*/
303
- function _afterTokenTransfer (
304
- address from ,
305
- address to ,
306
- uint256 amount
307
- ) internal virtual {}
267
+ function _afterTokenTransfer (address from , address to , uint256 amount ) internal virtual {}
308
268
}
0 commit comments