@pendle/core-v2 0.16.2-testnet → 0.16.3-testnet

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.
Files changed (319) hide show
  1. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
  2. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +15 -2
  3. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
  4. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
  5. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +15 -2
  6. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
  7. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json +13 -0
  8. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
  9. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
  10. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +15 -2
  11. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
  12. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +15 -2
  13. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  14. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +13 -0
  15. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  16. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +15 -2
  17. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  18. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +15 -2
  19. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  20. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +15 -2
  21. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  22. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  23. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +15 -2
  24. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +15 -2
  26. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  27. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  28. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  29. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
  30. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
  31. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  32. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  33. package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
  34. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +4 -0
  35. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +695 -0
  36. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +4 -0
  37. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +531 -0
  38. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +4 -0
  39. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +10 -0
  40. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  42. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  44. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  46. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  47. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +15 -2
  49. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  51. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
  53. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +4 -0
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +89 -0
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
  64. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  65. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  66. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +15 -2
  67. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  68. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +15 -2
  69. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  70. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
  71. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  72. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +2 -2
  73. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  74. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
  75. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
  76. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +2 -2
  77. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
  78. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.json +2 -2
  79. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  80. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.json +13 -0
  81. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  82. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
  83. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  84. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +208 -2
  85. package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  86. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
  87. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  88. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +30 -83
  89. package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
  90. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
  91. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  92. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +91 -17
  93. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  94. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +50 -0
  95. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +20 -0
  97. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +20 -0
  100. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +181 -17
  102. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +4 -0
  103. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +173 -0
  104. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +4 -0
  105. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +86 -0
  106. package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.dbg.json +4 -0
  107. package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.json +34 -0
  108. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  109. package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
  110. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
  119. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +45 -0
  120. package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
  121. package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
  122. package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
  123. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  124. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +15 -2
  125. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +4 -0
  126. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +67 -0
  127. package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.dbg.json +1 -1
  128. package/build/artifacts/contracts/offchain-helpers/ImplicitSwapfeeContract.sol/ImplicitSwapfeeContract.json +2 -2
  129. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  130. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -36
  131. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  132. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +237 -61
  133. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  134. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +120 -41
  135. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  136. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  137. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  138. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +79 -24
  139. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  140. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  141. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  142. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +49 -24
  143. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  144. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
  145. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  146. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +49 -24
  147. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  148. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +15 -2
  149. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  150. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.json +14 -1
  151. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  152. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  153. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  154. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  155. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  156. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +191 -2
  157. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +4 -0
  158. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.json +35 -0
  159. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  160. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.json +1 -1
  161. package/contracts/core/BulkSeller/BulkSeller.sol +250 -0
  162. package/contracts/core/BulkSeller/BulkSellerFactory.sol +89 -0
  163. package/contracts/core/BulkSeller/BulkSellerMathCore.sol +143 -0
  164. package/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol +2 -4
  165. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +107 -0
  166. package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +19 -4
  167. package/contracts/core/libraries/Errors.sol +17 -0
  168. package/contracts/interfaces/Curve/ICrvPool.sol +9 -27
  169. package/contracts/interfaces/IPActionAddRemoveLiq.sol +3 -5
  170. package/contracts/interfaces/IPActionMintRedeem.sol +2 -0
  171. package/contracts/interfaces/IPBulkSeller.sol +28 -0
  172. package/contracts/interfaces/IPBulkSellerFactory.sol +12 -0
  173. package/contracts/interfaces/IPBulkSellerSYCallback.sol +10 -0
  174. package/contracts/interfaces/IStETH.sol +6 -0
  175. package/contracts/offchain-helpers/BulkSellerOffchain.sol +43 -0
  176. package/contracts/offchain-helpers/MarketMathStatic.sol +0 -144
  177. package/contracts/offchain-helpers/RouterStatic.sol +167 -51
  178. package/contracts/router/ActionAddRemoveLiq.sol +60 -44
  179. package/contracts/router/ActionMintRedeem.sol +19 -15
  180. package/contracts/router/ActionSwapPT.sol +3 -3
  181. package/contracts/router/ActionSwapYT.sol +11 -4
  182. package/contracts/router/base/ActionBaseMintRedeem.sol +73 -74
  183. package/contracts/router/kyberswap/AggregationRouterHelper.sol +17 -1
  184. package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +10 -0
  185. package/contracts/router/kyberswap/KyberSwapHelper.sol +17 -8
  186. package/deployments/43113-core.json +3 -2
  187. package/deployments/43113-markets/benqi-market-QI-AVAX-FEB-2ND.json +9 -0
  188. package/deployments/80001-core.json +3 -2
  189. package/package.json +3 -2
  190. package/typechain-types/AccessControl.ts +360 -0
  191. package/typechain-types/ActionAddRemoveLiq.ts +83 -52
  192. package/typechain-types/ActionBaseMintRedeem.ts +27 -8
  193. package/typechain-types/ActionMintRedeem.ts +68 -17
  194. package/typechain-types/ActionSwapPT.ts +53 -12
  195. package/typechain-types/ActionSwapYT.ts +53 -12
  196. package/typechain-types/AggregationRouterHelper.ts +287 -3
  197. package/typechain-types/BaseSplitCodeFactoryContract.ts +9 -0
  198. package/typechain-types/BeaconProxy.ts +97 -0
  199. package/typechain-types/BoringOwnableUpgradeable.ts +9 -0
  200. package/typechain-types/BulkSeller.ts +776 -0
  201. package/typechain-types/BulkSellerFactory.ts +707 -0
  202. package/typechain-types/BulkSellerOffchain.ts +117 -0
  203. package/typechain-types/Curve3CrvPoolHelper.ts +236 -0
  204. package/typechain-types/CurveFraxUsdcPoolHelper.ts +158 -0
  205. package/typechain-types/CurveUsdd3CrvPoolHelper.ts +184 -0
  206. package/typechain-types/ERC165.ts +102 -0
  207. package/typechain-types/IAccessControl.ts +305 -0
  208. package/typechain-types/IAggregationRouterHelper.ts +108 -0
  209. package/typechain-types/ICrvPool.ts +66 -164
  210. package/typechain-types/IERC165.ts +102 -0
  211. package/typechain-types/IPActionAddRemoveLiq.ts +56 -44
  212. package/typechain-types/IPActionMintRedeem.ts +41 -9
  213. package/typechain-types/IPActionSwapPT.ts +26 -4
  214. package/typechain-types/IPActionSwapYT.ts +26 -4
  215. package/typechain-types/IPAllAction.ts +77 -55
  216. package/typechain-types/IPBulkSeller.ts +290 -0
  217. package/typechain-types/IPBulkSellerCallback.ts +115 -0
  218. package/typechain-types/IPBulkSellerFactory.ts +147 -0
  219. package/typechain-types/IStETH.ts +56 -0
  220. package/typechain-types/ITriCrvPool.ts +345 -0
  221. package/typechain-types/Initializable.ts +68 -0
  222. package/typechain-types/KyberSwapHelper.ts +8 -8
  223. package/typechain-types/MarketMathStatic.ts +0 -50
  224. package/typechain-types/PendleCurveFraxUsdcSY.ts +1228 -0
  225. package/typechain-types/PendleCurveUsdd3CrvSY.ts +1299 -0
  226. package/typechain-types/PendleFeeDistributor.ts +9 -0
  227. package/typechain-types/PendleFeeDistributorFactory.ts +9 -0
  228. package/typechain-types/PendleGaugeControllerBaseUpg.ts +9 -0
  229. package/typechain-types/PendleGaugeControllerMainchainUpg.ts +9 -0
  230. package/typechain-types/PendleGaugeControllerSidechainUpg.ts +9 -0
  231. package/typechain-types/PendleMarketFactory.ts +9 -0
  232. package/typechain-types/PendleMsgReceiveEndpointUpg.ts +9 -0
  233. package/typechain-types/PendleMsgSendEndpointUpg.ts +9 -0
  234. package/typechain-types/PendleMsgSenderAppUpg.ts +9 -0
  235. package/typechain-types/PendlePrincipalToken.ts +9 -0
  236. package/typechain-types/PendleRouter.ts +9 -0
  237. package/typechain-types/PendleVotingControllerUpg.ts +9 -0
  238. package/typechain-types/PendleYieldContractFactory.ts +9 -0
  239. package/typechain-types/ReentrancyGuardUpgradeable.ts +68 -0
  240. package/typechain-types/RouterStatic.ts +203 -22
  241. package/typechain-types/VotingEscrowPendleMainchain.ts +9 -0
  242. package/typechain-types/VotingEscrowPendleSidechain.ts +9 -0
  243. package/typechain-types/factories/AccessControl__factory.ts +227 -0
  244. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +131 -59
  245. package/typechain-types/factories/ActionBaseMintRedeem__factory.ts +14 -1
  246. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  247. package/typechain-types/factories/ActionMintRedeem__factory.ts +90 -42
  248. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  249. package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
  250. package/typechain-types/factories/ActionSwapPT__factory.ts +60 -42
  251. package/typechain-types/factories/ActionSwapYT__factory.ts +60 -42
  252. package/typechain-types/factories/AggregationRouterHelper__factory.ts +190 -1
  253. package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +14 -1
  254. package/typechain-types/factories/BaseSplitCodeFactory__factory.ts +1 -1
  255. package/typechain-types/factories/BeaconProxy__factory.ts +141 -0
  256. package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
  257. package/typechain-types/factories/BoringOwnableUpgradeable__factory.ts +13 -0
  258. package/typechain-types/factories/BulkSellerFactory__factory.ts +584 -0
  259. package/typechain-types/factories/BulkSellerOffchain__factory.ts +120 -0
  260. package/typechain-types/factories/BulkSeller__factory.ts +745 -0
  261. package/typechain-types/factories/Curve3CrvPoolHelper__factory.ts +220 -0
  262. package/typechain-types/factories/CurveFraxUsdcPoolHelper__factory.ts +146 -0
  263. package/typechain-types/factories/CurveUsdd3CrvPoolHelper__factory.ts +172 -0
  264. package/typechain-types/factories/ERC165__factory.ts +39 -0
  265. package/typechain-types/factories/ERC20__factory.ts +1 -1
  266. package/typechain-types/factories/Errors__factory.ts +207 -1
  267. package/typechain-types/factories/IAccessControl__factory.ts +198 -0
  268. package/typechain-types/factories/IAggregationRouterHelper__factory.ts +54 -0
  269. package/typechain-types/factories/ICrvPool__factory.ts +30 -83
  270. package/typechain-types/factories/IERC165__factory.ts +42 -0
  271. package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +91 -17
  272. package/typechain-types/factories/IPActionMintRedeem__factory.ts +50 -0
  273. package/typechain-types/factories/IPActionSwapPT__factory.ts +20 -0
  274. package/typechain-types/factories/IPActionSwapYT__factory.ts +20 -0
  275. package/typechain-types/factories/IPAllAction__factory.ts +181 -17
  276. package/typechain-types/factories/IPBulkSellerCallback__factory.ts +53 -0
  277. package/typechain-types/factories/IPBulkSellerFactory__factory.ts +101 -0
  278. package/typechain-types/factories/IPBulkSeller__factory.ts +185 -0
  279. package/typechain-types/factories/IStETH__factory.ts +45 -0
  280. package/typechain-types/factories/ITriCrvPool__factory.ts +225 -0
  281. package/typechain-types/factories/ImplicitSwapfeeContract__factory.ts +1 -1
  282. package/typechain-types/factories/Initializable__factory.ts +36 -0
  283. package/typechain-types/factories/KyberSwapHelper__factory.ts +1 -1
  284. package/typechain-types/factories/MarketMathStatic__factory.ts +1 -35
  285. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  286. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1068 -0
  287. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1168 -0
  288. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  289. package/typechain-types/factories/PendleERC20__factory.ts +1 -1
  290. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +14 -1
  291. package/typechain-types/factories/PendleFeeDistributor__factory.ts +14 -1
  292. package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +13 -0
  293. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +14 -1
  294. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +14 -1
  295. package/typechain-types/factories/PendleMarketFactory__factory.ts +14 -1
  296. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  297. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +14 -1
  298. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +14 -1
  299. package/typechain-types/factories/PendleMsgSenderAppUpg__factory.ts +13 -0
  300. package/typechain-types/factories/PendlePrincipalToken__factory.ts +14 -1
  301. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  302. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
  303. package/typechain-types/factories/PendleRouter__factory.ts +14 -1
  304. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +14 -1
  305. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
  306. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +14 -1
  307. package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
  308. package/typechain-types/factories/ReentrancyGuardUpgradeable__factory.ts +43 -0
  309. package/typechain-types/factories/RouterStatic__factory.ts +182 -2
  310. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +14 -1
  311. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +14 -1
  312. package/typechain-types/hardhat.d.ts +139 -13
  313. package/typechain-types/index.ts +30 -4
  314. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.dbg.json +0 -4
  315. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.json +0 -1018
  316. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +0 -4
  317. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +0 -76
  318. package/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol +0 -167
  319. package/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol +0 -83
