-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharbitrary-send-erc20-permit.sol
More file actions
71 lines (47 loc) · 1.65 KB
/
arbitrary-send-erc20-permit.sol
File metadata and controls
71 lines (47 loc) · 1.65 KB
1
2
3
4
5
6
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
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.24;
import "./IERC20.sol";
contract Test {
IERC20 public immutable erc20;
constructor(IERC20 _erc20) {
erc20 = _erc20;
}
function bad(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public {
//rule-id: arbitrary-send-erc20-permit
erc20.permit(from, address(this), value, deadline, v, r, s);
erc20.transferFrom(from, to, value);
}
}
contract Test2 {
IERC20 public immutable erc20;
constructor(IERC20 _erc20) {
erc20 = _erc20;
}
function bad2(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public {
//rule-id: arbitrary-send-erc20-permit
erc20.permit(from, address(this), value, deadline, v, r, s);
erc20.transferFrom(from, to, value);
}
}
contract Test3 {
IERC20 public immutable erc20;
constructor(IERC20 _erc20) {
erc20 = _erc20;
}
function good(uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public {
//rule-id: ok
erc20.permit(msg.sender, address(this), value, deadline, v, r, s);
erc20.transferFrom(msg.sender, to, value);
}
}
contract Test4 {
IERC20 public immutable erc20;
constructor(IERC20 _erc20) {
erc20 = _erc20;
}
function bad3(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public {
//rule-id: arbitrary-send-erc20-permit
erc20.permit(msg.sender, address(this), value, deadline, v, r, s);
erc20.transferFrom(from, to, value);
}
}