@1inch/solidity-utils 2.2.0 → 2.2.2
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.
|
@@ -99,15 +99,17 @@ library SafeERC20 {
|
|
|
99
99
|
|
|
100
100
|
/// @dev Calls either ERC20 or Dai `permit` for `token`, if unsuccessful forwards revert from external call.
|
|
101
101
|
function safePermit(IERC20 token, bytes calldata permit) internal {
|
|
102
|
-
|
|
102
|
+
if (!tryPermit(token, permit)) RevertReasonForwarder.reRevert();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function tryPermit(IERC20 token, bytes calldata permit) internal returns(bool) {
|
|
103
106
|
if (permit.length == 32 * 7) {
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
revert SafePermitBadLength();
|
|
107
|
+
return _makeCalldataCall(token, IERC20Permit.permit.selector, permit);
|
|
108
|
+
}
|
|
109
|
+
if (permit.length == 32 * 8) {
|
|
110
|
+
return _makeCalldataCall(token, IDaiLikePermit.permit.selector, permit);
|
|
109
111
|
}
|
|
110
|
-
|
|
112
|
+
revert SafePermitBadLength();
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
function _makeCall(
|