mirror of https://github.com/crytic/slither
parent
0d04e17f8c
commit
0e264b3b84
@ -0,0 +1,205 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
bytes32 public fopwCDKKK; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
fopwCDKKK, |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,247 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "variable", |
||||
"name": "fopwCDKKK", |
||||
"source_mapping": { |
||||
"start": 1735, |
||||
"length": 24, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
46 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 29 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6054, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.fopwCDKKK (tests/detectors/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol#46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.fopwCDKKK](tests/detectors/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol#L46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol#L46", |
||||
"id": "8d18da367a9cfe0bee2ee48ee8a76072af23567d852cc81ed75dd90531cbe3d5", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,207 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
DOMAIN_SEPARATOR(), |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function DOMAIN_SEPARATOR() public view returns (uint64) { |
||||
return uint64(1); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,252 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "DOMAIN_SEPARATOR", |
||||
"source_mapping": { |
||||
"start": 5248, |
||||
"length": 90, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
161, |
||||
162, |
||||
163 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6128, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203, |
||||
204, |
||||
205 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "DOMAIN_SEPARATOR()" |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.DOMAIN_SEPARATOR() (tests/detectors/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol#161-163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.DOMAIN_SEPARATOR()](tests/detectors/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol#L161-L163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol#L161-L163", |
||||
"id": "17ee24b60ef7d108871021639c374d6711feb1c8e3aad52ab266a680c03831cb", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,205 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
bytes32 public fopwCDKKK; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) public { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
fopwCDKKK, |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,247 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "variable", |
||||
"name": "fopwCDKKK", |
||||
"source_mapping": { |
||||
"start": 1735, |
||||
"length": 24, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
46 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 29 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6061, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.fopwCDKKK (tests/detectors/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol#46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.fopwCDKKK](tests/detectors/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol#L46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol#L46", |
||||
"id": "8d18da367a9cfe0bee2ee48ee8a76072af23567d852cc81ed75dd90531cbe3d5", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,207 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) public { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
DOMAIN_SEPARATOR(), |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function DOMAIN_SEPARATOR() public view returns (uint64) { |
||||
return uint64(1); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,252 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "DOMAIN_SEPARATOR", |
||||
"source_mapping": { |
||||
"start": 5255, |
||||
"length": 90, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
161, |
||||
162, |
||||
163 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6135, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203, |
||||
204, |
||||
205 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "DOMAIN_SEPARATOR()" |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.DOMAIN_SEPARATOR() (tests/detectors/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol#161-163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.DOMAIN_SEPARATOR()](tests/detectors/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol#L161-L163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol#L161-L163", |
||||
"id": "17ee24b60ef7d108871021639c374d6711feb1c8e3aad52ab266a680c03831cb", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,205 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
bytes32 public fopwCDKKK; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) public { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
fopwCDKKK, |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,247 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "variable", |
||||
"name": "fopwCDKKK", |
||||
"source_mapping": { |
||||
"start": 1735, |
||||
"length": 24, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
46 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 29 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6061, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.fopwCDKKK (tests/detectors/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol#46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.fopwCDKKK](tests/detectors/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol#L46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol#L46", |
||||
"id": "8d18da367a9cfe0bee2ee48ee8a76072af23567d852cc81ed75dd90531cbe3d5", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,207 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) public { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
DOMAIN_SEPARATOR(), |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function DOMAIN_SEPARATOR() public view returns (uint64) { |
||||
return uint64(1); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,252 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "DOMAIN_SEPARATOR", |
||||
"source_mapping": { |
||||
"start": 5255, |
||||
"length": 90, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
161, |
||||
162, |
||||
163 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6135, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203, |
||||
204, |
||||
205 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "DOMAIN_SEPARATOR()" |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.DOMAIN_SEPARATOR() (tests/detectors/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol#161-163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.DOMAIN_SEPARATOR()](tests/detectors/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol#L161-L163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol#L161-L163", |
||||
"id": "17ee24b60ef7d108871021639c374d6711feb1c8e3aad52ab266a680c03831cb", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,205 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
bytes32 public fopwCDKKK; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) public { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
fopwCDKKK, |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,247 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "variable", |
||||
"name": "fopwCDKKK", |
||||
"source_mapping": { |
||||
"start": 1735, |
||||
"length": 24, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
46 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 29 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6061, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.fopwCDKKK (tests/detectors/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol#46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.fopwCDKKK](tests/detectors/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol#L46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol#L46", |
||||
"id": "8d18da367a9cfe0bee2ee48ee8a76072af23567d852cc81ed75dd90531cbe3d5", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,207 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
DOMAIN_SEPARATOR(), |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function DOMAIN_SEPARATOR() public view returns (uint64) { |
||||
return uint64(1); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,252 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "DOMAIN_SEPARATOR", |
||||
"source_mapping": { |
||||
"start": 5248, |
||||
"length": 90, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
161, |
||||
162, |
||||
163 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6128, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203, |
||||
204, |
||||
205 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "DOMAIN_SEPARATOR()" |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.DOMAIN_SEPARATOR() (tests/detectors/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol#161-163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.DOMAIN_SEPARATOR()](tests/detectors/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol#L161-L163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol#L161-L163", |
||||
"id": "17ee24b60ef7d108871021639c374d6711feb1c8e3aad52ab266a680c03831cb", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,205 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
bytes32 public fopwCDKKK; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) public { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
fopwCDKKK, |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,247 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "variable", |
||||
"name": "fopwCDKKK", |
||||
"source_mapping": { |
||||
"start": 1735, |
||||
"length": 24, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
46 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 29 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6061, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_state_var_collision.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_state_var_collision.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.fopwCDKKK (tests/detectors/domain-separator-collision/0.8.0/permit_domain_state_var_collision.sol#46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.fopwCDKKK](tests/detectors/domain-separator-collision/0.8.0/permit_domain_state_var_collision.sol#L46) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_state_var_collision.sol#L46", |
||||
"id": "8d18da367a9cfe0bee2ee48ee8a76072af23567d852cc81ed75dd90531cbe3d5", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
@ -0,0 +1,207 @@ |
||||
// SPDX-License-Identifier: AGPL-3.0-only |
||||
|
||||
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. |
||||
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) |
||||
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) |
||||
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. |
||||
contract ERC20 { |
||||
/*////////////////////////////////////////////////////////////// |
||||
EVENTS |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount); |
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount); |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
METADATA STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
string public name; |
||||
|
||||
string public symbol; |
||||
|
||||
uint8 public decimals; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 public totalSupply; |
||||
|
||||
mapping(address => uint256) public balanceOf; |
||||
|
||||
mapping(address => mapping(address => uint256)) public allowance; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 STORAGE |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
uint256 internal INITIAL_CHAIN_ID; |
||||
|
||||
bytes32 internal INITIAL_DOMAIN_SEPARATOR; |
||||
|
||||
mapping(address => uint256) public nonces; |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
CONSTRUCTOR |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
constructor( |
||||
string memory _name, |
||||
string memory _symbol, |
||||
uint8 _decimals |
||||
) { |
||||
name = _name; |
||||
symbol = _symbol; |
||||
decimals = _decimals; |
||||
|
||||
INITIAL_CHAIN_ID = 1; |
||||
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
ERC20 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function approve(address spender, uint256 amount) public returns (bool) { |
||||
allowance[msg.sender][spender] = amount; |
||||
|
||||
emit Approval(msg.sender, spender, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transfer(address to, uint256 amount) public returns (bool) { |
||||
balanceOf[msg.sender] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(msg.sender, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
function transferFrom( |
||||
address from, |
||||
address to, |
||||
uint256 amount |
||||
) public returns (bool) { |
||||
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. |
||||
|
||||
if (allowed != 115792089237316195423570985008687907853269984665640564039457584007913129639935) allowance[from][msg.sender] = allowed - amount; |
||||
|
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(from, to, amount); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
EIP-2612 LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function permit( |
||||
address owner, |
||||
address spender, |
||||
uint256 value, |
||||
uint256 deadline, |
||||
uint8 v, |
||||
bytes32 r, |
||||
bytes32 s |
||||
) public { |
||||
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); |
||||
|
||||
// Unchecked because the only math done is incrementing |
||||
// the owner's nonce which cannot realistically overflow. |
||||
|
||||
address recoveredAddress = ecrecover( |
||||
keccak256( |
||||
abi.encodePacked( |
||||
"\x19\x01", |
||||
DOMAIN_SEPARATOR(), |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256( |
||||
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" |
||||
), |
||||
owner, |
||||
spender, |
||||
value, |
||||
nonces[owner]++, |
||||
deadline |
||||
) |
||||
) |
||||
) |
||||
), |
||||
v, |
||||
r, |
||||
s |
||||
); |
||||
|
||||
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); |
||||
|
||||
allowance[recoveredAddress][spender] = value; |
||||
|
||||
|
||||
emit Approval(owner, spender, value); |
||||
} |
||||
|
||||
function DOMAIN_SEPARATOR() public view returns (uint64) { |
||||
return uint64(1); |
||||
} |
||||
|
||||
function computeDomainSeparator() internal view returns (bytes32) { |
||||
return |
||||
keccak256( |
||||
abi.encode( |
||||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), |
||||
keccak256(bytes(name)), |
||||
keccak256("1"), |
||||
1, |
||||
address(this) |
||||
) |
||||
); |
||||
} |
||||
|
||||
/*////////////////////////////////////////////////////////////// |
||||
INTERNAL MINT/BURN LOGIC |
||||
//////////////////////////////////////////////////////////////*/ |
||||
|
||||
function _mint(address to, uint256 amount) internal { |
||||
totalSupply += amount; |
||||
|
||||
// Cannot overflow because the sum of all user |
||||
// balances can't exceed the max uint256 value. |
||||
|
||||
balanceOf[to] += amount; |
||||
|
||||
|
||||
emit Transfer(address(0), to, amount); |
||||
} |
||||
|
||||
function _burn(address from, uint256 amount) internal { |
||||
balanceOf[from] -= amount; |
||||
|
||||
// Cannot underflow because a user's balance |
||||
// will never be larger than the total supply. |
||||
|
||||
totalSupply -= amount; |
||||
|
||||
|
||||
emit Transfer(from, address(0), amount); |
||||
} |
||||
} |
||||
|
||||
contract Test is ERC20("TEST", "TEST", 18) {} |
@ -0,0 +1,252 @@ |
||||
[ |
||||
[ |
||||
{ |
||||
"elements": [ |
||||
{ |
||||
"type": "function", |
||||
"name": "DOMAIN_SEPARATOR", |
||||
"source_mapping": { |
||||
"start": 5248, |
||||
"length": 90, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
161, |
||||
162, |
||||
163 |
||||
], |
||||
"starting_column": 5, |
||||
"ending_column": 6 |
||||
}, |
||||
"type_specific_fields": { |
||||
"parent": { |
||||
"type": "contract", |
||||
"name": "ERC20", |
||||
"source_mapping": { |
||||
"start": 449, |
||||
"length": 6128, |
||||
"filename_relative": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_wrong_return_type.sol", |
||||
"filename_absolute": "/GENERIC_PATH", |
||||
"filename_short": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_wrong_return_type.sol", |
||||
"is_dependency": false, |
||||
"lines": [ |
||||
7, |
||||
8, |
||||
9, |
||||
10, |
||||
11, |
||||
12, |
||||
13, |
||||
14, |
||||
15, |
||||
16, |
||||
17, |
||||
18, |
||||
19, |
||||
20, |
||||
21, |
||||
22, |
||||
23, |
||||
24, |
||||
25, |
||||
26, |
||||
27, |
||||
28, |
||||
29, |
||||
30, |
||||
31, |
||||
32, |
||||
33, |
||||
34, |
||||
35, |
||||
36, |
||||
37, |
||||
38, |
||||
39, |
||||
40, |
||||
41, |
||||
42, |
||||
43, |
||||
44, |
||||
45, |
||||
46, |
||||
47, |
||||
48, |
||||
49, |
||||
50, |
||||
51, |
||||
52, |
||||
53, |
||||
54, |
||||
55, |
||||
56, |
||||
57, |
||||
58, |
||||
59, |
||||
60, |
||||
61, |
||||
62, |
||||
63, |
||||
64, |
||||
65, |
||||
66, |
||||
67, |
||||
68, |
||||
69, |
||||
70, |
||||
71, |
||||
72, |
||||
73, |
||||
74, |
||||
75, |
||||
76, |
||||
77, |
||||
78, |
||||
79, |
||||
80, |
||||
81, |
||||
82, |
||||
83, |
||||
84, |
||||
85, |
||||
86, |
||||
87, |
||||
88, |
||||
89, |
||||
90, |
||||
91, |
||||
92, |
||||
93, |
||||
94, |
||||
95, |
||||
96, |
||||
97, |
||||
98, |
||||
99, |
||||
100, |
||||
101, |
||||
102, |
||||
103, |
||||
104, |
||||
105, |
||||
106, |
||||
107, |
||||
108, |
||||
109, |
||||
110, |
||||
111, |
||||
112, |
||||
113, |
||||
114, |
||||
115, |
||||
116, |
||||
117, |
||||
118, |
||||
119, |
||||
120, |
||||
121, |
||||
122, |
||||
123, |
||||
124, |
||||
125, |
||||
126, |
||||
127, |
||||
128, |
||||
129, |
||||
130, |
||||
131, |
||||
132, |
||||
133, |
||||
134, |
||||
135, |
||||
136, |
||||
137, |
||||
138, |
||||
139, |
||||
140, |
||||
141, |
||||
142, |
||||
143, |
||||
144, |
||||
145, |
||||
146, |
||||
147, |
||||
148, |
||||
149, |
||||
150, |
||||
151, |
||||
152, |
||||
153, |
||||
154, |
||||
155, |
||||
156, |
||||
157, |
||||
158, |
||||
159, |
||||
160, |
||||
161, |
||||
162, |
||||
163, |
||||
164, |
||||
165, |
||||
166, |
||||
167, |
||||
168, |
||||
169, |
||||
170, |
||||
171, |
||||
172, |
||||
173, |
||||
174, |
||||
175, |
||||
176, |
||||
177, |
||||
178, |
||||
179, |
||||
180, |
||||
181, |
||||
182, |
||||
183, |
||||
184, |
||||
185, |
||||
186, |
||||
187, |
||||
188, |
||||
189, |
||||
190, |
||||
191, |
||||
192, |
||||
193, |
||||
194, |
||||
195, |
||||
196, |
||||
197, |
||||
198, |
||||
199, |
||||
200, |
||||
201, |
||||
202, |
||||
203, |
||||
204, |
||||
205 |
||||
], |
||||
"starting_column": 1, |
||||
"ending_column": 2 |
||||
} |
||||
}, |
||||
"signature": "DOMAIN_SEPARATOR()" |
||||
} |
||||
} |
||||
], |
||||
"description": "The function signature of ERC20.DOMAIN_SEPARATOR() (tests/detectors/domain-separator-collision/0.8.0/permit_domain_wrong_return_type.sol#161-163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"markdown": "The function signature of [ERC20.DOMAIN_SEPARATOR()](tests/detectors/domain-separator-collision/0.8.0/permit_domain_wrong_return_type.sol#L161-L163) collides with DOMAIN_SEPARATOR and should be renamed or removed.\n", |
||||
"first_markdown_element": "tests/detectors/domain-separator-collision/0.8.0/permit_domain_wrong_return_type.sol#L161-L163", |
||||
"id": "17ee24b60ef7d108871021639c374d6711feb1c8e3aad52ab266a680c03831cb", |
||||
"check": "domain-separator-collision", |
||||
"impact": "Medium", |
||||
"confidence": "High" |
||||
} |
||||
] |
||||
] |
Loading…
Reference in new issue