@pendle/core-v2 0.15.2-mainnet → 0.16.0-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 (420) 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 +48 -110
  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 +21 -75
  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 +0 -39
  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 +2 -15
  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 +2 -15
  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 +0 -13
  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 +2 -15
  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 +2 -15
  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 +2 -46
  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 +8 -52
  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 +2 -15
  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/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  35. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  36. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  38. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  40. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  41. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  42. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +17 -77
  43. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  44. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
  46. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
  47. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  49. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  51. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
  53. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.dbg.json +4 -0
  54. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.json +1018 -0
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +4 -0
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/{base → ConvexCurveLP}/PendleConvexLPSY.sol/PendleConvexLPSY.json +1 -1
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +76 -0
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStaking.sol/PendleLooksStaking.dbg.json +4 -0
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/{PendleLooksStakingSY.sol/PendleLooksStakingSY.json → PendleLooksStaking.sol/PendleLooksStaking.json} +4 -4
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
  63. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  64. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  65. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -15
  66. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  67. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +4 -85
  68. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  69. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +4 -17
  70. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  71. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +2 -2
  72. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  73. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
  74. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
  75. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +38 -3
  76. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
  77. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.json +2 -2
  78. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  79. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.json +0 -13
  80. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  81. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
  82. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  83. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +35 -319
  84. package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  85. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
  86. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.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 +85 -39
  89. package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
  90. package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +4 -0
  91. package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.json +53 -0
  92. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +4 -0
  93. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.json +45 -0
  94. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
  95. package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.json +0 -7
  98. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +17 -91
  100. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +0 -50
  102. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +0 -20
  104. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  105. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  106. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +0 -20
  107. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  108. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +17 -181
  109. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  110. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +2 -2
  112. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +2 -12
  114. package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.json +1 -1
  119. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  120. package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
  121. package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
  122. package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
  123. package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
  124. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
  125. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +0 -45
  126. package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
  127. package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
  128. package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
  129. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  130. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -15
  131. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  132. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +80 -2
  133. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  134. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +60 -299
  135. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  136. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +41 -118
  137. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  138. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  139. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  140. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +24 -61
  141. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  142. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  143. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  144. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +24 -31
  145. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  146. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
  147. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  148. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +24 -31
  149. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  150. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -15
  151. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  152. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.json +1 -1
  153. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  154. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  155. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  156. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  157. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  158. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -191
  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/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -1
  162. package/contracts/core/Market/PendleMarket.sol +7 -18
  163. package/contracts/core/Market/PendleMarketFactory.sol +5 -15
  164. package/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol +167 -0
  165. package/contracts/core/StandardizedYield/implementations/Convex/{base → ConvexCurveLP}/PendleConvexLPSY.sol +4 -2
  166. package/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol +83 -0
  167. package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +4 -19
  168. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
  169. package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +7 -21
  170. package/contracts/core/YieldContracts/PendleYieldToken.sol +21 -54
  171. package/contracts/core/erc20/PendleERC20.sol +7 -4
  172. package/contracts/core/libraries/BaseSplitCodeFactory.sol +1 -1
  173. package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
  174. package/contracts/core/libraries/Errors.sol +2 -28
  175. package/contracts/core/libraries/TokenHelper.sol +0 -9
  176. package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -1
  177. package/contracts/interfaces/Curve/ICrvPool.sol +31 -12
  178. package/contracts/interfaces/IPActionAddRemoveLiq.sol +5 -3
  179. package/contracts/interfaces/IPActionMintRedeem.sol +0 -2
  180. package/contracts/interfaces/IPMarketFactory.sol +1 -1
  181. package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
  182. package/contracts/interfaces/IStETH.sol +0 -6
  183. package/contracts/interfaces/IStandardizedYield.sol +10 -15
  184. package/contracts/offchain-helpers/ImplicitSwapfeeContract.sol +30 -0
  185. package/contracts/offchain-helpers/MarketMathStatic.sol +173 -0
  186. package/contracts/offchain-helpers/RouterStatic.sol +50 -189
  187. package/contracts/router/ActionAddRemoveLiq.sol +52 -71
  188. package/contracts/router/ActionCallback.sol +8 -4
  189. package/contracts/router/ActionMintRedeem.sol +18 -27
  190. package/contracts/router/ActionSwapPT.sol +9 -8
  191. package/contracts/router/ActionSwapPTYT.sol +7 -3
  192. package/contracts/router/ActionSwapYT.sol +10 -15
  193. package/contracts/router/PendleRouter.sol +0 -3
  194. package/contracts/router/base/ActionBaseMintRedeem.sol +83 -78
  195. package/contracts/router/base/MarketApproxLib.sol +1 -1
  196. package/contracts/router/kyberswap/AggregationRouterHelper.sol +1 -17
  197. package/contracts/router/kyberswap/KyberSwapHelper.sol +8 -21
  198. package/deployments/43113-core.json +16 -0
  199. package/deployments/43113-helper.json +3 -0
  200. package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
  201. package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
  202. package/deployments/43113-testenv.json +22 -0
  203. package/deployments/80001-core.json +15 -0
  204. package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
  205. package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
  206. package/deployments/80001-testenv.json +22 -0
  207. package/package.json +2 -3
  208. package/typechain-types/ActionAddRemoveLiq.ts +52 -64
  209. package/typechain-types/ActionBaseMintRedeem.ts +8 -8
  210. package/typechain-types/ActionMintRedeem.ts +16 -48
  211. package/typechain-types/ActionSwapPT.ts +12 -34
  212. package/typechain-types/ActionSwapYT.ts +12 -34
  213. package/typechain-types/AggregationRouterHelper.ts +3 -287
  214. package/typechain-types/BaseSplitCodeFactoryContract.ts +0 -9
  215. package/typechain-types/BoringOwnableUpgradeable.ts +0 -9
  216. package/typechain-types/IBooster.ts +3 -9
  217. package/typechain-types/ICrvPool.ts +172 -69
  218. package/typechain-types/ILooksStaking.ts +0 -27
  219. package/typechain-types/IPActionAddRemoveLiq.ts +44 -56
  220. package/typechain-types/IPActionMintRedeem.ts +8 -40
  221. package/typechain-types/IPActionSwapPT.ts +4 -26
  222. package/typechain-types/IPActionSwapYT.ts +4 -26
  223. package/typechain-types/IPAllAction.ts +54 -76
  224. package/typechain-types/IPMarketFactory.ts +2 -2
  225. package/typechain-types/IPMsgSendEndpoint.ts +14 -24
  226. package/typechain-types/IPYieldContractFactory.ts +3 -3
  227. package/typechain-types/IStETH.ts +0 -56
  228. package/typechain-types/ImplicitSwapfeeContract.ts +17 -9
  229. package/typechain-types/KyberSwapHelper.ts +8 -8
  230. package/typechain-types/MarketMathStatic.ts +117 -0
  231. package/typechain-types/PendleFeeDistributor.ts +0 -9
  232. package/typechain-types/PendleFeeDistributorFactory.ts +0 -9
  233. package/typechain-types/PendleGaugeControllerBaseUpg.ts +0 -9
  234. package/typechain-types/PendleGaugeControllerMainchainUpg.ts +0 -9
  235. package/typechain-types/PendleGaugeControllerSidechainUpg.ts +0 -9
  236. package/typechain-types/PendleMarketFactory.ts +2 -51
  237. package/typechain-types/PendleMsgReceiveEndpointUpg.ts +68 -135
  238. package/typechain-types/PendleMsgSendEndpointUpg.ts +39 -108
  239. package/typechain-types/PendleMsgSenderAppUpg.ts +0 -64
  240. package/typechain-types/PendlePrincipalToken.ts +0 -9
  241. package/typechain-types/PendleRouter.ts +0 -9
  242. package/typechain-types/PendleVotingControllerUpg.ts +0 -64
  243. package/typechain-types/PendleYieldContractFactory.ts +8 -57
  244. package/typechain-types/PendleYieldToken.ts +0 -21
  245. package/typechain-types/RouterStatic.ts +20 -302
  246. package/typechain-types/VotingEscrowPendleMainchain.ts +6 -70
  247. package/typechain-types/VotingEscrowPendleSidechain.ts +0 -9
  248. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +59 -122
  249. package/typechain-types/factories/ActionBaseMintRedeem__factory.ts +1 -1
  250. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  251. package/typechain-types/factories/ActionMintRedeem__factory.ts +42 -65
  252. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  253. package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
  254. package/typechain-types/factories/ActionSwapPT__factory.ts +42 -35
  255. package/typechain-types/factories/ActionSwapYT__factory.ts +42 -35
  256. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -190
  257. package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -14
  258. package/typechain-types/factories/BaseSplitCodeFactory__factory.ts +1 -1
  259. package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
  260. package/typechain-types/factories/BoringOwnableUpgradeable__factory.ts +0 -13
  261. package/typechain-types/factories/ERC20__factory.ts +1 -1
  262. package/typechain-types/factories/Errors__factory.ts +34 -318
  263. package/typechain-types/factories/IBooster__factory.ts +1 -1
  264. package/typechain-types/factories/ICrvPool__factory.ts +85 -39
  265. package/typechain-types/factories/ILooksStaking__factory.ts +0 -7
  266. package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +17 -91
  267. package/typechain-types/factories/IPActionMintRedeem__factory.ts +0 -50
  268. package/typechain-types/factories/IPActionSwapPT__factory.ts +0 -20
  269. package/typechain-types/factories/IPActionSwapYT__factory.ts +0 -20
  270. package/typechain-types/factories/IPAllAction__factory.ts +17 -181
  271. package/typechain-types/factories/IPMarketFactory__factory.ts +2 -2
  272. package/typechain-types/factories/IPMsgSendEndpoint__factory.ts +2 -12
  273. package/typechain-types/factories/IPYieldContractFactory__factory.ts +1 -1
  274. package/typechain-types/factories/IStETH__factory.ts +0 -45
  275. package/typechain-types/factories/ImplicitSwapfeeContract__factory.ts +12 -4
  276. package/typechain-types/factories/KyberSwapHelper__factory.ts +1 -1
  277. package/typechain-types/factories/MarketMathStatic__factory.ts +79 -1
  278. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  279. package/typechain-types/factories/Pendle3CrvAndTokenSY__factory.ts +1 -1
  280. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  281. package/typechain-types/factories/PendleERC20__factory.ts +1 -1
  282. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -14
  283. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -14
  284. package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +0 -13
  285. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -14
  286. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -14
  287. package/typechain-types/factories/PendleMarketFactory__factory.ts +16 -76
  288. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  289. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +51 -113
  290. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +23 -84
  291. package/typechain-types/factories/PendleMsgSenderAppUpg__factory.ts +0 -39
  292. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -14
  293. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  294. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
  295. package/typechain-types/factories/PendleRouter__factory.ts +1 -14
  296. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +2 -57
  297. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
  298. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +3 -84
  299. package/typechain-types/factories/PendleYieldToken__factory.ts +3 -16
  300. package/typechain-types/factories/RouterStatic__factory.ts +1 -244
  301. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +8 -63
  302. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -14
  303. package/typechain-types/hardhat.d.ts +39 -219
  304. package/typechain-types/index.ts +12 -48
  305. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +0 -4
  306. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.json +0 -10
  307. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +0 -4
  308. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +0 -10
  309. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +0 -4
  310. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +0 -699
  311. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +0 -4
  312. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +0 -515
  313. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +0 -4
  314. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +0 -10
  315. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +0 -4
  316. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +0 -1003
  317. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +0 -4
  318. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +0 -1068
  319. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +0 -4
  320. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +0 -10
  321. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +0 -4
  322. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +0 -10
  323. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +0 -4
  324. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +0 -10
  325. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +0 -4
  326. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +0 -4
  327. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +0 -4
  328. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.json +0 -213
  329. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +0 -4
  330. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.json +0 -119
  331. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +0 -4
  332. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.json +0 -39
  333. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +0 -4
  334. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +0 -173
  335. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +0 -4
  336. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +0 -86
  337. package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.dbg.json +0 -4
  338. package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.json +0 -34
  339. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +0 -4
  340. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +0 -35
  341. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +0 -4
  342. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.json +0 -35
  343. package/contracts/core/BulkSeller/BulkSeller.sol +0 -259
  344. package/contracts/core/BulkSeller/BulkSellerFactory.sol +0 -88
  345. package/contracts/core/BulkSeller/BulkSellerMathCore.sol +0 -143
  346. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol +0 -102
  347. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol +0 -160
  348. package/contracts/core/StandardizedYield/implementations/Convex/README.md +0 -29
  349. package/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol +0 -215
  350. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +0 -127
  351. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +0 -152
  352. package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +0 -122
  353. package/contracts/interfaces/Curve/ITriCrvPool.sol +0 -41
  354. package/contracts/interfaces/ILooksFeeSharing.sol +0 -5
  355. package/contracts/interfaces/ILooksStaking.sol +0 -13
  356. package/contracts/interfaces/IPBulkSeller.sol +0 -28
  357. package/contracts/interfaces/IPBulkSellerFactory.sol +0 -12
  358. package/contracts/interfaces/IPBulkSellerSYCallback.sol +0 -10
  359. package/contracts/offchain-helpers/BulkSellerOffchain.sol +0 -43
  360. package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +0 -10
  361. package/deployments/1-core.json +0 -16
  362. package/deployments/1-markets/FRAX_30_MAR_23.json +0 -8
  363. package/deployments/1-markets/LOOKS_30_MAR_23.json +0 -8
  364. package/deployments/1-markets/STETH_MARCH_30.json +0 -8
  365. package/deployments/1-markets/USDD_MARCH_30.json +0 -8
  366. package/deployments/1-offchain-helper.json +0 -3
  367. package/typechain-types/AccessControl.ts +0 -360
  368. package/typechain-types/AccessControlUpgradeable.ts +0 -369
  369. package/typechain-types/BeaconProxy.ts +0 -97
  370. package/typechain-types/BulkSeller.ts +0 -777
  371. package/typechain-types/BulkSellerFactory.ts +0 -707
  372. package/typechain-types/BulkSellerOffchain.ts +0 -117
  373. package/typechain-types/ContextUpgradeable.ts +0 -68
  374. package/typechain-types/Curve3CrvPoolHelper.ts +0 -236
  375. package/typechain-types/CurveFraxUsdcPoolHelper.ts +0 -158
  376. package/typechain-types/CurveUsdd3CrvPoolHelper.ts +0 -184
  377. package/typechain-types/ERC165.ts +0 -102
  378. package/typechain-types/ERC165Upgradeable.ts +0 -113
  379. package/typechain-types/IAccessControl.ts +0 -305
  380. package/typechain-types/IAccessControlUpgradeable.ts +0 -305
  381. package/typechain-types/IAggregationRouterHelper.ts +0 -108
  382. package/typechain-types/IERC165.ts +0 -102
  383. package/typechain-types/IERC165Upgradeable.ts +0 -102
  384. package/typechain-types/IPBulkSeller.ts +0 -290
  385. package/typechain-types/IPBulkSellerCallback.ts +0 -115
  386. package/typechain-types/IPBulkSellerFactory.ts +0 -147
  387. package/typechain-types/ITriCrvPool.ts +0 -345
  388. package/typechain-types/Initializable.ts +0 -68
  389. package/typechain-types/PendleConvex2TokensSY.ts +0 -1215
  390. package/typechain-types/PendleCurveFraxUsdcSY.ts +0 -1228
  391. package/typechain-types/PendleCurveUsdd3CrvSY.ts +0 -1299
  392. package/typechain-types/PendleLooksStakingSY.ts +0 -1052
  393. package/typechain-types/ReentrancyGuardUpgradeable.ts +0 -68
  394. package/typechain-types/factories/AccessControlUpgradeable__factory.ts +0 -247
  395. package/typechain-types/factories/AccessControl__factory.ts +0 -227
  396. package/typechain-types/factories/BeaconProxy__factory.ts +0 -141
  397. package/typechain-types/factories/BulkSellerFactory__factory.ts +0 -568
  398. package/typechain-types/factories/BulkSellerOffchain__factory.ts +0 -88
  399. package/typechain-types/factories/BulkSeller__factory.ts +0 -749
  400. package/typechain-types/factories/ContextUpgradeable__factory.ts +0 -39
  401. package/typechain-types/factories/Curve3CrvPoolHelper__factory.ts +0 -220
  402. package/typechain-types/factories/CurveFraxUsdcPoolHelper__factory.ts +0 -146
  403. package/typechain-types/factories/CurveUsdd3CrvPoolHelper__factory.ts +0 -172
  404. package/typechain-types/factories/ERC165Upgradeable__factory.ts +0 -58
  405. package/typechain-types/factories/ERC165__factory.ts +0 -39
  406. package/typechain-types/factories/IAccessControlUpgradeable__factory.ts +0 -202
  407. package/typechain-types/factories/IAccessControl__factory.ts +0 -198
  408. package/typechain-types/factories/IAggregationRouterHelper__factory.ts +0 -54
  409. package/typechain-types/factories/IERC165Upgradeable__factory.ts +0 -45
  410. package/typechain-types/factories/IERC165__factory.ts +0 -42
  411. package/typechain-types/factories/IPBulkSellerCallback__factory.ts +0 -53
  412. package/typechain-types/factories/IPBulkSellerFactory__factory.ts +0 -101
  413. package/typechain-types/factories/IPBulkSeller__factory.ts +0 -185
  414. package/typechain-types/factories/ITriCrvPool__factory.ts +0 -225
  415. package/typechain-types/factories/Initializable__factory.ts +0 -36
  416. package/typechain-types/factories/PendleConvex2TokensSY__factory.ts +0 -1093
  417. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +0 -1068
  418. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +0 -1133
  419. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +0 -937
  420. package/typechain-types/factories/ReentrancyGuardUpgradeable__factory.ts +0 -43
