prettier-plugin-solidity 1.0.0-beta.15 → 1.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/CI.yml +6 -6
- package/README.md +64 -3
- package/package.json +16 -12
- package/src/nodes/FunctionCall.js +26 -23
- package/src/nodes/IndexAccess.js +29 -7
- package/src/nodes/MemberAccess.js +63 -26
- package/src/nodes/ModifierDefinition.js +14 -16
- package/src/nodes/ModifierInvocation.js +2 -0
- package/src/nodes/StringLiteral.js +2 -2
- package/src/nodes/TypeDefinition.js +5 -0
- package/src/nodes/VariableDeclarationStatement.js +21 -8
- package/src/nodes/index.js +1 -0
- package/src/nodes/print-separated-list.js +1 -6
- package/src/parser.js +15 -9
- package/tests/config/format-test.js +1 -0
- package/tests/format/AllSolidityFeatures/__snapshots__/jsfmt.spec.js.snap +1 -1
- package/tests/format/ExplicitVariableTypes/ExplicitVariableTypes.sol +1 -1
- package/tests/format/ExplicitVariableTypes/__snapshots__/jsfmt.spec.js.snap +6 -6
- package/tests/format/FunctionCalls/__snapshots__/jsfmt.spec.js.snap +98 -86
- package/tests/format/FunctionDefinitions/FunctionDefinitions.sol +2 -2
- package/tests/format/FunctionDefinitions/__snapshots__/jsfmt.spec.js.snap +2 -2
- package/tests/format/HexLiteral/HexLiteral.sol +1 -1
- package/tests/format/HexLiteral/__snapshots__/jsfmt.spec.js.snap +4 -4
- package/tests/format/Issues/Issue564.sol +9 -0
- package/tests/format/Issues/__snapshots__/jsfmt.spec.js.snap +37 -5
- package/tests/format/MemberAccess/MemberAccess.sol +46 -0
- package/tests/format/MemberAccess/__snapshots__/jsfmt.spec.js.snap +99 -0
- package/tests/format/ModifierInvocations/ModifierInvocations.sol +17 -0
- package/tests/format/ModifierInvocations/__snapshots__/jsfmt.spec.js.snap +51 -0
- package/tests/format/ModifierInvocations/jsfmt.spec.js +1 -0
- package/tests/format/MultipartStrings/__snapshots__/jsfmt.spec.js.snap +3 -1
- package/tests/format/Parentheses/AddNoParentheses.sol +1 -1
- package/tests/format/Parentheses/BitAndNoParentheses.sol +1 -1
- package/tests/format/Parentheses/BitOrNoParentheses.sol +1 -1
- package/tests/format/Parentheses/BitXorNoParentheses.sol +1 -1
- package/tests/format/Parentheses/DivNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ExpNoParentheses.sol +1 -1
- package/tests/format/Parentheses/LogicNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ModNoParentheses.sol +1 -1
- package/tests/format/Parentheses/MulNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ShiftLNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ShiftRNoParentheses.sol +1 -1
- package/tests/format/Parentheses/SubNoParentheses.sol +1 -1
- package/tests/format/Parentheses/__snapshots__/jsfmt.spec.js.snap +24 -24
- package/tests/format/Pragma/Pragma.sol +1 -0
- package/tests/format/Pragma/__snapshots__/jsfmt.spec.js.snap +2 -0
- package/tests/format/SplittableCommodity/__snapshots__/jsfmt.spec.js.snap +1 -1
- package/tests/format/StringLiteral/StringLiteral.sol +11 -0
- package/tests/format/StringLiteral/__snapshots__/jsfmt.spec.js.snap +36 -0
- package/tests/format/StringLiteral/jsfmt.spec.js +1 -0
- package/tests/format/TypeDefinition/TypeDefinition.sol +12 -0
- package/tests/format/TypeDefinition/__snapshots__/jsfmt.spec.js.snap +74 -0
- package/tests/format/TypeDefinition/jsfmt.spec.js +1 -0
- package/tests/format/quotes/__snapshots__/jsfmt.spec.js.snap +18 -6
|
@@ -9,7 +9,7 @@ printWidth: 80
|
|
|
9
9
|
| printWidth
|
|
10
10
|
=====================================input======================================
|
|
11
11
|
// SPDX-License-Identifier: MIT
|
|
12
|
-
pragma solidity 0.8.
|
|
12
|
+
pragma solidity 0.8.10;
|
|
13
13
|
|
|
14
14
|
contract VariableTypesMixed {
|
|
15
15
|
uint256 public a;
|
|
@@ -47,7 +47,7 @@ contract VariableTypesMixed {
|
|
|
47
47
|
|
|
48
48
|
=====================================output=====================================
|
|
49
49
|
// SPDX-License-Identifier: MIT
|
|
50
|
-
pragma solidity 0.8.
|
|
50
|
+
pragma solidity 0.8.10;
|
|
51
51
|
|
|
52
52
|
contract VariableTypesMixed {
|
|
53
53
|
uint public a;
|
|
@@ -95,7 +95,7 @@ printWidth: 80
|
|
|
95
95
|
| printWidth
|
|
96
96
|
=====================================input======================================
|
|
97
97
|
// SPDX-License-Identifier: MIT
|
|
98
|
-
pragma solidity 0.8.
|
|
98
|
+
pragma solidity 0.8.10;
|
|
99
99
|
|
|
100
100
|
contract VariableTypesMixed {
|
|
101
101
|
uint256 public a;
|
|
@@ -133,7 +133,7 @@ contract VariableTypesMixed {
|
|
|
133
133
|
|
|
134
134
|
=====================================output=====================================
|
|
135
135
|
// SPDX-License-Identifier: MIT
|
|
136
|
-
pragma solidity 0.8.
|
|
136
|
+
pragma solidity 0.8.10;
|
|
137
137
|
|
|
138
138
|
contract VariableTypesMixed {
|
|
139
139
|
uint256 public a;
|
|
@@ -180,7 +180,7 @@ printWidth: 80
|
|
|
180
180
|
| printWidth
|
|
181
181
|
=====================================input======================================
|
|
182
182
|
// SPDX-License-Identifier: MIT
|
|
183
|
-
pragma solidity 0.8.
|
|
183
|
+
pragma solidity 0.8.10;
|
|
184
184
|
|
|
185
185
|
contract VariableTypesMixed {
|
|
186
186
|
uint256 public a;
|
|
@@ -218,7 +218,7 @@ contract VariableTypesMixed {
|
|
|
218
218
|
|
|
219
219
|
=====================================output=====================================
|
|
220
220
|
// SPDX-License-Identifier: MIT
|
|
221
|
-
pragma solidity 0.8.
|
|
221
|
+
pragma solidity 0.8.10;
|
|
222
222
|
|
|
223
223
|
contract VariableTypesMixed {
|
|
224
224
|
uint256 public a;
|
|
@@ -52,7 +52,7 @@ contract FunctionCalls {
|
|
|
52
52
|
contract FunctionCalls {
|
|
53
53
|
function foo() {
|
|
54
54
|
address veryLongValidatorAddress = veryVeryVeryLongSignature
|
|
55
|
-
|
|
55
|
+
.popLast20Bytes();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function foo() {
|
|
@@ -80,31 +80,34 @@ contract FunctionCalls {
|
|
|
80
80
|
keccak256(req.data)
|
|
81
81
|
)
|
|
82
82
|
)
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
)
|
|
84
|
+
._hashTypedDataV2(
|
|
85
|
+
keccak256(
|
|
86
|
+
abi.encode(
|
|
87
|
+
TYPEHASH,
|
|
88
|
+
req.from,
|
|
89
|
+
req.to,
|
|
90
|
+
req.value,
|
|
91
|
+
req.gas,
|
|
92
|
+
req.nonce,
|
|
93
|
+
keccak256(req.data)
|
|
94
|
+
)
|
|
93
95
|
)
|
|
94
96
|
)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
._hashTypedDataV3(
|
|
98
|
+
keccak256(
|
|
99
|
+
abi.encode(
|
|
100
|
+
TYPEHASH,
|
|
101
|
+
req.from,
|
|
102
|
+
req.to,
|
|
103
|
+
req.value,
|
|
104
|
+
req.gas,
|
|
105
|
+
req.nonce,
|
|
106
|
+
keccak256(req.data)
|
|
107
|
+
)
|
|
105
108
|
)
|
|
106
109
|
)
|
|
107
|
-
|
|
110
|
+
.recover(signature);
|
|
108
111
|
signer = _hashTypedDataV1(
|
|
109
112
|
keccak256(
|
|
110
113
|
abi.encode(
|
|
@@ -117,31 +120,34 @@ contract FunctionCalls {
|
|
|
117
120
|
keccak256(req.data)
|
|
118
121
|
)
|
|
119
122
|
)
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
)
|
|
124
|
+
._hashTypedDataV2(
|
|
125
|
+
keccak256(
|
|
126
|
+
abi.encode(
|
|
127
|
+
TYPEHASH,
|
|
128
|
+
req.from,
|
|
129
|
+
req.to,
|
|
130
|
+
req.value,
|
|
131
|
+
req.gas,
|
|
132
|
+
req.nonce,
|
|
133
|
+
keccak256(req.data)
|
|
134
|
+
)
|
|
130
135
|
)
|
|
131
136
|
)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
._hashTypedDataV3(
|
|
138
|
+
keccak256(
|
|
139
|
+
abi.encode(
|
|
140
|
+
TYPEHASH,
|
|
141
|
+
req.from,
|
|
142
|
+
req.to,
|
|
143
|
+
req.value,
|
|
144
|
+
req.gas,
|
|
145
|
+
req.nonce,
|
|
146
|
+
keccak256(req.data)
|
|
147
|
+
)
|
|
142
148
|
)
|
|
143
149
|
)
|
|
144
|
-
|
|
150
|
+
.recover(signature);
|
|
145
151
|
return _nonces[req.from] == req.nonce && signer == req.from;
|
|
146
152
|
}
|
|
147
153
|
}
|
|
@@ -200,7 +206,7 @@ contract FunctionCalls {
|
|
|
200
206
|
contract FunctionCalls {
|
|
201
207
|
function foo() {
|
|
202
208
|
address veryLongValidatorAddress = veryVeryVeryLongSignature
|
|
203
|
-
|
|
209
|
+
.popLast20Bytes();
|
|
204
210
|
}
|
|
205
211
|
|
|
206
212
|
function foo() {
|
|
@@ -228,31 +234,34 @@ contract FunctionCalls {
|
|
|
228
234
|
keccak256(req.data)
|
|
229
235
|
)
|
|
230
236
|
)
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
)
|
|
238
|
+
._hashTypedDataV2(
|
|
239
|
+
keccak256(
|
|
240
|
+
abi.encode(
|
|
241
|
+
TYPEHASH,
|
|
242
|
+
req.from,
|
|
243
|
+
req.to,
|
|
244
|
+
req.value,
|
|
245
|
+
req.gas,
|
|
246
|
+
req.nonce,
|
|
247
|
+
keccak256(req.data)
|
|
248
|
+
)
|
|
241
249
|
)
|
|
242
250
|
)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
._hashTypedDataV3(
|
|
252
|
+
keccak256(
|
|
253
|
+
abi.encode(
|
|
254
|
+
TYPEHASH,
|
|
255
|
+
req.from,
|
|
256
|
+
req.to,
|
|
257
|
+
req.value,
|
|
258
|
+
req.gas,
|
|
259
|
+
req.nonce,
|
|
260
|
+
keccak256(req.data)
|
|
261
|
+
)
|
|
253
262
|
)
|
|
254
263
|
)
|
|
255
|
-
|
|
264
|
+
.recover(signature);
|
|
256
265
|
signer = _hashTypedDataV1(
|
|
257
266
|
keccak256(
|
|
258
267
|
abi.encode(
|
|
@@ -265,31 +274,34 @@ contract FunctionCalls {
|
|
|
265
274
|
keccak256(req.data)
|
|
266
275
|
)
|
|
267
276
|
)
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
)
|
|
278
|
+
._hashTypedDataV2(
|
|
279
|
+
keccak256(
|
|
280
|
+
abi.encode(
|
|
281
|
+
TYPEHASH,
|
|
282
|
+
req.from,
|
|
283
|
+
req.to,
|
|
284
|
+
req.value,
|
|
285
|
+
req.gas,
|
|
286
|
+
req.nonce,
|
|
287
|
+
keccak256(req.data)
|
|
288
|
+
)
|
|
278
289
|
)
|
|
279
290
|
)
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
291
|
+
._hashTypedDataV3(
|
|
292
|
+
keccak256(
|
|
293
|
+
abi.encode(
|
|
294
|
+
TYPEHASH,
|
|
295
|
+
req.from,
|
|
296
|
+
req.to,
|
|
297
|
+
req.value,
|
|
298
|
+
req.gas,
|
|
299
|
+
req.nonce,
|
|
300
|
+
keccak256(req.data)
|
|
301
|
+
)
|
|
290
302
|
)
|
|
291
303
|
)
|
|
292
|
-
|
|
304
|
+
.recover(signature);
|
|
293
305
|
return _nonces[req.from] == req.nonce && signer == req.from;
|
|
294
306
|
}
|
|
295
307
|
}
|
|
@@ -9,11 +9,11 @@ interface FunctionInterfaces {
|
|
|
9
9
|
|
|
10
10
|
function manyParams(uint x1, uint x2, uint x3, uint x4, uint x5, uint x6, uint x7, uint x8, uint x9, uint x10);
|
|
11
11
|
|
|
12
|
-
function manyModifiers() modifier1 modifier2 modifier3 modifier4 modifier5 modifier6 modifier7 modifier8 modifier9 modifier10;
|
|
12
|
+
function manyModifiers() modifier1() modifier2() modifier3 modifier4 modifier5 modifier6 modifier7 modifier8 modifier9 modifier10;
|
|
13
13
|
|
|
14
14
|
function manyReturns() returns(uint y1, uint y2, uint y3, uint y4, uint y5, uint y6, uint y7, uint y8, uint y9, uint y10);
|
|
15
15
|
|
|
16
|
-
function someParamsSomeModifiers(uint x1, uint x2, uint x3) modifier1 modifier2 modifier3;
|
|
16
|
+
function someParamsSomeModifiers(uint x1, uint x2, uint x3) modifier1() modifier2 modifier3;
|
|
17
17
|
|
|
18
18
|
function someParamsSomeReturns(uint x1, uint x2, uint x3) returns(uint y1, uint y2, uint y3);
|
|
19
19
|
|
|
@@ -17,11 +17,11 @@ interface FunctionInterfaces {
|
|
|
17
17
|
|
|
18
18
|
function manyParams(uint x1, uint x2, uint x3, uint x4, uint x5, uint x6, uint x7, uint x8, uint x9, uint x10);
|
|
19
19
|
|
|
20
|
-
function manyModifiers() modifier1 modifier2 modifier3 modifier4 modifier5 modifier6 modifier7 modifier8 modifier9 modifier10;
|
|
20
|
+
function manyModifiers() modifier1() modifier2() modifier3 modifier4 modifier5 modifier6 modifier7 modifier8 modifier9 modifier10;
|
|
21
21
|
|
|
22
22
|
function manyReturns() returns(uint y1, uint y2, uint y3, uint y4, uint y5, uint y6, uint y7, uint y8, uint y9, uint y10);
|
|
23
23
|
|
|
24
|
-
function someParamsSomeModifiers(uint x1, uint x2, uint x3) modifier1 modifier2 modifier3;
|
|
24
|
+
function someParamsSomeModifiers(uint x1, uint x2, uint x3) modifier1() modifier2 modifier3;
|
|
25
25
|
|
|
26
26
|
function someParamsSomeReturns(uint x1, uint x2, uint x3) returns(uint y1, uint y2, uint y3);
|
|
27
27
|
|
|
@@ -9,7 +9,7 @@ singleQuote: false
|
|
|
9
9
|
| printWidth
|
|
10
10
|
=====================================input======================================
|
|
11
11
|
// SPDX-License-Identifier: MIT
|
|
12
|
-
pragma solidity 0.8.
|
|
12
|
+
pragma solidity 0.8.10;
|
|
13
13
|
|
|
14
14
|
contract HexLiteral {
|
|
15
15
|
bytes8 hex1 = hex'DeadBeef';
|
|
@@ -18,7 +18,7 @@ contract HexLiteral {
|
|
|
18
18
|
|
|
19
19
|
=====================================output=====================================
|
|
20
20
|
// SPDX-License-Identifier: MIT
|
|
21
|
-
pragma solidity 0.8.
|
|
21
|
+
pragma solidity 0.8.10;
|
|
22
22
|
|
|
23
23
|
contract HexLiteral {
|
|
24
24
|
bytes8 hex1 = hex"DeadBeef";
|
|
@@ -37,7 +37,7 @@ singleQuote: true
|
|
|
37
37
|
| printWidth
|
|
38
38
|
=====================================input======================================
|
|
39
39
|
// SPDX-License-Identifier: MIT
|
|
40
|
-
pragma solidity 0.8.
|
|
40
|
+
pragma solidity 0.8.10;
|
|
41
41
|
|
|
42
42
|
contract HexLiteral {
|
|
43
43
|
bytes8 hex1 = hex'DeadBeef';
|
|
@@ -46,7 +46,7 @@ contract HexLiteral {
|
|
|
46
46
|
|
|
47
47
|
=====================================output=====================================
|
|
48
48
|
// SPDX-License-Identifier: MIT
|
|
49
|
-
pragma solidity 0.8.
|
|
49
|
+
pragma solidity 0.8.10;
|
|
50
50
|
|
|
51
51
|
contract HexLiteral {
|
|
52
52
|
bytes8 hex1 = hex'DeadBeef';
|
|
@@ -32,9 +32,7 @@ contract Example {
|
|
|
32
32
|
function example(address token, uint256 amount) public {
|
|
33
33
|
balanceStates[msg.sender][token].balance = balanceStates[msg.sender][
|
|
34
34
|
token
|
|
35
|
-
]
|
|
36
|
-
.balance
|
|
37
|
-
.sub(amount);
|
|
35
|
+
].balance.sub(amount);
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -59,8 +57,7 @@ contract Issue289 {
|
|
|
59
57
|
function f() {
|
|
60
58
|
address[] storage proposalValidators = ethProposals[_blockNumber][
|
|
61
59
|
_proposalId
|
|
62
|
-
]
|
|
63
|
-
.proposalValidators;
|
|
60
|
+
].proposalValidators;
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
|
|
@@ -140,3 +137,38 @@ contract Issue385 {
|
|
|
140
137
|
|
|
141
138
|
================================================================================
|
|
142
139
|
`;
|
|
140
|
+
|
|
141
|
+
exports[`Issue564.sol format 1`] = `
|
|
142
|
+
====================================options=====================================
|
|
143
|
+
parsers: ["solidity-parse"]
|
|
144
|
+
printWidth: 80
|
|
145
|
+
| printWidth
|
|
146
|
+
=====================================input======================================
|
|
147
|
+
contract Issue564 {
|
|
148
|
+
function isAuthorized(
|
|
149
|
+
bytes32 serviceId,
|
|
150
|
+
address client
|
|
151
|
+
) external view override returns (bool) {
|
|
152
|
+
WhitelistStatus storage whitelistStatus = serviceIdToClientToWhitelistStatus[serviceId][client];
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
=====================================output=====================================
|
|
158
|
+
contract Issue564 {
|
|
159
|
+
function isAuthorized(bytes32 serviceId, address client)
|
|
160
|
+
external
|
|
161
|
+
view
|
|
162
|
+
override
|
|
163
|
+
returns (bool)
|
|
164
|
+
{
|
|
165
|
+
WhitelistStatus
|
|
166
|
+
storage whitelistStatus = serviceIdToClientToWhitelistStatus[
|
|
167
|
+
serviceId
|
|
168
|
+
][client];
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
================================================================================
|
|
174
|
+
`;
|
|
@@ -2,6 +2,8 @@ pragma solidity ^0.5.0;
|
|
|
2
2
|
|
|
3
3
|
contract MemberAccess {
|
|
4
4
|
function() {
|
|
5
|
+
int256 amount = SafeCast.toInt256(10**(18 - underlyingAssetDecimals)).neg();
|
|
6
|
+
longNameAmount = SafeCast.toInt256(10**(18 - underlyingAssetDecimals)).neg();
|
|
5
7
|
a.b.c.d;
|
|
6
8
|
a.b().c.d;
|
|
7
9
|
a.b.c.d();
|
|
@@ -11,6 +13,50 @@ contract MemberAccess {
|
|
|
11
13
|
veryLongVariable.veryLongMember.veryLongCall(veryLongAttribute).veryLongMember.veryLongMember;
|
|
12
14
|
veryLongVariable.veryLongMember.veryLongMember.veryLongMember.veryLongCall(veryLongAttribute);
|
|
13
15
|
veryLongVariable.veryLongCall(veryLongAttribute).veryLongCall(veryLongAttribute).veryLongCall(veryLongAttribute);
|
|
16
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
17
|
+
.swapExactTokensForTokens(
|
|
18
|
+
sourceAmount,
|
|
19
|
+
minDestination,
|
|
20
|
+
path,
|
|
21
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
22
|
+
)[IUniswapV2Router(routerAddress)
|
|
23
|
+
.swapExactTokensForTokens(
|
|
24
|
+
sourceAmount,
|
|
25
|
+
minDestination,
|
|
26
|
+
path,
|
|
27
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
28
|
+
)];
|
|
29
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
30
|
+
.swapExactTokensForTokens(
|
|
31
|
+
sourceAmount,
|
|
32
|
+
minDestination,
|
|
33
|
+
path,
|
|
34
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
35
|
+
)[IUniswapV2Router(routerAddress)
|
|
36
|
+
.swapExactTokensForTokens(
|
|
37
|
+
sourceAmount,
|
|
38
|
+
minDestination,
|
|
39
|
+
path,
|
|
40
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
41
|
+
)][IUniswapV2Router(routerAddress)
|
|
42
|
+
.swapExactTokensForTokens(
|
|
43
|
+
sourceAmount,
|
|
44
|
+
minDestination,
|
|
45
|
+
path,
|
|
46
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
47
|
+
)];
|
|
48
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
49
|
+
.swapExactTokensForTokens(
|
|
50
|
+
sourceAmount,
|
|
51
|
+
minDestination,
|
|
52
|
+
path,
|
|
53
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
54
|
+
)(
|
|
55
|
+
sourceAmount,
|
|
56
|
+
minDestination,
|
|
57
|
+
path,
|
|
58
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
59
|
+
);
|
|
14
60
|
}
|
|
15
61
|
}
|
|
16
62
|
|
|
@@ -10,6 +10,8 @@ pragma solidity ^0.5.0;
|
|
|
10
10
|
|
|
11
11
|
contract MemberAccess {
|
|
12
12
|
function() {
|
|
13
|
+
int256 amount = SafeCast.toInt256(10**(18 - underlyingAssetDecimals)).neg();
|
|
14
|
+
longNameAmount = SafeCast.toInt256(10**(18 - underlyingAssetDecimals)).neg();
|
|
13
15
|
a.b.c.d;
|
|
14
16
|
a.b().c.d;
|
|
15
17
|
a.b.c.d();
|
|
@@ -19,6 +21,50 @@ contract MemberAccess {
|
|
|
19
21
|
veryLongVariable.veryLongMember.veryLongCall(veryLongAttribute).veryLongMember.veryLongMember;
|
|
20
22
|
veryLongVariable.veryLongMember.veryLongMember.veryLongMember.veryLongCall(veryLongAttribute);
|
|
21
23
|
veryLongVariable.veryLongCall(veryLongAttribute).veryLongCall(veryLongAttribute).veryLongCall(veryLongAttribute);
|
|
24
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
25
|
+
.swapExactTokensForTokens(
|
|
26
|
+
sourceAmount,
|
|
27
|
+
minDestination,
|
|
28
|
+
path,
|
|
29
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
30
|
+
)[IUniswapV2Router(routerAddress)
|
|
31
|
+
.swapExactTokensForTokens(
|
|
32
|
+
sourceAmount,
|
|
33
|
+
minDestination,
|
|
34
|
+
path,
|
|
35
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
36
|
+
)];
|
|
37
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
38
|
+
.swapExactTokensForTokens(
|
|
39
|
+
sourceAmount,
|
|
40
|
+
minDestination,
|
|
41
|
+
path,
|
|
42
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
43
|
+
)[IUniswapV2Router(routerAddress)
|
|
44
|
+
.swapExactTokensForTokens(
|
|
45
|
+
sourceAmount,
|
|
46
|
+
minDestination,
|
|
47
|
+
path,
|
|
48
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
49
|
+
)][IUniswapV2Router(routerAddress)
|
|
50
|
+
.swapExactTokensForTokens(
|
|
51
|
+
sourceAmount,
|
|
52
|
+
minDestination,
|
|
53
|
+
path,
|
|
54
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
55
|
+
)];
|
|
56
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
57
|
+
.swapExactTokensForTokens(
|
|
58
|
+
sourceAmount,
|
|
59
|
+
minDestination,
|
|
60
|
+
path,
|
|
61
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
62
|
+
)(
|
|
63
|
+
sourceAmount,
|
|
64
|
+
minDestination,
|
|
65
|
+
path,
|
|
66
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
67
|
+
);
|
|
22
68
|
}
|
|
23
69
|
}
|
|
24
70
|
|
|
@@ -67,6 +113,12 @@ pragma solidity ^0.5.0;
|
|
|
67
113
|
|
|
68
114
|
contract MemberAccess {
|
|
69
115
|
function() {
|
|
116
|
+
int256 amount = SafeCast
|
|
117
|
+
.toInt256(10**(18 - underlyingAssetDecimals))
|
|
118
|
+
.neg();
|
|
119
|
+
longNameAmount = SafeCast
|
|
120
|
+
.toInt256(10**(18 - underlyingAssetDecimals))
|
|
121
|
+
.neg();
|
|
70
122
|
a.b.c.d;
|
|
71
123
|
a.b().c.d;
|
|
72
124
|
a.b.c.d();
|
|
@@ -96,6 +148,53 @@ contract MemberAccess {
|
|
|
96
148
|
.veryLongCall(veryLongAttribute)
|
|
97
149
|
.veryLongCall(veryLongAttribute)
|
|
98
150
|
.veryLongCall(veryLongAttribute);
|
|
151
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
152
|
+
.swapExactTokensForTokens(
|
|
153
|
+
sourceAmount,
|
|
154
|
+
minDestination,
|
|
155
|
+
path,
|
|
156
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
157
|
+
)[
|
|
158
|
+
IUniswapV2Router(routerAddress).swapExactTokensForTokens(
|
|
159
|
+
sourceAmount,
|
|
160
|
+
minDestination,
|
|
161
|
+
path,
|
|
162
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
163
|
+
)
|
|
164
|
+
];
|
|
165
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
166
|
+
.swapExactTokensForTokens(
|
|
167
|
+
sourceAmount,
|
|
168
|
+
minDestination,
|
|
169
|
+
path,
|
|
170
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
171
|
+
)[
|
|
172
|
+
IUniswapV2Router(routerAddress).swapExactTokensForTokens(
|
|
173
|
+
sourceAmount,
|
|
174
|
+
minDestination,
|
|
175
|
+
path,
|
|
176
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
177
|
+
)
|
|
178
|
+
][
|
|
179
|
+
IUniswapV2Router(routerAddress).swapExactTokensForTokens(
|
|
180
|
+
sourceAmount,
|
|
181
|
+
minDestination,
|
|
182
|
+
path,
|
|
183
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
184
|
+
)
|
|
185
|
+
];
|
|
186
|
+
uint256[] memory amounts = IUniswapV2Router(routerAddress)
|
|
187
|
+
.swapExactTokensForTokens(
|
|
188
|
+
sourceAmount,
|
|
189
|
+
minDestination,
|
|
190
|
+
path,
|
|
191
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
192
|
+
)(
|
|
193
|
+
sourceAmount,
|
|
194
|
+
minDestination,
|
|
195
|
+
path,
|
|
196
|
+
address(this, aoeu, aoeueu, aoeu)
|
|
197
|
+
);
|
|
99
198
|
}
|
|
100
199
|
}
|
|
101
200
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity 0.8.10;
|
|
3
|
+
|
|
4
|
+
contract ModifierDefinitions {
|
|
5
|
+
// We enforce the use of parentheses in modifiers without parameters.
|
|
6
|
+
modifier emptyParams {_;}
|
|
7
|
+
modifier noParams() {_;}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
contract ModifierInvocations is ModifierDefinitions {
|
|
11
|
+
// We can't differentiate between constructor calls or modifiers, so we keep
|
|
12
|
+
// parentheses untouched in constructors.
|
|
13
|
+
constructor () emptyParams noParams() ModifierDefinitions() {}
|
|
14
|
+
|
|
15
|
+
// We remove parentheses in modifiers without arguments.
|
|
16
|
+
function test() public emptyParams noParams() {}
|
|
17
|
+
}
|