@@ -11,10 +11,9 @@ contract EIP712Swap is EIP712 {
1111
1212 mapping (address => uint256 ) private _nonces;
1313
14- bytes32 private constant SWAP_TYPEHASH =
15- keccak256 (
16- "SwapRequest(address pool,address sender,address tokenIn,address tokenOut,uint256 amountIn,uint256 minAmountOut,uint256 nonce,uint256 deadline) "
17- );
14+ bytes32 private constant SWAP_TYPEHASH = keccak256 (
15+ "SwapRequest(address pool,address sender,address tokenIn,address tokenOut,uint256 amountIn,uint256 minAmountOut,uint256 nonce,uint256 deadline) "
16+ );
1817
1918 error InvalidSignature ();
2019 error ExpiredSwapRequest ();
@@ -30,10 +29,7 @@ contract EIP712Swap is EIP712 {
3029 return _nonces[_sender];
3130 }
3231
33- function verify (
34- ISwap.SwapRequest memory _swapRequest ,
35- bytes memory _signature
36- ) public view returns (bool ) {
32+ function verify (ISwap.SwapRequest memory _swapRequest , bytes memory _signature ) public view returns (bool ) {
3733 bytes32 digest = _hashTypedDataV4 (
3834 keccak256 (
3935 abi.encode (
@@ -53,10 +49,7 @@ contract EIP712Swap is EIP712 {
5349 return signer == _swapRequest.sender;
5450 }
5551
56- function executeSwap (
57- ISwap.SwapRequest memory _swapRequest ,
58- bytes memory _signature
59- ) public returns (bool ) {
52+ function executeSwap (ISwap.SwapRequest memory _swapRequest , bytes memory _signature ) public returns (bool ) {
6053 if (! verify (_swapRequest, _signature)) revert InvalidSignature ();
6154 if (_swapRequest.deadline < block .timestamp ) {
6255 revert ExpiredSwapRequest ();
@@ -66,13 +59,14 @@ contract EIP712Swap is EIP712 {
6659 }
6760
6861 _nonces[_swapRequest.sender]++ ;
69- LiquidityPool (_swapRequest.pool).swap (
70- _swapRequest.sender,
71- _swapRequest.tokenIn,
72- _swapRequest.tokenOut,
73- _swapRequest.amountIn,
74- _swapRequest.minAmountOut
75- );
62+ LiquidityPool (_swapRequest.pool)
63+ .swap (
64+ _swapRequest.sender,
65+ _swapRequest.tokenIn,
66+ _swapRequest.tokenOut,
67+ _swapRequest.amountIn,
68+ _swapRequest.minAmountOut
69+ );
7670
7771 return true ;
7872 }
0 commit comments