@pendle/core-v2 3.0.0-beta-6 → 3.0.0-beta-7

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.
@@ -341,7 +341,13 @@ abstract contract PendleOrderMixin is
341
341
 
342
342
  function _checkSig_doPermit(Order memory order, bytes memory signature)
343
343
  internal
344
- returns (bytes32, /*orderHash*/ uint256, /*remainingMakerAmount*/ uint256 /*filledMakerAmount*/ )
344
+ returns (
345
+ bytes32,
346
+ /*orderHash*/
347
+ uint256,
348
+ /*remainingMakerAmount*/
349
+ uint256 /*filledMakerAmount*/
350
+ )
345
351
  {
346
352
  bytes32 orderHash = hashOrder(order);
347
353
  OrderStatus memory status = _status[orderHash];
@@ -392,7 +398,7 @@ abstract contract PendleOrderMixin is
392
398
 
393
399
  uint256 totalSy = __mintSy_Single(SY, sharedToken, totalMaking);
394
400
  for (uint256 i = l; i < r; i = _inc1(i)) {
395
- params[i].makingAmount = params[i].makingAmount * totalSy / totalMaking;
401
+ params[i].makingAmount = (params[i].makingAmount * totalSy) / totalMaking;
396
402
  }
397
403
  }
398
404
  }
@@ -438,7 +444,7 @@ abstract contract PendleOrderMixin is
438
444
  uint256 totalToken = __redeemSy_Single(address(this), SY, sharedToken, totalSy);
439
445
  for (uint256 i = l; i < r; i = _inc1(i)) {
440
446
  address token = params[i].order.token;
441
- toMakers[i] = netSyOuts[i] * totalToken / totalSy;
447
+ toMakers[i] = (netSyOuts[i] * totalToken) / totalSy;
442
448
  if (sharedToken != token) {
443
449
  // WNATIVE case
444
450
  _wrap_unwrap_ETH(sharedToken, token, toMakers[i]);
@@ -482,11 +488,13 @@ abstract contract PendleOrderMixin is
482
488
  }
483
489
  }
484
490
 
491
+ // ! Allow self-fill of orders
485
492
  function _transferFromMakers(IERC20 token, FillOrderParams[] memory params, address to, uint256[] memory netIn)
486
493
  internal
487
494
  {
488
495
  uint256 len = params.length;
489
496
  for (uint256 i = 0; i < len; i = _inc1(i)) {
497
+ if (params[i].order.maker == to) continue;
490
498
  token.safeTransferFrom(params[i].order.maker, to, netIn[i]);
491
499
  }
492
500
  }
@@ -501,6 +509,7 @@ abstract contract PendleOrderMixin is
501
509
  }
502
510
  } else {
503
511
  for (uint256 i = 0; i < len; i = _inc1(i)) {
512
+ if (payer == params[i].order.receiver) continue;
504
513
  token.safeTransferFrom(payer, params[i].order.receiver, netOut[i]);
505
514
  }
506
515
  }
@@ -98,16 +98,14 @@ contract PendleRouterV3 is Proxy, IDiamondLoupe {
98
98
  res[6] = 0xfa483e72; // swapCallback
99
99
  }
100
100
  if (facet == ACTION_SWAP_PT) {
101
- res = new bytes4[](6);
101
+ res = new bytes4[](4);
102
102
  res[0] = 0x12c15afc; // swapExactSyForPt
103
103
  res[1] = 0x32aea98a; // swapExactTokenForPt
104
- res[2] = 0x5d3e105c; // swapTokenToToken
105
- res[3] = 0x7a95dddd; // swapExactPtForSy
106
- res[4] = 0xa89eba4a; // swapTokenToTokenViaSy
107
- res[5] = 0xc245e48d; // swapExactPtForToken
104
+ res[2] = 0x7a95dddd; // swapExactPtForSy
105
+ res[3] = 0xc245e48d; // swapExactPtForToken
108
106
  }
