@@ -24,15 +24,15 @@ library SafeERC20 {
2424 * non-reverting calls are assumed to be successful.
2525 */
2626 function safeTransfer (IERC20 token , address to , uint256 value ) internal {
27- _callOptionalReturn (token, abi.encodeWithSelector (token.transfer. selector , to, value));
27+ _callOptionalReturn (token, abi.encodeCall (token.transfer, ( to, value) ));
2828 }
2929
3030 /**
3131 * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
3232 * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
3333 */
3434 function safeTransferFrom (IERC20 token , address from , address to , uint256 value ) internal {
35- _callOptionalReturn (token, abi.encodeWithSelector (token.transferFrom. selector , from, to, value));
35+ _callOptionalReturn (token, abi.encodeCall (token.transferFrom, ( from, to, value) ));
3636 }
3737
3838 /**
@@ -62,10 +62,10 @@ library SafeERC20 {
6262 * 0 before setting it to a non-zero value.
6363 */
6464 function forceApprove (IERC20 token , address spender , uint256 value ) internal {
65- bytes memory approvalCall = abi.encodeWithSelector (token.approve. selector , spender, value);
65+ bytes memory approvalCall = abi.encodeCall (token.approve, ( spender, value) );
6666
6767 if (! _callOptionalReturnBool (token, approvalCall)) {
68- _callOptionalReturn (token, abi.encodeWithSelector (token.approve. selector , spender, 0 ));
68+ _callOptionalReturn (token, abi.encodeCall (token.approve, ( spender, 0 ) ));
6969 _callOptionalReturn (token, approvalCall);
7070 }
7171 }
0 commit comments