@1inch/solidity-utils 2.2.10 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/interfaces/IPermit2.sol +40 -0
- package/contracts/libraries/SafeERC20.sol +61 -10
- package/dist/src/permit.d.ts +2 -0
- package/dist/src/permit.js +29 -1
- package/dist/src/permit.js.map +1 -1
- package/dist/src/prelude.d.ts +1 -0
- package/dist/src/prelude.js +1 -0
- package/dist/src/prelude.js.map +1 -1
- package/package.json +2 -1
- package/contracts/mocks/.DS_Store +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
interface IPermit2 {
|
|
6
|
+
struct PermitDetails {
|
|
7
|
+
// ERC20 token address
|
|
8
|
+
address token;
|
|
9
|
+
// the maximum amount allowed to spend
|
|
10
|
+
uint160 amount;
|
|
11
|
+
// timestamp at which a spender's token allowances become invalid
|
|
12
|
+
uint48 expiration;
|
|
13
|
+
// an incrementing value indexed per owner,token,and spender for each signature
|
|
14
|
+
uint48 nonce;
|
|
15
|
+
}
|
|
16
|
+
/// @notice The permit message signed for a single token allownce
|
|
17
|
+
struct PermitSingle {
|
|
18
|
+
// the permit data for a single token alownce
|
|
19
|
+
PermitDetails details;
|
|
20
|
+
// address permissioned on the allowed tokens
|
|
21
|
+
address spender;
|
|
22
|
+
// deadline on the permit signature
|
|
23
|
+
uint256 sigDeadline;
|
|
24
|
+
}
|
|
25
|
+
/// @notice Packed allowance
|
|
26
|
+
struct PackedAllowance {
|
|
27
|
+
// amount allowed
|
|
28
|
+
uint160 amount;
|
|
29
|
+
// permission expiry
|
|
30
|
+
uint48 expiration;
|
|
31
|
+
// an incrementing value indexed per owner,token,and spender for each signature
|
|
32
|
+
uint48 nonce;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function transferFrom(address user, address spender, uint160 amount, address token) external;
|
|
36
|
+
|
|
37
|
+
function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;
|
|
38
|
+
|
|
39
|
+
function allowance(address user, address token, address spender) external view returns (PackedAllowance memory);
|
|
40
|
+
}
|
|
@@ -6,6 +6,7 @@ pragma abicoder v1;
|
|
|
6
6
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
7
7
|
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
|
|
8
8
|
import "../interfaces/IDaiLikePermit.sol";
|
|
9
|
+
import "../interfaces/IPermit2.sol";
|
|
9
10
|
import "../libraries/RevertReasonForwarder.sol";
|
|
10
11
|
|
|
11
12
|
/// @title Implements efficient safe methods for ERC20 interface.
|
|
@@ -17,6 +18,24 @@ library SafeERC20 {
|
|
|
17
18
|
error SafeDecreaseAllowanceFailed();
|
|
18
19
|
error SafePermitBadLength();
|
|
19
20
|
|
|
21
|
+
address private constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
|
|
22
|
+
bytes4 private constant _PERMIT_LENGHT_ERROR = 0x68275857; // SafePermitBadLength.selector
|
|
23
|
+
|
|
24
|
+
/// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.
|
|
25
|
+
function safeTransferFromUniversal(
|
|
26
|
+
IERC20 token,
|
|
27
|
+
address from,
|
|
28
|
+
address to,
|
|
29
|
+
uint256 amount,
|
|
30
|
+
bool permit2
|
|
31
|
+
) internal {
|
|
32
|
+
if (permit2) {
|
|
33
|
+
safeTransferFromPermit2(token, from, to, amount);
|
|
34
|
+
} else {
|
|
35
|
+
safeTransferFrom(token, from, to, amount);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
/// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.
|
|
21
40
|
function safeTransferFrom(
|
|
22
41
|
IERC20 token,
|
|
@@ -48,6 +67,38 @@ library SafeERC20 {
|
|
|
48
67
|
if (!success) revert SafeTransferFromFailed();
|
|
49
68
|
}
|
|
50
69
|
|
|
70
|
+
/// @dev Permit2 version of safeTransferFrom above.
|
|
71
|
+
function safeTransferFromPermit2(
|
|
72
|
+
IERC20 token,
|
|
73
|
+
address from,
|
|
74
|
+
address to,
|
|
75
|
+
uint256 amount
|
|
76
|
+
) internal {
|
|
77
|
+
bytes4 selector = IPermit2.transferFrom.selector;
|
|
78
|
+
bool success;
|
|
79
|
+
/// @solidity memory-safe-assembly
|
|
80
|
+
assembly { // solhint-disable-line no-inline-assembly
|
|
81
|
+
let data := mload(0x40)
|
|
82
|
+
|
|
83
|
+
mstore(data, selector)
|
|
84
|
+
mstore(add(data, 0x04), from)
|
|
85
|
+
mstore(add(data, 0x24), to)
|
|
86
|
+
mstore(add(data, 0x44), amount)
|
|
87
|
+
mstore(add(data, 0x64), token)
|
|
88
|
+
success := call(gas(), _PERMIT2, 0, data, 0x84, 0x0, 0x20)
|
|
89
|
+
if success {
|
|
90
|
+
switch returndatasize()
|
|
91
|
+
case 0 {
|
|
92
|
+
success := gt(extcodesize(token), 0)
|
|
93
|
+
}
|
|
94
|
+
default {
|
|
95
|
+
success := and(gt(returndatasize(), 31), eq(mload(0), 1))
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!success) revert SafeTransferFromFailed();
|
|
100
|
+
}
|
|
101
|
+
|
|
51
102
|
/// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.
|
|
52
103
|
function safeTransfer(
|
|
53
104
|
IERC20 token,
|
|
@@ -112,12 +163,12 @@ library SafeERC20 {
|
|
|
112
163
|
function tryPermit(IERC20 token, address owner, address spender, bytes calldata permit) internal returns(bool success) {
|
|
113
164
|
bytes4 permitSelector = IERC20Permit.permit.selector;
|
|
114
165
|
bytes4 daiPermitSelector = IDaiLikePermit.permit.selector;
|
|
115
|
-
|
|
166
|
+
bytes4 permit2Selector = IPermit2.permit.selector;
|
|
116
167
|
/// @solidity memory-safe-assembly
|
|
117
168
|
assembly { // solhint-disable-line no-inline-assembly
|
|
169
|
+
let ptr := mload(0x40)
|
|
118
170
|
switch permit.length
|
|
119
171
|
case 100 {
|
|
120
|
-
let ptr := mload(0x40)
|
|
121
172
|
mstore(ptr, permitSelector)
|
|
122
173
|
mstore(add(ptr, 0x04), owner)
|
|
123
174
|
mstore(add(ptr, 0x24), spender)
|
|
@@ -137,7 +188,6 @@ library SafeERC20 {
|
|
|
137
188
|
success := call(gas(), token, 0, ptr, 0xe4, 0, 0)
|
|
138
189
|
}
|
|
139
190
|
case 72 {
|
|
140
|
-
let ptr := mload(0x40)
|
|
141
191
|
mstore(ptr, daiPermitSelector)
|
|
142
192
|
mstore(add(ptr, 0x04), owner)
|
|
143
193
|
mstore(add(ptr, 0x24), spender)
|
|
@@ -159,27 +209,28 @@ library SafeERC20 {
|
|
|
159
209
|
success := call(gas(), token, 0, ptr, 0x104, 0, 0)
|
|
160
210
|
}
|
|
161
211
|
case 224 {
|
|
162
|
-
let ptr := mload(0x40)
|
|
163
212
|
mstore(ptr, permitSelector)
|
|
164
213
|
calldatacopy(add(ptr, 0x04), permit.offset, permit.length)
|
|
165
214
|
// IERC20Permit.permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s)
|
|
166
215
|
success := call(gas(), token, 0, ptr, add(4, permit.length), 0, 0)
|
|
167
216
|
}
|
|
168
217
|
case 256 {
|
|
169
|
-
let ptr := mload(0x40)
|
|
170
218
|
mstore(ptr, daiPermitSelector)
|
|
171
219
|
calldatacopy(add(ptr, 0x04), permit.offset, permit.length)
|
|
172
220
|
// IDaiLikePermit.permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s)
|
|
173
221
|
success := call(gas(), token, 0, ptr, add(4, permit.length), 0, 0)
|
|
174
222
|
}
|
|
223
|
+
case 384 {
|
|
224
|
+
mstore(ptr, permit2Selector)
|
|
225
|
+
calldatacopy(add(ptr, 0x04), permit.offset, permit.length)
|
|
226
|
+
success := call(gas(), _PERMIT2, 0, ptr, add(4, permit.length), 0, 0)
|
|
227
|
+
}
|
|
228
|
+
// TODO: add case for compact permit2
|
|
175
229
|
default {
|
|
176
|
-
|
|
230
|
+
mstore(ptr, _PERMIT_LENGHT_ERROR)
|
|
231
|
+
revert(ptr, 4)
|
|
177
232
|
}
|
|
178
233
|
}
|
|
179
|
-
|
|
180
|
-
if (lengthIsInvalid) {
|
|
181
|
-
revert SafePermitBadLength();
|
|
182
|
-
}
|
|
183
234
|
}
|
|
184
235
|
|
|
185
236
|
function _makeCall(
|
package/dist/src/permit.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Wallet } from 'ethers';
|
|
|
4
4
|
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
|
|
5
5
|
export declare const TypedDataVersion = SignTypedDataVersion.V4;
|
|
6
6
|
export declare const defaultDeadline: bigint;
|
|
7
|
+
export declare const defaultDeadlinePermit2: bigint;
|
|
7
8
|
export declare const EIP712Domain: {
|
|
8
9
|
name: string;
|
|
9
10
|
type: string;
|
|
@@ -62,5 +63,6 @@ export declare function buildDataLikeDai(name: string, version: string, chainId:
|
|
|
62
63
|
};
|
|
63
64
|
};
|
|
64
65
|
export declare function getPermit(owner: Wallet | SignerWithAddress, permitContract: Contract, tokenVersion: string, chainId: number, spender: string, value: string, deadline?: string, compact?: boolean): Promise<string>;
|
|
66
|
+
export declare function getPermit2(owner: Wallet | SignerWithAddress, permitContract: Contract, token: string, chainId: number, spender: string, amount: bigint, expiration?: bigint, sigDeadline?: bigint): Promise<string>;
|
|
65
67
|
export declare function getPermitLikeDai(holder: Wallet | SignerWithAddress, permitContract: Contract, tokenVersion: string, chainId: number, spender: string, allowed: boolean, expiry?: string, compact?: boolean): Promise<string>;
|
|
66
68
|
export declare function withTarget(target: bigint | string, data: bigint | string): string;
|
package/dist/src/permit.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withTarget = exports.getPermitLikeDai = exports.getPermit = exports.buildDataLikeDai = exports.buildData = exports.domainSeparator = exports.cutSelector = exports.trim0x = exports.DaiLikePermit = exports.Permit = exports.EIP712Domain = exports.defaultDeadline = exports.TypedDataVersion = void 0;
|
|
3
|
+
exports.withTarget = exports.getPermitLikeDai = exports.getPermit2 = exports.getPermit = exports.buildDataLikeDai = exports.buildData = exports.domainSeparator = exports.cutSelector = exports.trim0x = exports.DaiLikePermit = exports.Permit = exports.EIP712Domain = exports.defaultDeadlinePermit2 = exports.defaultDeadline = exports.TypedDataVersion = void 0;
|
|
4
4
|
const eth_sig_util_1 = require("@metamask/eth-sig-util");
|
|
5
5
|
const prelude_1 = require("./prelude");
|
|
6
6
|
const utils_1 = require("ethers/lib/utils");
|
|
7
|
+
const permit2_sdk_1 = require("@uniswap/permit2-sdk");
|
|
7
8
|
exports.TypedDataVersion = eth_sig_util_1.SignTypedDataVersion.V4;
|
|
8
9
|
exports.defaultDeadline = prelude_1.constants.MAX_UINT256;
|
|
10
|
+
exports.defaultDeadlinePermit2 = prelude_1.constants.MAX_UINT48;
|
|
9
11
|
exports.EIP712Domain = [
|
|
10
12
|
{ name: 'name', type: 'string' },
|
|
11
13
|
{ name: 'version', type: 'string' },
|
|
@@ -91,6 +93,32 @@ async function getPermit(owner, permitContract, tokenVersion, chainId, spender,
|
|
|
91
93
|
return cutSelector(permitCall);
|
|
92
94
|
}
|
|
93
95
|
exports.getPermit = getPermit;
|
|
96
|
+
/*
|
|
97
|
+
* @param permit2Contract The contract object for Permit2 Uniswap contract.
|
|
98
|
+
*/
|
|
99
|
+
async function getPermit2(owner, permitContract, token, chainId, spender, amount, expiration = prelude_1.constants.MAX_UINT48, sigDeadline = prelude_1.constants.MAX_UINT48) {
|
|
100
|
+
const nonce = (await permitContract.allowance(owner.address, token, spender)).nonce;
|
|
101
|
+
const details = {
|
|
102
|
+
token,
|
|
103
|
+
amount,
|
|
104
|
+
expiration,
|
|
105
|
+
nonce,
|
|
106
|
+
};
|
|
107
|
+
const permitSingle = {
|
|
108
|
+
details,
|
|
109
|
+
spender,
|
|
110
|
+
sigDeadline,
|
|
111
|
+
};
|
|
112
|
+
const data = permit2_sdk_1.AllowanceTransfer.getPermitData(permitSingle, permitContract.address, chainId);
|
|
113
|
+
const signature = await owner._signTypedData(data.domain, data.types, data.values);
|
|
114
|
+
const permitCall = permitContract.interface.encodeFunctionData('permit(address,((address,uint160,uint48,uint48),address,uint256),bytes)', [
|
|
115
|
+
owner.address,
|
|
116
|
+
permitSingle,
|
|
117
|
+
signature,
|
|
118
|
+
]);
|
|
119
|
+
return cutSelector(permitCall);
|
|
120
|
+
}
|
|
121
|
+
exports.getPermit2 = getPermit2;
|
|
94
122
|
/*
|
|
95
123
|
* @param permitContract The contract object with ERC20PermitLikeDai type and token address for which the permit creating.
|
|
96
124
|
*/
|
package/dist/src/permit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permit.js","sourceRoot":"","sources":["../../src/permit.ts"],"names":[],"mappings":";;;AAAA,yDAA8E;AAC9E,uCAAsC;AAGtC,4CAAkD;
|
|
1
|
+
{"version":3,"file":"permit.js","sourceRoot":"","sources":["../../src/permit.ts"],"names":[],"mappings":";;;AAAA,yDAA8E;AAC9E,uCAAsC;AAGtC,4CAAkD;AAElD,sDAAyD;AAE5C,QAAA,gBAAgB,GAAG,mCAAoB,CAAC,EAAE,CAAC;AAC3C,QAAA,eAAe,GAAG,mBAAS,CAAC,WAAW,CAAC;AACxC,QAAA,sBAAsB,GAAG,mBAAS,CAAC,UAAU,CAAC;AAE9C,QAAA,YAAY,GAAG;IACxB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;IACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EA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,CAAC,EAAE,GAAG,CAAC;YAC3C,CAAC,MAAM,KAAK,mBAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAChH,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;YACxC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;KAC7E;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,SAAS,CAAC,kBAAkB,CAC1D,oEAAoE,EACpE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAC7D,CAAC;IACF,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC;AA1CD,4CA0CC;AAED,SAAgB,UAAU,CAAC,MAAuB,EAAE,IAAqB;IACrE,OAAO,MAAM,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAFD,gCAEC"}
|
package/dist/src/prelude.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const constants: {
|
|
|
6
6
|
readonly ZERO_BYTES32: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
7
7
|
readonly MAX_UINT256: bigint;
|
|
8
8
|
readonly MAX_INT256: bigint;
|
|
9
|
+
readonly MAX_UINT48: bigint;
|
|
9
10
|
readonly MIN_INT256: bigint;
|
|
10
11
|
readonly MAX_UINT128: bigint;
|
|
11
12
|
};
|
package/dist/src/prelude.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.constants = {
|
|
|
17
17
|
ZERO_BYTES32: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
18
18
|
MAX_UINT256: 2n ** 256n - 1n,
|
|
19
19
|
MAX_INT256: 2n ** 255n - 1n,
|
|
20
|
+
MAX_UINT48: 2n ** 48n - 1n,
|
|
20
21
|
MIN_INT256: -(2n ** 255n),
|
|
21
22
|
MAX_UINT128: 2n ** 128n - 1n,
|
|
22
23
|
};
|
package/dist/src/prelude.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prelude.js","sourceRoot":"","sources":["../../src/prelude.ts"],"names":[],"mappings":";;;AAAA,+BAAiF;
|
|
1
|
+
{"version":3,"file":"prelude.js","sourceRoot":"","sources":["../../src/prelude.ts"],"names":[],"mappings":";;;AAAA,+BAAiF;AAuBxE,0FAvBA,gBAAS,OAuBA;AAAE,+FAvBA,qBAAc,OAuBA;AAAE,uFAvBA,aAAM,OAuBA;AAAE,uFAvBA,aAAM,OAuBA;AAAE,uFAvBA,aAAM,OAuBA;AAAE,uFAvBA,aAAM,OAuBA;AAtBlE,4CAA8C;AAC9C,sFAAgE;AAcvD,qFAdA,8BAAI,OAcA;AAZA,QAAA,SAAS,GAAG;IACrB,YAAY,EAAE,4CAA4C;IAC1D,WAAW,EAAE,4CAA4C;IACzD,YAAY,EAAE,oEAAoE;IAClF,WAAW,EAAE,EAAE,IAAI,IAAI,GAAG,EAAE;IAC5B,UAAU,EAAE,EAAE,IAAI,IAAI,GAAG,EAAE;IAC3B,UAAU,EAAE,EAAE,IAAI,GAAG,GAAG,EAAE;IAC1B,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC;IACzB,WAAW,EAAE,EAAE,IAAI,IAAI,GAAG,EAAE;CACtB,CAAC;AAKX,SAAgB,KAAK,CAAC,CAAS;IAC3B,OAAO,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACpC,CAAC;AAFD,sBAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1inch/solidity-utils",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.11",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@nomicfoundation/hardhat-network-helpers": "1.0.6",
|
|
34
34
|
"@nomiclabs/hardhat-ethers": "2.1.1",
|
|
35
35
|
"@openzeppelin/contracts": "4.7.3",
|
|
36
|
+
"@uniswap/permit2-sdk": "^1.2.0",
|
|
36
37
|
"ethereumjs-util": "7.1.5",
|
|
37
38
|
"ethers": "5.7.1",
|
|
38
39
|
"hardhat": "2.11.2"
|
|
Binary file
|