t-isol 0.0.4 → 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
- /// @notice Emitted when a transfer with authorization is executed
14
- event TransferWithAuthorize(address indexed from, address indexed to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 indexed nonce);
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,10 +36,10 @@ interface ITransferAuthorize {
36
36
  address from,
37
37
  address to,
38
38
  uint256 value,
39
- uint256 validAfter,
40
- uint256 validBefore,
39
+ uint256 createTime,
40
+ uint256 expireTime,
41
41
  bytes32 nonce,
42
- bytes calldata signature
42
+ bytes calldata auth
43
43
  ) external;
44
44
 
45
45
  // ++
@@ -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 validAfter,uint256 validBefore,bytes32 nonce)");
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)");
@@ -52,30 +52,30 @@ abstract contract TransferAuthorize is ITransferAuthorize, EIP712 {
52
52
  emit AuthorizeUsed(authorizer, nonce);
53
53
  }
54
54
 
55
- /// @dev Verify an EIP-712 typed signature for TransferWithAuthorize and return the recovered signer
55
+ /// @dev Verify an EIP-712 typed signature (auth) for TransferWithAuthorize and return the recovered signer
56
56
  function _verifyTransfer(
57
57
  address from,
58
58
  address to,
59
59
  uint256 value,
60
- uint256 validAfter,
61
- uint256 validBefore,
60
+ uint256 createTime,
61
+ uint256 expireTime,
62
62
  bytes32 nonce,
63
- bytes calldata signature
63
+ bytes calldata auth
64
64
  ) internal view returns (address signer) {
65
- require(block.timestamp >= validAfter, "TransferAuthorize: not yet valid");
66
- require(block.timestamp <= validBefore, "TransferAuthorize: expired");
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
- validAfter,
74
- validBefore,
73
+ createTime,
74
+ expireTime,
75
75
  nonce
76
76
  )
77
77
  );
78
- signer = ECDSA.recover(_hashTypedDataV4(structHash), signature);
78
+ signer = ECDSA.recover(_hashTypedDataV4(structHash), auth);
79
79
  }
80
80
 
81
81
  /// @dev Verify an EIP-712 typed signature for TransferFromWithAuthorize and return the recovered signer
@@ -31,24 +31,24 @@ abstract contract ERC20xTransferWithAuthorize is ERC20, TransferAuthorize, Reent
31
31
  address from,
32
32
  address to,
33
33
  uint256 value,
34
- uint256 validAfter,
35
- uint256 validBefore,
34
+ uint256 createTime,
35
+ uint256 expireTime,
36
36
  bytes32 nonce,
37
- bytes calldata signature
37
+ bytes calldata auth
38
38
  ) external override nonReentrant {
39
39
  address signer = _verifyTransfer(
40
40
  from,
41
41
  to,
42
42
  value,
43
- validAfter,
44
- validBefore,
43
+ createTime,
44
+ expireTime,
45
45
  nonce,
46
- signature
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, validAfter, validBefore, nonce);
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`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "t-isol",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {