t-isol 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,8 +10,8 @@ interface ITransferAuthorize {
|
|
|
10
10
|
/// @param nonce unique nonce used by the authorization
|
|
11
11
|
event AuthorizeUsed(address indexed authorizer, bytes32 indexed nonce);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
event TransferWithAuthorize(address indexed from, address indexed to, uint256 value, uint256
|
|
13
|
+
/// @notice Emitted when a transfer with authorization is executed
|
|
14
|
+
event TransferWithAuthorize(address indexed from, address indexed to, uint256 value, uint256 createTime, uint256 expireTime, bytes32 indexed nonce, bytes auth);
|
|
15
15
|
|
|
16
16
|
/// @notice Emitted when a transferFrom with authorization is executed
|
|
17
17
|
event TransferFromWithAuthorize(address indexed from, address indexed to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 indexed nonce);
|
|
@@ -36,8 +36,8 @@ interface ITransferAuthorize {
|
|
|
36
36
|
address from,
|
|
37
37
|
address to,
|
|
38
38
|
uint256 value,
|
|
39
|
-
uint256
|
|
40
|
-
uint256
|
|
39
|
+
uint256 createTime,
|
|
40
|
+
uint256 expireTime,
|
|
41
41
|
bytes32 nonce,
|
|
42
42
|
bytes calldata auth
|
|
43
43
|
) external;
|
|
@@ -15,7 +15,7 @@ abstract contract TransferAuthorize is ITransferAuthorize, EIP712 {
|
|
|
15
15
|
mapping(address => mapping(bytes32 => bool)) private _authorizeState;
|
|
16
16
|
|
|
17
17
|
bytes32 public constant TRANSFER_TYPEHASH =
|
|
18
|
-
keccak256("TransferWithAuthorize(address from,address to,uint256 value,uint256
|
|
18
|
+
keccak256("TransferWithAuthorize(address from,address to,uint256 value,uint256 createTime,uint256 expireTime,bytes32 nonce)");
|
|
19
19
|
|
|
20
20
|
bytes32 public constant TRANSFERFROM_TYPEHASH =
|
|
21
21
|
keccak256("TransferFromWithAuthorize(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)");
|
|
@@ -57,21 +57,21 @@ abstract contract TransferAuthorize is ITransferAuthorize, EIP712 {
|
|
|
57
57
|
address from,
|
|
58
58
|
address to,
|
|
59
59
|
uint256 value,
|
|
60
|
-
uint256
|
|
61
|
-
uint256
|
|
60
|
+
uint256 createTime,
|
|
61
|
+
uint256 expireTime,
|
|
62
62
|
bytes32 nonce,
|
|
63
63
|
bytes calldata auth
|
|
64
64
|
) internal view returns (address signer) {
|
|
65
|
-
require(block.timestamp >=
|
|
66
|
-
require(block.timestamp <=
|
|
65
|
+
require(block.timestamp >= createTime, "TransferAuthorize: not yet created");
|
|
66
|
+
require(block.timestamp <= expireTime, "TransferAuthorize: not yet expired");
|
|
67
67
|
bytes32 structHash = keccak256(
|
|
68
68
|
abi.encode(
|
|
69
69
|
TRANSFER_TYPEHASH,
|
|
70
70
|
from,
|
|
71
71
|
to,
|
|
72
72
|
value,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
createTime,
|
|
74
|
+
expireTime,
|
|
75
75
|
nonce
|
|
76
76
|
)
|
|
77
77
|
);
|
|
@@ -31,8 +31,8 @@ abstract contract ERC20xTransferWithAuthorize is ERC20, TransferAuthorize, Reent
|
|
|
31
31
|
address from,
|
|
32
32
|
address to,
|
|
33
33
|
uint256 value,
|
|
34
|
-
uint256
|
|
35
|
-
uint256
|
|
34
|
+
uint256 createTime,
|
|
35
|
+
uint256 expireTime,
|
|
36
36
|
bytes32 nonce,
|
|
37
37
|
bytes calldata auth
|
|
38
38
|
) external override nonReentrant {
|
|
@@ -40,15 +40,15 @@ abstract contract ERC20xTransferWithAuthorize is ERC20, TransferAuthorize, Reent
|
|
|
40
40
|
from,
|
|
41
41
|
to,
|
|
42
42
|
value,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
createTime,
|
|
44
|
+
expireTime,
|
|
45
45
|
nonce,
|
|
46
46
|
auth
|
|
47
47
|
);
|
|
48
48
|
require(signer == from, "ERC20TransferAuthorize: invalid signature");
|
|
49
49
|
_useAuthorize(from, nonce);
|
|
50
50
|
_transfer(from, to, value);
|
|
51
|
-
emit TransferWithAuthorize(from, to, value,
|
|
51
|
+
emit TransferWithAuthorize(from, to, value, createTime, expireTime, nonce, auth);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/// @notice Relayer-triggered transfer using an off-chain signature by `from`.
|