109
107
  if (facet == ACTION_MISC) {
110
- res = new bytes4[](11);
108
+ res = new bytes4[](13);
111
109
  res[0] = 0x1a8631b2; // mintPyFromSy
112
110
  res[1] = 0x1cf0f536; // callThenRevert
113
111
  res[2] = 0x2d8f9d8d; // boostMarkets
@@ -115,10 +113,12 @@ contract PendleRouterV3 is Proxy, IDiamondLoupe {
115
113
  res[4] = 0x339748cb; // redeemPyToSy
116
114
  res[5] = 0x339a5572; // redeemSyToToken
117
115
  res[6] = 0x47f1de22; // redeemPyToToken
118
- res[7] = 0x60fc8466; // multicall
119
- res[8] = 0x657b87d8; // multicallRevert
120
- res[9] = 0xd0f42385; // mintPyFromToken
121
- res[10] = 0xf7e375e8; // redeemDueInterestAndRewards
116
+ res[7] = 0x5d3e105c; // swapTokenToToken
117
+ res[8] = 0x60fc8466; // multicall
118
+ res[9] = 0x657b87d8; // multicallRevert
119
+ res[10] = 0xa89eba4a; // swapTokenToTokenViaSy
120
+ res[11] = 0xd0f42385; // mintPyFromToken
121
+ res[12] = 0xf7e375e8; // redeemDueInterestAndRewards
122
122
  }
123
123
  }
124
124
 
@@ -159,7 +159,7 @@ contract PendleRouterV3 is Proxy, IDiamondLoupe {
159
159
  if (sig == 0x587e3950) return ACTION_ADD_REMOVE_LIQ; //removeLiquiditySingleToken
160
160
  if (sig == 0x5a245eef) return ACTION_ADD_REMOVE_LIQ; //addLiquiditySingleSy
161
161
  } else {
162
- if (sig == 0x5d3e105c) return ACTION_SWAP_PT; //swapTokenToToken
162
+ if (sig == 0x5d3e105c) return ACTION_MISC; //swapTokenToToken
163
163
  if (sig == 0x60fc8466) return ACTION_MISC; //multicall
164
164
  if (sig == 0x657b87d8) return ACTION_MISC; //multicallRevert
165
165
  }
@@ -181,7 +181,7 @@ contract PendleRouterV3 is Proxy, IDiamondLoupe {
181
181
  if (sig == 0x9c1010ec) return ACTION_SWAP_YT; //swapExactTokenForYt
182
182
  if (sig == 0x9cb6711e) return ACTION_ADD_REMOVE_LIQ; //addLiquiditySingleToken
183
183
  } else {
184
- if (sig == 0xa89eba4a) return ACTION_SWAP_PT; //swapTokenToTokenViaSy
184
+ if (sig == 0xa89eba4a) return ACTION_MISC; //swapTokenToTokenViaSy
185
185
  if (sig == 0xadfca15e) return address(this); //facetFunctionSelectors
186
186
  if (sig == 0xb00f09d7) return ACTION_ADD_REMOVE_LIQ; //removeLiquidityDualTokenAndPt
187
187
  }
@@ -18,7 +18,7 @@
18
18
  "PENDLE": "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8",
19
19
  "yieldContractFactory": "0x28dE02Ac3c3F5ef427e55c321F73fDc7F192e8E4",
20
20
  "marketFactory": "0xf5a7De2D276dbda3EEf1b62A9E718EFf4d29dDC8",
21
- "router": "0x10CEaB79805F36fD0BD4E93bf98a7C7d6A99FD77",
21
+ "router": "0xf3a0618EbB0e407cD6bE17088Cc98a55C5721d29",
22
22
  "routerStatic": "0xAdB09F65bd90d19e3148D9ccb693F3161C6DB3E8",
23
23
  "pendleSwap": "0x8e09Aa43885d99701AB047dA2aC98aECC13807B0",
24
24
  "routerHelper": "0x462206b11d185ef6F64B41D344325401C37EC335",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pendle/core-v2",
3
3
  "description": "Core smart contracts of Pendle Protocol.",
4
4
  "license": "BUSL-1.1",
5
- "version": "3.0.0-beta-6",
5
+ "version": "3.0.0-beta-7",
6
6
  "homepage": "https://pendle.finance",
7
7
  "keywords": [
8
8
  "pendle",