@@ -13,11 +13,10 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
13
13
  using SafeERC20 for IERC20;
14
14
 
15
15
  /// @dev since this contract will be proxied, it must not contains non-immutable variables
16
- constructor(address _kyberSwapRouter)
17
- ActionBaseMintRedeem(_kyberSwapRouter) //solhint-disable-next-line no-empty-blocks
16
+ constructor(address _kyberScalingLib, address _bulkSellerDirectory)
17
+ ActionBaseMintRedeem(_kyberScalingLib, _bulkSellerDirectory) //solhint-disable-next-line no-empty-blocks
18
18
  {}
19
19
 
20
- /// @dev refer to the internal function
21
20
  function mintSyFromToken(
22
21
  address receiver,
23
22
  address SY,
@@ -25,11 +24,9 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
25
24
  TokenInput calldata input
26
25
  ) external payable returns (uint256 netSyOut) {
27
26
  netSyOut = _mintSyFromToken(receiver, SY, minSyOut, input);
28
-
29
27
  emit MintSyFromToken(msg.sender, receiver, SY, input.tokenIn, input.netTokenIn, netSyOut);
30
28
  }
31
29
 
32
- /// @dev refer to the internal function
33
30
  function redeemSyToToken(
34
31
  address receiver,
35
32
  address SY,
@@ -40,25 +37,31 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
40
37
  emit RedeemSyToToken(msg.sender, receiver, SY, netSyIn, output.tokenOut, netTokenOut);
41
38
  }
42
39
 
43
- /// @dev refer to the internal function
44
40
  function mintPyFromToken(
45
41
  address receiver,
46
42
  address YT,
47
43
  uint256 minPyOut,
48
44
  TokenInput calldata input
49
45
  ) external payable returns (uint256 netPyOut) {
50
- netPyOut = _mintPyFromToken(receiver, YT, minPyOut, input);
46
+ address SY = IPYieldToken(YT).SY();
47
+
48
+ uint256 netSyToMint = _mintSyFromToken(YT, SY, 0, input);
49
+ netPyOut = _mintPyFromSy(receiver, YT, minPyOut, netSyToMint, false);
50
+
51
51
  emit MintPyFromToken(msg.sender, receiver, YT, input.tokenIn, input.netTokenIn, netPyOut);
52
52
  }
53
53
 
54
- /// @dev refer to the internal function
55
54
  function redeemPyToToken(
56
55
  address receiver,
57
56
  address YT,
58
57
  uint256 netPyIn,
59
58
  TokenOutput calldata output
60
59
  ) external returns (uint256 netTokenOut) {
61
- netTokenOut = _redeemPyToToken(receiver, YT, netPyIn, output, true);
60
+ address SY = IPYieldToken(YT).SY();
61
+
62
+ uint256 netSyToRedeem = _redeemPyToSy(_syOrBulk(SY, output), YT, netPyIn, 1, true);
63
+ netTokenOut = _redeemSyToToken(receiver, SY, netSyToRedeem, output, false);
64
+
62
65
  emit RedeemPyToToken(msg.sender, receiver, YT, netPyIn, output.tokenOut, netTokenOut);
63
66
  }