@@ -4,20 +4,6 @@ pragma solidity 0.8.17;
4
4
  /// Adapted from UniswapV3's Oracle
5
5
 
6
6
  library Errors {
7
- // BulkSeller
8
- error BulkInsufficientSyForTrade(uint256 currentAmount, uint256 requiredAmount);
9
- error BulkInsufficientTokenForTrade(uint256 currentAmount, uint256 requiredAmount);
10
- error BulkInSufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut);
11
- error BulkInSufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);
12
- error BulkInsufficientTokenReceived(uint256 actualBalance, uint256 requiredBalance);
13
- error BulkInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance);
14
- error BulkNotMaintainer();
15
- error BulkNotAdmin();
16
- error BulkSellerAlreadyExisted(address token, address SY, address bulk);
17
- error BulkSellerInvalidToken(address token, address SY);
18
- error BulkBadRateTokenToSy(uint256 actualRate, uint256 currentRate, uint256 eps);
19
- error BulkBadRateSyToToken(uint256 actualRate, uint256 currentRate, uint256 eps);
20
-
21
7
  // APPROX
22
8
  error ApproxFail();
23
9
  error ApproxParamsInvalid(uint256 guessMin, uint256 guessMax, uint256 eps);
@@ -45,13 +31,8 @@ library Errors {
45
31
  error MarketFactoryInvalidPt();
46
32
  error MarketFactoryMarketExists();
47
33
 
48
- error MarketFactoryLnFeeRateRootTooHigh(uint88 lnFeeRateRoot, uint256 maxLnFeeRateRoot);
49
- error MarketFactoryReserveFeePercentTooHigh(
50
- uint8 reserveFeePercent,
51
- uint8 maxReserveFeePercent
52
- );
53
- error MarketFactoryZeroTreasury();
54
- error MarketFactoryInitialAnchorTooLow(int256 initialAnchor, int256 minInitialAnchor);
34
+ error MFactoryLnFeeRateRootTooHigh(uint88 lnFeeRateRoot, uint256 maxLnFeeRateRoot);
35
+ error MFactoryReserveFeePercentTooHigh(uint8 reserveFeePercent, uint8 maxReserveFeePercent);
55
36
 
56
37
  // ROUTER
57
38
  error RouterInsufficientLpOut(uint256 actualLpOut, uint256 requiredLpOut);
@@ -65,14 +46,11 @@ library Errors {
65
46
  error RouterExceededLimitYtIn(uint256 actualYtIn, uint256 limitYtIn);
66
47
  error RouterInsufficientSyRepay(uint256 actualSyRepay, uint256 requiredSyRepay);
67
48
  error RouterInsufficientPtRepay(uint256 actualPtRepay, uint256 requiredPtRepay);
68
- error RouterNotAllSyUsed(uint256 netSyDesired, uint256 netSyUsed);
69
49
 
70
50
  error RouterTimeRangeZero();
71
51
  error RouterCallbackNotPendleMarket(address caller);
72
52
  error RouterInvalidAction(bytes4 selector);
73
53
 
74
- error RouterKyberSwapDataZero();
75
-
76
54
  // YIELD CONTRACT
77
55
  error YCExpired();
78
56
  error YCNotExpired();
@@ -84,10 +62,6 @@ library Errors {
84
62
  // YieldFactory
85
63
  error YCFactoryInvalidExpiry();
86
64
  error YCFactoryYieldContractExisted();
87
- error YCFactoryZeroExpiryDivisor();
88
- error YCFactoryZeroTreasury();
89
- error YCFactoryInterestFeeRateTooHigh(uint256 interestFeeRate, uint256 maxInterestFeeRate);
90
- error YCFactoryRewardFeeRateTooHigh(uint256 newRewardFeeRate, uint256 maxRewardFeeRate);
91
65
 
92
66
  // SY
93
67
  error SYInvalidTokenIn(address token);
@@ -17,15 +17,6 @@ abstract contract TokenHelper {
17
17
  else if (amount != 0) IERC20(token).safeTransferFrom(from, address(this), amount);
18
18
  }
19
19
 
20
- function _transferFrom(
21
- IERC20 token,
22
- address from,
23
- address to,
24
- uint256 amount
25
- ) internal {
26
- if (amount != 0) token.safeTransferFrom(from, to, amount);
27
- }
28
-
29
20
  function _transferOut(
30
21
  address token,
31
22
  address to,
@@ -10,7 +10,7 @@ interface IBooster {
10
10
  external
11
11
  view
12
12
  returns (
13
- address lpToken,
13
+ address,
14
14
  address,
15
15
  address,
16
16
  address,
@@ -6,12 +6,6 @@ interface ICrvPool {
6
6
 
7
7
  function get_virtual_price() external view returns (uint256);
8
8
 
9
- function lp_token() external view returns (address);
10
-
11
- function fee() external view returns (uint256);
12
-
13
- function admin_fee() external view returns (uint256);
14
-
15
9
  function get_dy(
16
10
  int128 i,
17
11
  int128 j,
@@ -22,31 +16,56 @@ interface ICrvPool {
22
16
  int128 i,
23
17
  int128 j,
24
18
  uint256 dx,
25
- uint256 min_dy // The amount of i being exchanged.
19
+ uint256 min_dy, // The amount of i being exchanged.
20
+ address _receiver
21
+ ) external returns (uint256);
22
+
23
+ function add_liquidity(
24
+ uint256[] memory _deposit_amount,
25
+ uint256 _min_amount,
26
+ address _receiver
26
27
  ) external returns (uint256);
27
28
 
28
29
  function add_liquidity(
29
30
  uint256[2] memory _deposit_amount,
30
31
  uint256 _min_amount
31
- ) external returns (uint256 lpOut);
32
+ ) external;
33
+
34
+ function add_liquidity(
35
+ uint256[3] memory _deposit_amount,
36
+ uint256 _min_amount
37
+ ) external;
38
+
39
+ function remove_liquidity(
40
+ uint256 _burn_amount,
41
+ uint256[] memory _min_amounts,
42
+ address _receiver
43
+ ) external returns (uint256[] memory);
32
44
 
33
45
  function remove_liquidity_one_coin(
34
46
  uint256 _burn_amount,
35
47
  int128 i,
36
48
  uint256 _min_amount
37
- ) external returns (uint256 tokenOut);
49
+ ) external;
50
+
51
+ function calc_token_amount(uint256[] memory _amounts, bool _is_deposit)
52
+ external
53
+ view
54
+ returns (uint256);
38
55
 
39
56
  function calc_token_amount(uint256[2] memory _amounts, bool _is_deposit)
40
57
  external
41
58
  view
42
59
  returns (uint256);
43
60
 
44
- function calc_withdraw_one_coin(uint256 _burn_amount, int128 i)
61
+ function calc_token_amount(uint256[3] memory _amounts, bool _is_deposit)
45
62
  external
46
63
  view
47
64
  returns (uint256);
48
65
 
49
- function balances(uint256 i) external view returns (uint256);
50
66
 
51
- function A_precise() external view returns (uint256);
67
+ function calc_withdraw_one_coin(uint256 _burn_amount, int128 i)
68
+ external
69
+ view
70
+ returns (uint256);
52
71
  }
@@ -19,7 +19,7 @@ interface IPActionAddRemoveLiq {
19
19
  address indexed market,
20
20
  address indexed receiver,
21
21
  address tokenIn,
22
- uint256 netTokenUsed,
22
+ uint256 tokenUsed,
23
23
  uint256 netPtUsed,
24
24
  uint256 netLpOut
25
25
  );
@@ -110,7 +110,8 @@ interface IPActionAddRemoveLiq {
110
110
  function addLiquidityDualTokenAndPt(
111
111
  address receiver,
112
112
  address market,
113
- TokenInput calldata input,
113
+ address tokenIn,
114
+ uint256 netTokenDesired,
114
115
  uint256 netPtDesired,
115
116
  uint256 minLpOut
116
117
  )
@@ -158,7 +159,8 @@ interface IPActionAddRemoveLiq {
158
159
  address receiver,
159
160
  address market,
160
161
  uint256 netLpToRemove,
161
- TokenOutput calldata output,
162
+ address tokenOut,
163
+ uint256 minTokenOut,
162
164
  uint256 minPtOut
163
165
  ) external returns (uint256 netTokenOut, uint256 netPtOut);
164
166
 
@@ -138,7 +138,6 @@ interface IPActionMintRedeem {
138
138
  // key-value pair
139
139
  address[] syAddrs;
140
140
  address[] tokenRedeemSys;
141
- address[] bulks;
142
141
  //
143
142
  }
144
143
 
@@ -147,7 +146,6 @@ interface IPActionMintRedeem {
147
146
  address[] tokens;
148
147
  bytes[] kybercalls;
149
148
  //
150
- address kyberRouter;
151
149
  address outputToken;
152
150
  uint256 minTokenOut;
153
151
  }
@@ -2,7 +2,7 @@
2
2
  pragma solidity 0.8.17;
3
3
 
4
4
  interface IPMarketFactory {
5
- event NewMarketConfig(address indexed treasury, uint88 lnFeeRateRoot, uint8 reserveFeePercent);
5
+ event NewMarketConfig(address indexed treasury, uint96 lnFeeRateRoot, uint8 reserveFeePercent);
6
6
 
7
7
  event CreateNewMarket(
8
8
  address indexed market,
@@ -30,7 +30,7 @@ interface IPYieldContractFactory {
30
30
 
31
31
  event SetInterestFeeRate(uint256 newInterestFeeRate);
32
32
 
33
- event SetRewardFeeRate(uint256 newRewardFeeRate);
33
+ event SetRewardFeeRate(uint256 newInterestFeeRate);
34
34
 
35
35
  event SetTreasury(address indexed treasury);
36
36
 
@@ -11,10 +11,4 @@ interface IStETH {
11
11
  function burnShares(address _account, uint256 _sharesAmount)
12
12
  external
13
13
  returns (uint256 newTotalShares);
14
-
15
- function sharesOf(address account) external view returns (uint256);
16
-
17
- function getTotalShares() external view returns (uint256);
18
-
19
- function getTotalPooledEther() external view returns (uint256);
20
14
  }
@@ -43,7 +43,7 @@ interface IStandardizedYield is IERC20Metadata {
43
43
  uint256 amountTokenOut
44
44
  );
45
45
 
46
- /// @dev check `assetInfo()` for more information
46
+ /// @dev check assetInfo for more information
47
47
  enum AssetType {
48
48
  TOKEN,
49
49
  LIQUIDITY
@@ -74,10 +74,9 @@ interface IStandardizedYield is IERC20Metadata {
74
74
  /**
75
75
  * @notice redeems an amount of base tokens by burning some shares
76
76
  * @param receiver recipient address
77
- * @param amountSharesToRedeem amount of shares to be burned
77
+ * @param amountSharesToRedeem amount of shares to be burned from (`msg.sender`)
78
78
  * @param tokenOut address of the base token to be redeemed
79
79
  * @param minTokenOut reverts if amount of base token redeemed is lower than this
80
- * @param burnFromInternalBalance if true, burns from balance of `address(this)`, otherwise burns from `msg.sender`
81
80
  * @return amountTokenOut amount of base tokens redeemed
82
81
  * @dev Emits a {Redeem} event
83
82
  *
@@ -106,7 +105,7 @@ interface IStandardizedYield is IERC20Metadata {
106
105
  * @param user the user receiving their rewards
107
106
  * @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
108
107
  * @dev
109
- * Emits a `ClaimRewards` event
108
+ * Emits a `ClaimRewardss` event
110
109
  * See {getRewardTokens} for list of reward tokens
111
110
  */
112
111
  function claimRewards(address user) external returns (uint256[] memory rewardAmounts);
@@ -132,14 +131,8 @@ interface IStandardizedYield is IERC20Metadata {
132
131
  */
133
132
  function yieldToken() external view returns (address);
134
133
 
135
- /**
136
- * @notice returns all tokens that can mint this SY
137
- */
138
134
  function getTokensIn() external view returns (address[] memory res);
139
135
 
140
- /**
141
- * @notice returns all tokens that can be redeemed by this SY
142
- */
143
136
  function getTokensOut() external view returns (address[] memory res);
144
137
 
145
138
  function isValidTokenIn(address token) external view returns (bool);
@@ -157,11 +150,13 @@ interface IStandardizedYield is IERC20Metadata {
157
150
  returns (uint256 amountTokenOut);
158
151
 
159
152
  /**
160
- * @notice This function contains information to interpret what the asset is
161
- * @return assetType the type of the asset (0 for ERC20 tokens, 1 for AMM liquidity tokens)
162
- * @return assetAddress the address of the asset
163
- * @return assetDecimals the decimals of the asset
164
- */
153
+ * @notice This function contains information to interpret what the asset is
154
+ * @notice decimals is the decimals to format asset balances
155
+ * @notice if asset is an ERC20 token, assetType = 0, assetAddress is the address of the token
156
+ * @notice if asset is liquidity of an AMM (like sqrt(k) in UniswapV2 forks), assetType = 1,
157
+ assetAddress is the address of the LP token
158
+ * @notice assetDecimals is the decimals of the asset
159
+ */
165
160
  function assetInfo()
166
161
  external
167
162
  view
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../interfaces/IPMarket.sol";
5
+
6
+ contract ImplicitSwapfeeContract {
7
+ using Math for int256;
8
+ using MarketMathCore for MarketState;
9
+
10
+ constructor() {}
11
+
12
+ function execute(
13
+ int256 K,
14
+ address market,
15
+ MarketState memory prevState,
16
+ int256 netPtToAccount
17
+ ) external view returns (int256 netScyToAccount) {
18
+ (, , IPYieldToken YT) = IPMarket(market).readTokens();
19
+ PYIndex index = PYIndex.wrap(YT.pyIndexStored());
20
+
21
+ for (int256 i = 0; i < K; ++i) {
22
+ (int256 scyToAccount, ) = prevState.executeTradeCore(
23
+ index,
24
+ netPtToAccount / K,
25
+ block.timestamp
26
+ );
27
+ netScyToAccount += scyToAccount;
28
+ }
29
+ }
30
+ }
@@ -35,6 +35,35 @@ library MarketMathStatic {
35
35
  );
36
36
  }
37
37
 
38
+ function addLiquidityDualTokenAndPtStatic(
39
+ address market,
40
+ address tokenIn,
41
+ uint256 netTokenDesired,
42
+ uint256 netPtDesired
43
+ )
44
+ external
45
+ view
46
+ returns (
47
+ uint256 netLpOut,
48
+ uint256 netTokenUsed,
49
+ uint256 netPtUsed
50
+ )
51
+ {
52
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
53
+
54
+ uint256 syDesired = SY.previewDeposit(tokenIn, netTokenDesired);
55
+ uint256 syUsed;
56
+
57
+ MarketState memory state = IPMarket(market).readState();
58
+ (, netLpOut, syUsed, netPtUsed) = state.addLiquidity(
59
+ syDesired,
60
+ netPtDesired,
61
+ block.timestamp
62
+ );
63
+
64
+ netTokenUsed = (netTokenDesired * syUsed).rawDivUp(syDesired);
65
+ }
66
+
38
67
  /// @dev netPtToSwap is the parameter to approx
39
68
  function addLiquiditySinglePtStatic(
40
69
  address market,
@@ -111,6 +140,31 @@ library MarketMathStatic {
111
140
  priceImpact = calcPriceImpact(market, netPtFromSwap.Int());
112
141
  }
113
142
 
143
+ /// @dev netPtFromSwap is the parameter to approx
144
+ function addLiquiditySingleBaseTokenStatic(
145
+ address market,
146
+ address baseToken,
147
+ uint256 netBaseTokenIn,
148
+ ApproxParams memory approxParams
149
+ )
150
+ external
151
+ returns (
152
+ uint256 netLpOut,
153
+ uint256 netPtFromSwap,
154
+ uint256 netSyFee,
155
+ uint256 priceImpact
156
+ )
157
+ {
158
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
159
+
160
+ return
161
+ addLiquiditySingleSyStatic(
162
+ market,
163
+ SY.previewDeposit(baseToken, netBaseTokenIn),
164
+ approxParams
165
+ );
166
+ }
167
+
114
168
  function removeLiquidityDualSyAndPtStatic(address market, uint256 netLpToRemove)
115
169
  external
116
170
  view
@@ -120,6 +174,20 @@ library MarketMathStatic {
120
174
  (netSyOut, netPtOut) = state.removeLiquidity(netLpToRemove);
121
175
  }
122
176
 
177
+ function removeLiquidityDualTokenAndPtStatic(
178
+ address market,
179
+ uint256 metLpToRemove,
180
+ address tokenOut
181
+ ) external view returns (uint256 netTokenOut, uint256 netPtOut) {
182
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
183
+
184
+ uint256 netSyOut;
185
+ MarketState memory state = IPMarket(market).readState();
186
+ (netSyOut, netPtOut) = state.removeLiquidity(metLpToRemove);
187
+
188
+ netTokenOut = SY.previewRedeem(tokenOut, netSyOut);
189
+ }
190
+
123
191
  /// @dev netPtFromSwap is the parameter to approx
124
192
  function removeLiquiditySinglePtStatic(
125
193
  address market,
@@ -175,6 +243,25 @@ library MarketMathStatic {
175
243
  }
176
244
  }
177
245
 
246
+ function removeLiquiditySingleBaseTokenStatic(
247
+ address market,
248
+ uint256 netLpToRemove,
249
+ address baseToken
250
+ )
251
+ external
252
+ returns (
253
+ uint256 netBaseTokenOut,
254
+ uint256 netSyFee,
255
+ uint256 priceImpact
256
+ )
257
+ {
258
+ uint256 netSyOut;
259
+ (netSyOut, netSyFee, priceImpact) = removeLiquiditySingleSyStatic(market, netLpToRemove);
260
+
261
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
262
+ netBaseTokenOut = SY.previewRedeem(baseToken, netSyOut);
263
+ }
264
+
178
265
  function swapExactPtForSyStatic(address market, uint256 exactPtIn)
179
266
  public
180
267
  returns (
@@ -248,6 +335,49 @@ library MarketMathStatic {
248
335
  priceImpact = calcPriceImpact(market, netPtIn.neg());
249
336
  }
250
337
 
338
+ /// @dev netPtOut is the parameter to approx
339
+ function swapExactBaseTokenForPtStatic(
340
+ address market,
341
+ address baseToken,
342
+ uint256 amountBaseToken,
343
+ ApproxParams memory approxParams
344
+ )
345
+ external
346
+ returns (
347
+ uint256 netPtOut,
348
+ uint256 netSyFee,
349
+ uint256 priceImpact
350
+ )
351
+ {
352
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
353
+
354
+ return
355
+ swapExactSyForPtStatic(
356
+ market,
357
+ SY.previewDeposit(baseToken, amountBaseToken),
358
+ approxParams
359
+ );
360
+ }
361
+
362
+ function swapExactPtForBaseTokenStatic(
363
+ address market,
364
+ uint256 exactPtIn,
365
+ address baseToken
366
+ )
367
+ external
368
+ returns (
369
+ uint256 netBaseTokenOut,
370
+ uint256 netSyFee,
371
+ uint256 priceImpact
372
+ )
373
+ {
374
+ uint256 netSyOut;
375
+ (netSyOut, netSyFee, priceImpact) = swapExactPtForSyStatic(market, exactPtIn);
376
+
377
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
378
+ netBaseTokenOut = SY.previewRedeem(baseToken, netSyOut);
379
+ }
380
+
251
381
  function swapSyForExactYtStatic(address market, uint256 exactYtOut)
252
382
  external
253
383
  returns (
@@ -347,6 +477,49 @@ library MarketMathStatic {
347
477
  priceImpact = calcPriceImpact(market, netYtIn.Int());
348
478
  }
349
479
 
480
+ function swapExactYtForBaseTokenStatic(
481
+ address market,
482
+ uint256 exactYtIn,
483
+ address baseToken
484
+ )
485
+ external
486
+ returns (
487
+ uint256 netBaseTokenOut,
488
+ uint256 netSyFee,
489
+ uint256 priceImpact
490
+ )
491
+ {
492
+ uint256 netSyOut;
493
+ (netSyOut, netSyFee, priceImpact) = swapExactYtForSyStatic(market, exactYtIn);
494
+
495
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
496
+ netBaseTokenOut = SY.previewRedeem(baseToken, netSyOut);
497
+ }
498
+
499
+ /// @dev netYtOut is the parameter to approx
500
+ function swapExactBaseTokenForYtStatic(
501
+ address market,
502
+ address baseToken,
503
+ uint256 amountBaseToken,
504
+ ApproxParams memory approxParams
505
+ )
506
+ external
507
+ returns (
508
+ uint256 netYtOut,
509
+ uint256 netSyFee,
510
+ uint256 priceImpact
511
+ )
512
+ {
513
+ (IStandardizedYield SY, , ) = IPMarket(market).readTokens();
514
+
515
+ return
516
+ swapExactSyForYtStatic(
517
+ market,
518
+ SY.previewDeposit(baseToken, amountBaseToken),
519
+ approxParams
520
+ );
521
+ }
522
+
350
523
  // totalPtToSwap is the param to approx
351
524
  function swapExactPtForYt(
352
525
  address market,