64
67
 
@@ -187,7 +190,7 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
187
190
  tokensOut.amounts[i]
188
191
  );
189
192
  }
190
- _redeemAllSys(sysOut, dataYT.tokenRedeemSys, tokensOut);
193
+ _redeemAllSys(sysOut, dataYT.useBulks, dataYT.tokenRedeemSys, tokensOut);
191
194
 
192
195
  // now swap all to outputToken
193
196
  netTokenOut = _swapAllToOutputToken(tokensOut, dataSwap);
@@ -218,18 +221,19 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
218
221
  /// @dev pull SYs from users & redeem them, then add to tokensOut
219
222
  function _redeemAllSys(
220
223
  RouterTokenAmounts memory sys,
224
+ bool[] calldata useBulks,
221
225
  address[] calldata tokenRedeemSys,
222
226
  RouterTokenAmounts memory tokensOut
223
227
  ) internal {
224
228
  for (uint256 i = 0; i < sys.tokens.length; ++i) {
225
229
  if (sys.amounts[i] == 0) continue;
226
230
 
227
- IERC20(sys.tokens[i]).safeTransferFrom(msg.sender, sys.tokens[i], sys.amounts[i]);
228
- uint256 amountOut = IStandardizedYield(sys.tokens[i]).redeem(
231
+ TokenOutput memory output = _wrapTokenOutput(tokenRedeemSys[i], 1, useBulks[i]);
232
+ uint256 amountOut = _redeemSyToToken(
229
233
  address(this),
234
+ sys.tokens[i],
230
235
  sys.amounts[i],
231
- tokenRedeemSys[i],
232
- 1,
236
+ output,
233
237
  true
234
238
  );
235
239
 
@@ -243,7 +247,7 @@ contract ActionMintRedeem is IPActionMintRedeem, ActionBaseMintRedeem {
243
247
  ) internal returns (uint256 netTokenOut) {
244
248
  for (uint256 i = 0; i < tokens.tokens.length; ++i) {
245
249
  if (tokens.amounts[i] == 0) continue;
246
- _kyberswap(tokens.tokens[i], tokens.amounts[i], dataSwap.kybercalls[i]);
250
+ _kyberswap(tokens.tokens[i], tokens.amounts[i], dataSwap.kyberRouter, dataSwap.kybercalls[i]);
247
251
  }
248
252
  netTokenOut = _selfBalance(dataSwap.outputToken);
249
253
  _transferOut(dataSwap.outputToken, msg.sender, netTokenOut);
@@ -16,8 +16,8 @@ contract ActionSwapPT is IPActionSwapPT, ActionBaseMintRedeem {
16
16
  using PYIndexLib for IPYieldToken;
17
17
 
18
18
  /// @dev since this contract will be proxied, it must not contains non-immutable variables
19
- constructor(address _kyberSwapRouter)
20
- ActionBaseMintRedeem(_kyberSwapRouter) //solhint-disable-next-line no-empty-blocks
19
+ constructor(address _kyberScalingLib, address _bulkSellerDirectory)
20
+ ActionBaseMintRedeem(_kyberScalingLib, _bulkSellerDirectory) //solhint-disable-next-line no-empty-blocks
21
21
  {}
22
22
 
23
23
  function swapExactPtForSy(
@@ -168,7 +168,7 @@ contract ActionSwapPT is IPActionSwapPT, ActionBaseMintRedeem {
168
168
  // all output SY is directly transferred to the SY contract
169
169
  uint256 netSyReceived;
170
170
  (netSyReceived, netSyFee) = IPMarket(market).swapExactPtForSy(
171
- address(SY),
171
+ _syOrBulk(address(SY), output),
172
172
  exactPtIn,
173
173
  EMPTY_BYTES
174
174
  );
@@ -18,8 +18,8 @@ contract ActionSwapYT is IPActionSwapYT, ActionBaseMintRedeem, CallbackHelper {
18
18
  using PYIndexLib for IPYieldToken;
19
19
 
20
20
  /// @dev since this contract will be proxied, it must not contains non-immutable variables
21
- constructor(address _kyberSwapRouter)
22
- ActionBaseMintRedeem(_kyberSwapRouter) //solhint-disable-next-line no-empty-blocks
21
+ constructor(address _kyberScalingLib, address _bulkSellerDirectory)
22
+ ActionBaseMintRedeem(_kyberScalingLib, _bulkSellerDirectory) //solhint-disable-next-line no-empty-blocks
23
23
  {}
24
24
 
25
25
  /**
@@ -192,7 +192,14 @@ contract ActionSwapYT is IPActionSwapYT, ActionBaseMintRedeem, CallbackHelper {
192
192
 
193
193
  uint256 netSyOut;
194
194
 
195
- (netSyOut, netSyFee) = _swapExactYtForSy(address(SY), market, SY, YT, netYtIn, 1);
195
+ (netSyOut, netSyFee) = _swapExactYtForSy(
196
+ _syOrBulk(address(SY), output),
197
+ market,
198
+ SY,
199
+ YT,
200
+ netYtIn,
201
+ 1
202
+ );
196
203
 
197
204
  netTokenOut = _redeemSyToToken(receiver, address(SY), netSyOut, output, false);
198
205
 
@@ -247,7 +254,7 @@ contract ActionSwapYT is IPActionSwapYT, ActionBaseMintRedeem, CallbackHelper {
247
254
  address(YT),
248
255
  exactYtIn, // exactPtOut = exactYtIn
249
256
  _encodeSwapYtForSy(receiver, minSyOut)
250
- ); // ignore return
257
+ );
251
258
 
252
259
  netSyOut = SY.balanceOf(receiver) - preSyBalance;
253
260
  }
@@ -5,6 +5,8 @@ import "../kyberswap/KyberSwapHelper.sol";
5
5
  import "../../core/libraries/TokenHelper.sol";
6
6
  import "../../interfaces/IStandardizedYield.sol";
7
7
  import "../../interfaces/IPYieldToken.sol";
8
+ import "../../interfaces/IPBulkSellerFactory.sol";
9
+ import "../../interfaces/IPBulkSeller.sol";
8
10
  import "../../core/libraries/Errors.sol";
9
11
 
10
12
  // solhint-disable no-empty-blocks
@@ -12,13 +14,15 @@ abstract contract ActionBaseMintRedeem is TokenHelper, KyberSwapHelper {
12
14
  using SafeERC20 for IERC20;
13
15
 
14
16
  bytes internal constant EMPTY_BYTES = abi.encode();
17
+ IPBulkSellerFactory public immutable bulkFactory;
15
18
 
16
19
  /// @dev since this contract will be proxied, it must not contains non-immutable variables
17
- constructor(address _kyberSwapRouter) KyberSwapHelper(_kyberSwapRouter) {}
20
+ constructor(address _kyberScalingLib, address _bulkSellerDirectory)
21
+ KyberSwapHelper(_kyberScalingLib)
22
+ {
23
+ bulkFactory = IPBulkSellerFactory(_bulkSellerDirectory);
24
+ }
18
25
 
19
- /**
20
- * @notice swap token to baseToken through Uniswap's forks & use it to mint SY
21
- */
22
26
  function _mintSyFromToken(
23
27
  address receiver,
24
28
  address SY,
@@ -26,104 +30,83 @@ abstract contract ActionBaseMintRedeem is TokenHelper, KyberSwapHelper {
26
30
  TokenInput calldata input
27
31
  ) internal returns (uint256 netSyOut) {
28
32
  _transferIn(input.tokenIn, msg.sender, input.netTokenIn);
29
- if (input.tokenIn != input.tokenMintSy) {
30
- _kyberswap(input.tokenIn, input.netTokenIn, input.kybercall);
31
- }
32
33
 
33
- _safeApproveInf(input.tokenMintSy, SY);
34
+ bool requireSwap = input.tokenIn != input.tokenMintSy;
35
+ if (requireSwap) {
36
+ _kyberswap(input.tokenIn, input.netTokenIn, input.kyberRouter, input.kybercall);
37
+ }
34
38
 
35
39
  uint256 tokenMintSyBal = _selfBalance(input.tokenMintSy);
36
- uint256 nativeAmountToAttach = input.tokenMintSy == NATIVE ? tokenMintSyBal : 0;
37
-
38
- netSyOut = IStandardizedYield(SY).deposit{ value: nativeAmountToAttach }(
39
- receiver,
40
- input.tokenMintSy,
41
- tokenMintSyBal,
42
- minSyOut
43
- );
40
+ if (input.useBulk) {
41
+ address bulk = bulkFactory.get(input.tokenMintSy, SY);
42
+
43
+ _transferOut(input.tokenMintSy, bulk, tokenMintSyBal);
44
+
45
+ netSyOut = IPBulkSeller(bulk).swapExactTokenForSy(receiver, tokenMintSyBal, minSyOut);
46
+ } else {
47
+ uint256 netNative = input.tokenMintSy == NATIVE ? tokenMintSyBal : 0;
48
+
49
+ _safeApproveInf(input.tokenMintSy, SY);
50
+
51
+ netSyOut = IStandardizedYield(SY).deposit{ value: netNative }(
52
+ receiver,
53
+ input.tokenMintSy,
54
+ tokenMintSyBal,
55
+ minSyOut
56
+ );
57
+ }
44
58
  }
45
59
 
46
- /**
47
- * @notice redeem SY to baseToken -> swap baseToken to token through Uniswap's forks
48
- */
49
60
  function _redeemSyToToken(
50
61
  address receiver,
51
62
  address SY,
52
63
  uint256 netSyIn,
53
- TokenOutput calldata output,
64
+ TokenOutput memory output,
54
65
  bool doPull
55
66
  ) internal returns (uint256 netTokenOut) {
56
67
  if (doPull) {
57
- IERC20(SY).safeTransferFrom(msg.sender, SY, netSyIn);
68
+ IERC20(SY).safeTransferFrom(msg.sender, _syOrBulk(SY, output), netSyIn);
58
69
  }
59
70
 
60
- if (output.tokenRedeemSy == output.tokenOut) {
61
- netTokenOut = IStandardizedYield(SY).redeem(
62
- receiver,
71
+ bool requireSwap = output.tokenRedeemSy != output.tokenOut;
72
+ address receiverRedeemSy = requireSwap ? address(this) : receiver;
73
+ uint256 netTokenRedeemed;
74
+
75
+ if (output.useBulk) {
76
+ address bulk = bulkFactory.get(output.tokenRedeemSy, SY);
77
+ netTokenRedeemed = IPBulkSeller(bulk).swapExactSyForToken(
78
+ receiverRedeemSy,
63
79
  netSyIn,
64
- output.tokenRedeemSy,
65
- output.minTokenOut,
66
- true
80
+ 0
67
81
  );
68
82
  } else {
69
- uint256 netTokenRedeemed = IStandardizedYield(SY).redeem(
70
- address(this),
83
+ netTokenRedeemed = IStandardizedYield(SY).redeem(
84
+ receiverRedeemSy,
71
85
  netSyIn,
72
86
  output.tokenRedeemSy,
73
- 1,
87
+ 0,
74
88
  true
75
89
  );
76
- _kyberswap(output.tokenRedeemSy, netTokenRedeemed, output.kybercall);
90
+ }
77
91
 
78
- netTokenOut = _selfBalance(output.tokenOut);
92
+ if (requireSwap) {
93
+ _kyberswap(
94
+ output.tokenRedeemSy,
95
+ netTokenRedeemed,
96
+ output.kyberRouter,
97
+ output.kybercall
98
+ );
79
99
 
80
- if (netTokenOut < output.minTokenOut)
81
- revert Errors.RouterInsufficientTokenOut(netTokenOut, output.minTokenOut);
100
+ netTokenOut = _selfBalance(output.tokenOut);
82
101
 
83
102
  _transferOut(output.tokenOut, receiver, netTokenOut);
103
+ } else {
104
+ netTokenOut = netTokenRedeemed;
84
105
  }
85
- }
86
-
87
- /**
88
- * @notice swap token to baseToken through Uniswap's forks -> convert to SY -> convert to PT + YT
89
- */
90
- function _mintPyFromToken(
91
- address receiver,
92
- address YT,
93
- uint256 minPyOut,
94
- TokenInput calldata input
95
- ) internal returns (uint256 netPyOut) {
96
- address SY = IPYieldToken(YT).SY();
97
-
98
- _mintSyFromToken(YT, SY, 1, input);
99
-
100
- netPyOut = IPYieldToken(YT).mintPY(receiver, receiver);
101
- if (netPyOut < minPyOut) revert Errors.RouterInsufficientPYOut(netPyOut, minPyOut);
102
- }
103
-
104
- /**
105
- * @notice redeem PT + YT to SY -> redeem SY to baseToken -> swap baseToken to token through Uniswap's forks.
106
- If the YT hasn't expired, both PT & YT will be needed to redeem. Else, only PT is needed
107
- */
108
- function _redeemPyToToken(
109
- address receiver,
110
- address YT,
111
- uint256 netPyIn,
112
- TokenOutput calldata output,
113
- bool doPull
114
- ) internal returns (uint256 netTokenOut) {
115
- address PT = IPYieldToken(YT).PT();
116
- address SY = IPYieldToken(YT).SY();
117
106
 
118
- if (doPull) {
119
- bool needToBurnYt = (!IPYieldToken(YT).isExpired());
120
- IERC20(PT).safeTransferFrom(msg.sender, YT, netPyIn);
121
- if (needToBurnYt) IERC20(YT).safeTransferFrom(msg.sender, YT, netPyIn);
107
+ if (netTokenOut < output.minTokenOut) {
108
+ revert Errors.RouterInsufficientTokenOut(netTokenOut, output.minTokenOut);
122
109
  }
123
-
124
- uint256 amountSyOut = IPYieldToken(YT).redeemPY(SY); // ignore return
125
-
126
- netTokenOut = _redeemSyToToken(receiver, SY, amountSyOut, output, false);
127
110
  }
128
111
 
129
112
  function _mintPyFromSy(
@@ -161,4 +144,20 @@ abstract contract ActionBaseMintRedeem is TokenHelper, KyberSwapHelper {
161
144
  netSyOut = IPYieldToken(YT).redeemPY(receiver);
162
145
  if (netSyOut < minSyOut) revert Errors.RouterInsufficientSyOut(netSyOut, minSyOut);
163
146
  }
147
+
148
+ function _syOrBulk(address SY, TokenOutput memory output)
149
+ internal
150
+ view
151
+ returns (address addr)
152
+ {
153
+ return (output.useBulk ? bulkFactory.get(output.tokenRedeemSy, SY) : SY);
154
+ }
155
+
156
+ function _wrapTokenOutput(
157
+ address tokenOut,
158
+ uint256 minTokenOut,
159
+ bool useBulk
160
+ ) internal pure returns (TokenOutput memory) {
161
+ return TokenOutput(tokenOut, minTokenOut, tokenOut, address(0), EMPTY_BYTES, useBulk);
162
+ }
164
163
  }
@@ -3,8 +3,16 @@
3
3
  pragma solidity 0.8.17;
4
4
  import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
5
  import "./IMultihopRouter.sol";
6
+ import "./IAggregatorRouterHelper.sol";
7
+ import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
8
+ import "../../core/libraries/BoringOwnableUpgradeable.sol";
6
9
 
7
- library AggregationRouterHelper {
10
+ contract AggregationRouterHelper is
11
+ IAggregationRouterHelper,
12
+ Initializable,
13
+ UUPSUpgradeable,
14
+ BoringOwnableUpgradeable
15
+ {
8
16
  uint256 private constant _PARTIAL_FILL = 0x01;
9
17
  uint256 private constant _REQUIRES_EXTRA_ETH = 0x02;
10
18
  uint256 private constant _SHOULD_CLAIM = 0x04;
@@ -14,6 +22,14 @@ library AggregationRouterHelper {
14
22
 
15
23
  uint256 private constant SLIPPAGE_RANGE = 10; // over 100
16
24
 
25
+ constructor() initializer {}
26
+
27
+ function initialize() external initializer {
28
+ __BoringOwnable_init();
29
+ }
30
+
31
+ function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
32
+
17
33
  enum DexType {
18
34
  UNI,
19
35
  STABLESWAP,
@@ -0,0 +1,10 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity 0.8.17;
4
+
5
+ interface IAggregationRouterHelper {
6
+ function getScaledInputData(bytes calldata kybercall, uint256 newAmount)
7
+ external
8
+ pure
9
+ returns (bytes memory);
10
+ }
@@ -25,42 +25,51 @@ pragma solidity 0.8.17;
25
25
 
26
26
  import "@openzeppelin/contracts/utils/Address.sol";
27
27
  import "../../core/libraries/TokenHelper.sol";
28
- import "./AggregationRouterHelper.sol";
28
+ import "./IAggregatorRouterHelper.sol";
29
+ import "../../core/libraries/Errors.sol";
29
30
 
30
31
  struct TokenInput {
31
32
  address tokenIn;
32
33
  uint256 netTokenIn;
33
34
  address tokenMintSy;
35
+ address kyberRouter;
34
36
  bytes kybercall;
37
+ bool useBulk;
35
38
  }
36
39
 
37
40
  struct TokenOutput {
38
41
  address tokenOut;
39
42
  uint256 minTokenOut;
40
43
  address tokenRedeemSy;
44
+ address kyberRouter;
41
45
  bytes kybercall;
46
+ bool useBulk;
42
47
  }
43
48
 
44
49
  abstract contract KyberSwapHelper is TokenHelper {
45
50
  using Address for address;
46
- address public immutable kyberSwapRouter;
47
51
 
48
- /// @dev since this contract will be proxied, it must not contains non-immutable variables
49
- constructor(address _kyberSwapRouter) {
50
- kyberSwapRouter = _kyberSwapRouter;
52
+ address public immutable kyberScalingLib;
53
+
54
+ constructor(address _kyberScalingLib) {
55
+ kyberScalingLib = _kyberScalingLib;
51
56
  }
52
57
 
53
58
  function _kyberswap(
54
59
  address tokenIn,
55
60
  uint256 amountIn,
61
+ address kyberRouter,
56
62
  bytes memory rawKybercall
57
63
  ) internal {
58
- _safeApproveInf(tokenIn, kyberSwapRouter);
64
+ if (kyberRouter == address(0) || rawKybercall.length == 0) {
65
+ revert Errors.RouterKyberSwapDataZero();
66
+ }
67
+ _safeApproveInf(tokenIn, kyberRouter);
59
68
 
60
- bytes memory kybercall = AggregationRouterHelper.getScaledInputData(
69
+ bytes memory kybercall = IAggregationRouterHelper(kyberScalingLib).getScaledInputData(
61
70
  rawKybercall,
62
71
  amountIn
63
72
  );
64
- kyberSwapRouter.functionCallWithValue(kybercall, tokenIn == NATIVE ? amountIn : 0);
73
+ kyberRouter.functionCallWithValue(kybercall, tokenIn == NATIVE ? amountIn : 0);
65
74
  }
66
75
  }
@@ -7,8 +7,9 @@
7
7
  "PENDLE": "0xB7609dec1C926204c3B67345cbCd54bc4aa7a940",
8
8
  "yieldContractFactory": "0xC39Efc7bb273B75B75471167Cb0EB4D3D41398a8",
9
9
  "marketFactory": "0xa28B2445C8e1751733e75e6794971AEEA4806F45",
10
- "router": "0x37e0018919832abC3EDfbfE700df5bb15ed0682D",
11
- "routerStatic": "0xFE1129fFa39A2660f5A99eF96343F06D472f781B",
10
+ "bulkSellerFactory": "0x9f45D5A34CC9Bcb3AB4ee464bE768E30B5e627f8",
11
+ "router": "0x129be7922B733b0F06cb4f0f47B6b4a12710a312",
12
+ "routerStatic": "0x699665c3fA37FF59cACd913EAaB56CEFA66C339E",
12
13
  "vePendle": "0x74E578b27aD53f23387b9Dcb7902F7Def6D4dB7c",
13
14
  "senderEndpoint": "0xa87c479d77040d1c5433b9cD3b88b2B562A7cb10",
14
15
  "votingController": "0x0b24c845feF83f8403EEF3922F3B53a05182512A",
@@ -0,0 +1,9 @@
1
+ {
2
+ "symbol": "SY-qiAVAX",
3
+ "SY": "0x7bd149FFD976F366af864B2F9585016FD0386A3F",
4
+ "expiry": 1675382400,
5
+ "PT": "0x9156bf2494F7DaaBAE2Ec919513217Dc9a2535aD",
6
+ "YT": "0x12CBF941d14823160e606BdaA7eA4f351251A9cF",
7
+ "market": "0x94f1997DA3ea57875ab97747d2bF744c6895A0AD",
8
+ "bulkSeller": "0xc64c1A2DCbA6bB38DA23a4C2b9Ca76005508719A"
9
+ }
@@ -7,8 +7,9 @@
7
7
  "PENDLE": "0x5FDA5b3b05B2884F9f028550069B9D321E84814A",
8
8
  "yieldContractFactory": "0x8B3C5BD39E6B82272eCf0d6828D458536dc44dea",
9
9
  "marketFactory": "0xf963474FAe462B06B026DE500f605B3578B66c66",
10
- "router": "0x7cD7cc0990A0F61532410fE11f884f2caD7e59D3",
11
- "routerStatic": "0xc9132D222e681c86A522120B41585B87992D61b9",
10
+ "bulkSellerFactory": "0xcdFfe971e3dE61f94450C56e140E3b2E0d7597CF",
11
+ "router": "0x60e5F58005b326ecA0cf9c96528781567973d7B0",
12
+ "routerStatic": "0xf159EC6647659eD86a67eb0B1131595c2EE086c2",
12
13
  "receiverEndpoint": "0x57D55237374b0D1AFdac5E25F16A4EE5C57A627c",
13
14
  "vePendle": "0x89Cec94a14FAB1cb27C1A5cd32af05ef448d9829",
14
15
  "gaugeController": "0x8a6c59A80aA3Bbf32E7b3F0C359Eb528Cf6f7288"
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": "0.16.2-testnet",
5
+ "version": "0.16.3-testnet",
6
6
  "homepage": "https://pendle.finance",
7
7
  "keywords": [
8
8
  "pendle",
@@ -44,6 +44,7 @@
44
44
  },
45
45
  "packageManager": "yarn@3.2.2",
46
46
  "dependencies": {
47
- "@openzeppelin/contracts": "^4.7.3"
47
+ "@openzeppelin/contracts": "^4.7.3",
48
+ "@openzeppelin/contracts-upgradeable": "^4.7.3"
48
49
  }
49
50
  }