@pendle/core-v2 0.17.5-testnet → 0.17.6-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 (266) hide show
  1. package/README.md +28 -0
  2. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
  3. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
  4. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
  5. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
  6. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
  7. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
  8. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +1 -1
  9. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.json +2 -2
  10. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
  11. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
  12. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
  13. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
  14. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -2
  15. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
  16. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +2 -2
  17. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  18. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  19. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  20. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  21. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  22. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  23. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
  24. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  26. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
  27. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  28. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
  29. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  30. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  31. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  32. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
  33. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
  34. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  35. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  36. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +22 -28
  38. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +3 -22
  40. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
  42. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  44. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  46. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  47. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  49. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
  51. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  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/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
  64. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +2 -2
  65. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
  66. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +2 -2
  67. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
  68. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +2 -2
  69. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
  70. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
  71. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -2
  72. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  73. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
  74. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  75. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  76. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
  77. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  78. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
  79. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  80. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
  81. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  82. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +2 -2
  83. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  84. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
  85. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  86. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.json +2 -2
  87. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  88. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  89. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
  90. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  91. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +2 -18
  92. package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
  93. package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.json +2 -2
  94. package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  95. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
  100. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  102. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  104. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  105. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  106. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
  107. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +187 -1
  108. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
  109. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +0 -19
  110. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
  119. package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
  120. package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
  121. package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
  122. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  123. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -2
  124. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
  125. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
  126. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  127. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -2
  128. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  129. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +160 -60
  130. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  131. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
  132. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  133. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  134. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  135. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
  136. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  137. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  138. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  139. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
  140. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  141. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
  142. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  143. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
  144. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  145. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
  146. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  147. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  148. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  149. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  150. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  151. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  152. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
  153. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +1 -1
  154. package/build/artifacts/contracts/router/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +1 -1
  155. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  156. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +1 -4
  157. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +6 -5
  158. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -4
  159. package/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol +1 -1
  160. package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +9 -6
  161. package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +9 -21
  162. package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +0 -3
  163. package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +0 -3
  164. package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +34 -54
  165. package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +6 -25
  166. package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +20 -38
  167. package/contracts/LiquidityMining/libraries/VeHistoryLib.sol +1 -1
  168. package/contracts/core/BulkSeller/BulkSeller.sol +35 -42
  169. package/contracts/core/BulkSeller/BulkSellerFactory.sol +5 -9
  170. package/contracts/core/BulkSeller/BulkSellerMathCore.sol +6 -5
  171. package/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol +1 -3
  172. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +1 -1
  173. package/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol +1 -1
  174. package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +1 -1
  175. package/contracts/core/YieldContracts/PendleYieldToken.sol +6 -6
  176. package/contracts/core/erc20/PendleERC20.sol +2 -2
  177. package/contracts/core/erc20/PendleERC20Permit.sol +1 -1
  178. package/contracts/core/libraries/ArrayLib.sol +1 -1
  179. package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
  180. package/contracts/core/libraries/Errors.sol +0 -1
  181. package/contracts/core/libraries/MiniHelpers.sol +1 -0
  182. package/contracts/core/libraries/TokenHelper.sol +4 -5
  183. package/contracts/interfaces/Curve/ICrvPool.sol +3 -4
  184. package/contracts/interfaces/Curve/ITriCrvPool.sol +1 -4
  185. package/contracts/interfaces/IBoringOwnableUpgradeable.sol +2 -2
  186. package/contracts/interfaces/ILayerZeroEndpoint.sol +1 -1
  187. package/contracts/interfaces/ILayerZeroReceiver.sol +8 -3
  188. package/contracts/interfaces/IPBulkSeller.sol +30 -6
  189. package/contracts/interfaces/IPBulkSellerFactory.sol +0 -2
  190. package/contracts/interfaces/IPMarket.sol +2 -12
  191. package/contracts/interfaces/IPMsgReceiverApp.sol +1 -1
  192. package/contracts/interfaces/IPMsgSendEndpoint.sol +1 -1
  193. package/contracts/interfaces/IPVeToken.sol +1 -1
  194. package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
  195. package/contracts/interfaces/IStETH.sol +1 -1
  196. package/contracts/interfaces/IStargateLPStaking.sol +1 -1
  197. package/contracts/interfaces/IStargatePool.sol +1 -1
  198. package/contracts/interfaces/IStargateRouter.sol +1 -1
  199. package/contracts/interfaces/IWXBTRFLY.sol +1 -1
  200. package/contracts/offchain-helpers/MarketMathStatic.sol +140 -37
  201. package/contracts/offchain-helpers/RouterStatic.sol +48 -27
  202. package/contracts/router/ActionAddRemoveLiq.sol +2 -2
  203. package/contracts/router/ActionMintRedeem.sol +4 -4
  204. package/contracts/router/ActionSwapPT.sol +4 -4
  205. package/contracts/router/ActionSwapPTYT.sol +1 -1
  206. package/contracts/router/ActionSwapYT.sol +8 -8
  207. package/contracts/router/base/ActionBaseMintRedeem.sol +6 -7
  208. package/contracts/router/base/MarketApproxLib.sol +14 -8
  209. package/contracts/router/kyberswap/AggregationRouterHelper.sol +1 -1
  210. package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +1 -1
  211. package/contracts/router/kyberswap/IMultihopRouter.sol +1 -1
  212. package/deployments/43113-core.json +1 -1
  213. package/package.json +1 -1
  214. package/typechain-types/BulkSeller.ts +59 -6
  215. package/typechain-types/BulkSellerFactory.ts +0 -16
  216. package/typechain-types/IApeStaking.ts +274 -0
  217. package/typechain-types/IPBulkSeller.ts +178 -9
  218. package/typechain-types/IPBulkSellerFactory.ts +0 -16
  219. package/typechain-types/PendleApeStakingSY.ts +1251 -0
  220. package/typechain-types/RouterStatic.ts +40 -20
  221. package/typechain-types/SYBaseAutoCompound.ts +1203 -0
  222. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
  223. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  224. package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
  225. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  226. package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
  227. package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
  228. package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
  229. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
  230. package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -1
  231. package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
  232. package/typechain-types/factories/BulkSellerFactory__factory.ts +2 -21
  233. package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
  234. package/typechain-types/factories/BulkSeller__factory.ts +21 -27
  235. package/typechain-types/factories/Errors__factory.ts +1 -17
  236. package/typechain-types/factories/IApeStaking__factory.ts +127 -0
  237. package/typechain-types/factories/IPBulkSellerFactory__factory.ts +0 -19
  238. package/typechain-types/factories/IPBulkSeller__factory.ts +187 -1
  239. package/typechain-types/factories/MarketMathStatic__factory.ts +1 -1
  240. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  241. package/typechain-types/factories/PendleApeStakingSY__factory.ts +1065 -0
  242. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
  243. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
  244. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  245. package/typechain-types/factories/PendleERC20__factory.ts +1 -1
  246. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
  247. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
  248. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  249. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  250. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
  251. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  252. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  253. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  254. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  255. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
  256. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  257. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
  258. package/typechain-types/factories/PendleRouter__factory.ts +1 -1
  259. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
  260. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
  261. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
  262. package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
  263. package/typechain-types/factories/RouterStatic__factory.ts +101 -1
  264. package/typechain-types/factories/SYBaseAutoCompound__factory.ts +942 -0
  265. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
  266. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
@@ -13,10 +13,6 @@ import "../../core/libraries/Errors.sol";
13
13
 
14
14
  import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
15
15
 
16
- /// This contract is upgradable because
17
- /// - its constructor only sets immutable variables
18
- /// - it has storage gaps for safe addition of future variables
19
- /// - it inherits only upgradable contract
20
16
  abstract contract VotingControllerStorageUpg is IPVotingController {
21
17
  using VeBalanceLib for VeBalance;
22
18
  using VeBalanceLib for LockedPosition;
@@ -50,7 +46,7 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
50
46
 
51
47
  uint128 public constant MAX_LOCK_TIME = 104 weeks;
52
48
  uint128 public constant WEEK = 1 weeks;
53
- uint128 public constant GOVERNANCE_PENDLE_VOTE = 10**24;
49
+ uint128 public constant GOVERNANCE_PENDLE_VOTE = 10 * (10**6) * (10**18); // 10 mils of PENDLE
54
50
 
55
51
  IPVeToken public immutable vePendle;
56
52
 
@@ -147,12 +143,10 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
147
143
  for (uint256 i = 0; i < pools.length; ++i) poolVotes[i] = data.poolVotes[pools[i]];
148
144
  }
149
145
 
150
- /// @dev trivial view function
151
146
  function getAllActivePools() external view returns (address[] memory) {
152
147
  return allActivePools.values();
153
148
  }
154
149
 
155
- /// @dev trivial view function
156
150
  function getAllRemovedPools(uint256 start, uint256 end)
157
151
  external
158
152
  view
@@ -166,12 +160,10 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
166
160
  for (uint256 i = start; i <= end; ++i) arr[i - start] = allRemovedPools.at(i);
167
161
  }
168
162
 
169
- /// @dev trivial view function
170
163
  function getActiveChainPools(uint64 chainId) external view returns (address[] memory) {
171
164
  return activeChainPools[chainId].values();
172
165
  }
173
166
 
174
- /// @dev trivial view function
175
167
  function getUserPoolVote(address user, address pool)
176
168
  external
177
169
  view
@@ -193,14 +185,9 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
193
185
  }
194
186
 
195
187
  /*///////////////////////////////////////////////////////////////
196
- INTERNAL DATA MANIPULATION FUNCTIONS
188
+ INTERNAL DATA MANIPULATION FUNCTIONS
197
189
  //////////////////////////////////////////////////////////////*/
198
190
 
199
- /**
200
- * @dev expected behavior:
201
- - add to allActivePools, activeChainPools
202
- - set params in poolData
203
- */
204
191
  function _addPool(uint64 chainId, address pool) internal {
205
192
  if (!activeChainPools[chainId].add(pool)) assert(false);
206
193
  if (!allActivePools.add(pool)) assert(false);
@@ -209,12 +196,6 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
209
196
  poolData[pool].lastSlopeChangeAppliedAt = WeekMath.getCurrentWeekStart();
210
197
  }
211
198
 
212
- /**
213
- * @dev expected behavior:
214
- - remove from allActivePool, activeChainPools
215
- - add to allRemovedPools
216
- - clear all params in poolData
217
- */
218
199
  function _removePool(address pool) internal {
219
200
  uint64 chainId = poolData[pool].chainId;
220
201
  if (!activeChainPools[chainId].remove(pool)) assert(false);
@@ -224,10 +205,6 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
224
205
  delete poolData[pool];
225
206
  }
226
207
 
227
- /**
228
- * @notice set the final pool vote for weekData
229
- * @dev assumption: weekData[wTime].poolVotes[pool] == 0
230
- */
231
208
  function _setFinalPoolVoteForWeek(
232
209
  address pool,
233
210
  uint128 wTime,
@@ -247,6 +224,10 @@ abstract contract VotingControllerStorageUpg is IPVotingController {
247
224
  emit PoolVoteChange(pool, vote);
248
225
  }
249
226
 
227
+ /**
228
+ * @notice modifies `user`'s vote weight on `pool`
229
+ * @dev works by simply removing the old vote position, then adds in a fresh vote
230
+ */
250
231
  function _modifyVoteWeight(
251
232
  address user,
252
233
  address pool,
@@ -66,14 +66,14 @@ contract VotingEscrowPendleMainchain is
66
66
  }
67
67
 
68
68
  /**
69
- * @notice increase the lock position of an user. Applicable even when user has no position or the
70
- current position has expired
71
- * @dev expected state changes:
72
- - a new lock with amount = amountToPull + amountExpired, expiry = expiry is created for msg.sender in positionData
73
- - pendle is taken in if necessary
74
- - _totalSupply, lastSlopeChangeAppliedAt, slopeChanges, totalSupplyAt is updated
75
- - a checkpoint is added
76
- * @dev broadcast is not bundled since it can be done anytime after
69
+ * @notice increases the lock position of a user (amount and/or expiry). Applicable even when
70
+ * user has no position or the current position has expired.
71
+ * @param additionalAmountToLock pendle amount to be pulled in from user to lock.
72
+ * @param newExpiry new lock expiry. Must be a valid week beginning, and resulting lock
73
+ * duration (since `block.timestamp`) must be within the allowed range.
74
+ * @dev Will revert if resulting position has zero lock amount.
75
+ * @dev See `_increasePosition()` for details on inner workings.
76
+ * @dev Sidechain broadcasting is not bundled since it can be done anytime after.
77
77
  */
78
78
  function increaseLockPosition(uint128 additionalAmountToLock, uint128 newExpiry)
79
79
  public
@@ -104,13 +104,8 @@ contract VotingEscrowPendleMainchain is
104
104
  }
105
105
 
106
106
  /**
107
- * @notice withdraw an expired lock position, get back all locked PENDLE
108
- * @dev expected state changes:
109
- - positionData is cleared
110
- - pendle is transferred out
111
- - _totalSupply, lastSlopeChangeAppliedAt, slopeChanges, totalSupplyAt all doesn't need to be updated
112
- since these data will automatically hold true when _applySlopeChange() is called
113
- - no checkpoint is added
107
+ * @notice Withdraws an expired lock position, returns locked PENDLE back to user
108
+ * @dev reverts if position is not expired, or if no locked PENDLE to withdraw
114
109
  * @dev broadcast is not bundled since it can be done anytime after
115
110
  */
116
111
  function withdraw() external returns (uint128 amount) {
@@ -129,9 +124,8 @@ contract VotingEscrowPendleMainchain is
129
124
  }
130
125
 
131
126
  /**
132
- * @notice update & return the current totalSupply
133
- * @dev state changes expected:
134
- - _totalSupply & lastSlopeChangeAppliedAt is updated
127
+ * @notice update & return the current totalSupply, but does not broadcast info to other chains
128
+ * @dev See `broadcastTotalSupply()` and `broadcastUserPosition()` for broadcasting
135
129
  */
136
130
  function totalSupplyCurrent()
137
131
  public
@@ -143,19 +137,14 @@ contract VotingEscrowPendleMainchain is
143
137
  return supply.getCurrentValue();
144
138
  }
145
139
 
146
- /**
147
- * @notice broadcast the totalSupply to different chains
148
- * @dev state changes expected:
149
- - all chains in chainIds receive the new totalSupply
150
- */
140
+ /// @notice updates and broadcast the current totalSupply to different chains
151
141
  function broadcastTotalSupply(uint256[] calldata chainIds) public payable refundUnusedEth {
152
142
  _broadcastPosition(address(0), chainIds);
153
143
  }
154
144
 
155
145
  /**
156
- * @notice broadcast the position of users to different chains
157
- * @dev state changes expected:
158
- - all chains in chainIds receive the new totalSupply & user's new position
146
+ * @notice updates and broadcast the position of `user` to different chains, also updates and
147
+ * broadcasts totalSupply
159
148
  */
160
149
  function broadcastUserPosition(address user, uint256[] calldata chainIds)
161
150
  public
@@ -200,13 +189,8 @@ contract VotingEscrowPendleMainchain is
200
189
 
201
190
  /**
202
191
  * @notice increase the locking position of the user
203
- * @dev it works by simply removing the old position from all relevant data (as if the user has never locked) and
204
- then add in the new position
205
- * @dev expected state changes:
206
- - a new lock with the amount & expiry increase accordingly
207
- - pendle is taken in if necessary
208
- - _totalSupply, lastSlopeChangeAppliedAt, slopeChanges, totalSupplyAt is updated
209
- - a checkpoint is added
192
+ * @dev works by simply removing the old position from all relevant data (as if the user has
193
+ * never locked) and then add in the new position
210
194
  */
211
195
  function _increasePosition(
212
196
  address user,
@@ -241,10 +225,8 @@ contract VotingEscrowPendleMainchain is
241
225
  }
242
226
 
243
227
  /**
244
- * @notice update the totalSupply, processing all slope changes of past weeks. At the same time, set the finalized
245
- totalSupplyAt
246
- * @dev state changes expected:
247
- - _totalSupply, lastSlopeChangeAppliedAt, totalSupplyAt is updated
228
+ * @notice updates the totalSupply, processing all slope changes of past weeks. At the same time,
229
+ * set the finalized totalSupplyAt
248
230
  */
249
231
  function _applySlopeChange() internal returns (VeBalance memory, uint128) {
250
232
  VeBalance memory supply = _totalSupply;
@@ -271,7 +253,7 @@ contract VotingEscrowPendleMainchain is
271
253
  function _broadcastPosition(address user, uint256[] calldata chainIds) internal {
272
254
  if (chainIds.length == 0) revert Errors.ArrayEmpty();
273
255
 
274
- (VeBalance memory supply,) = _applySlopeChange();
256
+ (VeBalance memory supply, ) = _applySlopeChange();
275
257
 
276
258
  bytes memory userData = (
277
259
  user == address(0) ? EMPTY_BYTES : abi.encode(user, positionData[user])
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  // Forked from OpenZeppelin (v4.5.0) (utils/Checkpoints.sol)
3
3
  pragma solidity ^0.8.0;
4
4
 
@@ -18,29 +18,6 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
18
18
  using SafeERC20 for IERC20;
19
19
  using BulkSellerMathCore for BulkSellerState;
20
20
 
21
- event SwapExactTokenForSy(address receiver, uint256 netTokenIn, uint256 netSyOut);
22
- event SwapExactSyForToken(address receiver, uint256 netSyIn, uint256 netTokenOut);
23
- event RateUpdated(
24
- uint256 newRateTokenToSy,
25
- uint256 newRateSyToToken,
26
- uint256 oldRateTokenToSy,
27
- uint256 oldRateSyToToken
28
- );
29
- event ReBalanceTokenToSy(
30
- uint256 netTokenDeposit,
31
- uint256 netSyFromToken,
32
- uint256 newTokenProp,
33
- uint256 oldTokenProp
34
- );
35
- event ReBalanceSyToToken(
36
- uint256 netSyRedeem,
37
- uint256 netTokenFromSy,
38
- uint256 newTokenProp,
39
- uint256 oldTokenProp
40
- );
41
- event ReserveUpdated(uint256 totalToken, uint256 totalSy);
42
- event FeeRateUpdated(uint256 newFeeRate, uint256 oldFeeRate);
43
-
44
21
  struct BulkSellerStorage {
45
22
  uint128 rateTokenToSy;
46
23
  uint128 rateSyToToken;
@@ -61,11 +38,6 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
61
38
  _;
62
39
  }
63
40
 
64
- modifier onlyAdmin() {
65
- if (!IPBulkSellerFactory(factory).isAdmin(msg.sender)) revert Errors.BulkNotAdmin();
66
- _;
67
- }
68
-
69
41
  // Since this contract is a beacon contract, no constructor should be defined.
70
42
  function initialize(
71
43
  address _token,
@@ -76,46 +48,52 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
76
48
  token = _token;
77
49
  SY = _SY;
78
50
  factory = _factory;
51
+ _safeApproveInf(token, SY);
79
52
  }
80
53
 
81
54
  function swapExactTokenForSy(
82
55
  address receiver,
83
56
  uint256 netTokenIn,
84
57
  uint256 minSyOut
85
- ) external nonReentrant returns (uint256 netSyOut) {
58
+ ) external payable nonReentrant returns (uint256 netSyOut) {
86
59
  BulkSellerState memory state = readState();
87
60
 
61
+ _transferIn(token, msg.sender, netTokenIn);
62
+
88
63
  netSyOut = state.swapExactTokenForSy(netTokenIn);
89
64
 
90
65
  if (netSyOut < minSyOut) revert Errors.BulkInSufficientSyOut(netSyOut, minSyOut);
91
66
 
92
- if (receiver != address(this)) _transferOut(SY, receiver, netSyOut);
67
+ _transferOut(SY, receiver, netSyOut);
93
68
 
94
69
  _writeState(state);
95
70
 
96
- if (_selfBalance(token) < state.totalToken)
97
- revert Errors.BulkInsufficientTokenReceived(_selfBalance(token), state.totalToken);
98
-
99
71
  emit SwapExactTokenForSy(receiver, netTokenIn, netSyOut);
100
72
  }
101
73
 
102
74
  function swapExactSyForToken(
103
75
  address receiver,
104
76
  uint256 exactSyIn,
105
- uint256 minTokenOut
77
+ uint256 minTokenOut,
78
+ bool swapFromInternalBalance
106
79
  ) external nonReentrant returns (uint256 netTokenOut) {
107
80
  BulkSellerState memory state = readState();
108
81
 
82
+ if (!swapFromInternalBalance) _transferIn(SY, msg.sender, exactSyIn);
83
+ else {
84
+ uint256 netSyReceived = _selfBalance(SY) - state.totalSy;
85
+ if (netSyReceived < exactSyIn)
86
+ revert Errors.BulkInsufficientSyReceived(exactSyIn, netSyReceived);
87
+ }
88
+
109
89
  netTokenOut = state.swapExactSyForToken(exactSyIn);
110
90
 
111
91
  if (netTokenOut < minTokenOut)
112
92
  revert Errors.BulkInSufficientTokenOut(netTokenOut, minTokenOut);
113
- if (receiver != address(this)) _transferOut(token, receiver, netTokenOut);
114
93
 
115
- _writeState(state);
94
+ _transferOut(token, receiver, netTokenOut);
116
95
 
117
- if (_selfBalance(SY) < state.totalSy)
118
- revert Errors.BulkInsufficientSyReceived(_selfBalance(SY), state.totalSy);
96
+ _writeState(state);
119
97
 
120
98
  emit SwapExactSyForToken(receiver, exactSyIn, netTokenOut);
121
99
  }
@@ -159,7 +137,7 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
159
137
  _writeState(state);
160
138
  }
161
139
 
162
- function decreaseReserve(uint256 netTokenOut, uint256 netSyOut) external onlyAdmin {
140
+ function decreaseReserve(uint256 netTokenOut, uint256 netSyOut) external onlyMaintainer {
163
141
  BulkSellerState memory state = readState();
164
142
 
165
143
  if (netTokenOut == type(uint256).max) netTokenOut = state.totalToken;
@@ -176,6 +154,24 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
176
154
  _writeState(state);
177
155
  }
178
156
 
157
+ function redeemRewards() external onlyMaintainer {
158
+ IStandardizedYield(SY).claimRewards(address(this));
159
+ address[] memory rewardTokens = IStandardizedYield(SY).getRewardTokens();
160
+
161
+ for (uint256 i = 0; i < rewardTokens.length; i++) {
162
+ if (rewardTokens[i] == token) continue;
163
+ _transferOut(rewardTokens[i], msg.sender, _selfBalance(rewardTokens[i]));
164
+ }
165
+ }
166
+
167
+ function skim() external onlyMaintainer {
168
+ BulkSellerState memory state = readState();
169
+ uint256 excessToken = _selfBalance(token) - state.totalToken;
170
+ uint256 excessSy = _selfBalance(SY) - state.totalSy;
171
+ if (excessToken != 0) IERC20(token).safeTransfer(msg.sender, excessToken);
172
+ if (excessSy != 0) IERC20(SY).safeTransfer(msg.sender, excessSy);
173
+ }
174
+
179
175
  function reBalance(uint256 targetProp, uint256 maxDiff) external onlyMaintainer {
180
176
  BulkSellerState memory state = readState();
181
177
  uint256 oldTokenProp = state.getTokenProp();
@@ -224,7 +220,6 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
224
220
  }
225
221
 
226
222
  function _depositToken(uint256 netTokenDeposit) internal returns (uint256 netSyFromToken) {
227
- _safeApprove(token, SY, netTokenDeposit);
228
223
  uint256 nativeToDeposit = token == NATIVE ? netTokenDeposit : 0;
229
224
  return
230
225
  IStandardizedYield(SY).deposit{ value: nativeToDeposit }(
@@ -239,6 +234,4 @@ contract BulkSeller is IPBulkSeller, Initializable, TokenHelper, ReentrancyGuard
239
234
  _transferOut(SY, SY, netSyRedeem);
240
235
  return IStandardizedYield(SY).redeem(address(this), netSyRedeem, token, 0, true);
241
236
  }
242
-
243
- receive() external payable {}
244
237
  }
@@ -25,8 +25,8 @@ contract BulkSellerFactory is
25
25
 
26
26
  mapping(address => mapping(address => address)) internal syToBulkSeller;
27
27
 
28
- modifier onlyAdmin() {
29
- if (!isAdmin(msg.sender)) revert Errors.BulkNotAdmin();
28
+ modifier onlyMaintainer() {
29
+ if (!isMaintainer(msg.sender)) revert Errors.BulkNotMaintainer();
30
30
  _;
31
31
  }
32
32
 
@@ -39,7 +39,7 @@ contract BulkSellerFactory is
39
39
 
40
40
  function createBulkSeller(address token, address SY)
41
41
  external
42
- onlyAdmin
42
+ onlyMaintainer
43
43
  returns (address bulk)
44
44
  {
45
45
  IStandardizedYield _SY = IStandardizedYield(SY);
@@ -72,12 +72,8 @@ contract BulkSellerFactory is
72
72
  return (hasRole(DEFAULT_ADMIN_ROLE, addr) || hasRole(MAINTAINER, addr));
73
73
  }
74
74
 
75
- function isAdmin(address addr) public view override returns (bool) {
76
- return hasRole(DEFAULT_ADMIN_ROLE, addr);
77
- }
78
-
79
75
  // ----------------- upgrade-related -----------------
80
- function upgradeBeacon(address newImplementation) public onlyAdmin {
76
+ function upgradeBeacon(address newImplementation) public onlyMaintainer {
81
77
  require(
82
78
  AddressUpgradeable.isContract(newImplementation),
83
79
  "UpgradeableBeacon: implementation is not a contract"
@@ -86,5 +82,5 @@ contract BulkSellerFactory is
86
82
  emit UpgradedBeacon(newImplementation);
87
83
  }
88
84
 
89
- function _authorizeUpgrade(address) internal override onlyAdmin {}
85
+ function _authorizeUpgrade(address) internal override onlyMaintainer {}
90
86
  }
@@ -76,13 +76,14 @@ library BulkSellerMathCore {
76
76
  uint256 currentTokenProp = getTokenProp(state);
77
77
 
78
78
  if (currentTokenProp > targetTokenProp) {
79
- netTokenToDeposit = state.totalToken.mulDown(
80
- (currentTokenProp - targetTokenProp).divDown(currentTokenProp)
81
- );
79
+ netTokenToDeposit = state
80
+ .totalToken
81
+ .mulDown(currentTokenProp - targetTokenProp)
82
+ .divDown(currentTokenProp);
82
83
  } else {
83
84
  uint256 currentSyProp = Math.ONE - currentTokenProp;
84
- netSyToRedeem = state.totalSy.mulDown(
85
- (targetTokenProp - currentTokenProp).divDown(currentSyProp)
85
+ netSyToRedeem = state.totalSy.mulDown(targetTokenProp - currentTokenProp).divDown(
86
+ currentSyProp
86
87
  );
87
88
  }
88
89
  }
@@ -35,9 +35,7 @@ contract PendleQiTokenSY is SYBaseWithRewards, PendleQiTokenHelper {
35
35
  QI = IBenQiComptroller(comptroller).qiAddress();
36
36
  WAVAX = _WAVAX;
37
37
 
38
- if (underlying != NATIVE) {
39
- _safeApprove(underlying, qiToken, type(uint256).max);
40
- }
38
+ _safeApproveInf(underlying, qiToken);
41
39
  }
42
40
 
43
41
  /*///////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ library CurveUsdd3CrvPoolHelper {
102
102
  {
103
103
  uint256[N_COINS] memory result;
104
104
  for (uint256 i = 0; i < N_COINS; ++i) {
105
- result[i] = balances[i] * _rates[i] / PRECISION;
105
+ result[i] = (balances[i] * _rates[i]) / PRECISION;
106
106
  }
107
107
  return result;
108
108
  }
@@ -32,7 +32,7 @@ abstract contract PendleConvexLPSY is SYBaseWithRewards {
32
32
  (crvLp, cvxRewardManager) = _getPoolInfo(cvxPid);
33
33
  if (crvLp != _crvLp) revert Errors.SYCurveInvalidPid();
34
34
 
35
- _safeApprove(crvLp, BOOSTER, type(uint256).max);
35
+ _safeApproveInf(crvLp, BOOSTER);
36
36
  }
37
37
 
38
38
  function _getPoolInfo(uint256 _cvxPid)
@@ -20,7 +20,7 @@ contract PendleWstEthSY is SYBase {
20
20
  wETH = _wETH;
21
21
  wstETH = _wstETH;
22
22
  stETH = IWstETH(wstETH).stETH();
23
- _safeApprove(stETH, wstETH, type(uint256).max);
23
+ _safeApproveInf(stETH, wstETH);
24
24
  }
25
25
 
26
26
  /*///////////////////////////////////////////////////////////////
@@ -66,8 +66,8 @@ contract PendleYieldToken is
66
66
  }
67
67
 
68
68
  /**
69
- * @param _doCacheIndexSameBlock if true, the PY index is cached for each block, and thus is
70
- * constant for all txs within the same block. Otherwise, the PY index is recalculated for
69
+ * @param _doCacheIndexSameBlock if true, the PY index is cached for each block, and thus is
70
+ * constant for all txs within the same block. Otherwise, the PY index is recalculated for
71
71
  * every tx.
72
72
  */
73
73
  constructor(
@@ -131,7 +131,7 @@ contract PendleYieldToken is
131
131
  }
132
132
 
133
133
  /**
134
- * @notice converts PT(+YT) tokens into SY, but interests & rewards are not redeemed at the
134
+ * @notice converts PT(+YT) tokens into SY, but interests & rewards are not redeemed at the
135
135
  * same time
136
136
  * @dev PT/YT must be transferred to this contract prior to calling
137
137
  */
@@ -172,9 +172,9 @@ contract PendleYieldToken is
172
172
  * @param redeemInterest will only transfer out interest for user if true
173
173
  * @param redeemRewards will only transfer out rewards for user if true
174
174
  * @dev With YT yielding interest in the form of SY, which is redeemable by users, the reward
175
- * distribution should be based on the amount of SYs that their YT currently represent, plus
176
- * their dueInterest. It has been proven and tested that _rewardSharesUser will not change over
177
- * time, unless users redeem their dueInterest or redeemPY. Due to this, it is required to
175
+ * distribution should be based on the amount of SYs that their YT currently represent, plus
176
+ * their dueInterest. It has been proven and tested that _rewardSharesUser will not change over
177
+ * time, unless users redeem their dueInterest or redeemPY. Due to this, it is required to
178
178
  * update users' accruedReward STRICTLY BEFORE transferring out their interest.
179
179
  */
180
180
  function redeemDueInterestAndRewards(
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)
3
3
 
4
4
  pragma solidity ^0.8.0;
@@ -26,7 +26,7 @@ contract PendleERC20 is Context, IERC20, IERC20Metadata {
26
26
  mapping(address => mapping(address => uint256)) private _allowances;
27
27
 
28
28
  uint248 private _totalSupply;
29
- uint8 private _status;
29
+ uint8 private _status;
30
30
 
31
31
  string private _name;
32
32
  string private _symbol;
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)
3
3
 
4
4
  pragma solidity ^0.8.0;
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: AGPL-3.0-only
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  pragma solidity >=0.8.0;
3
3
 
4
4
  library ArrayLib {
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  pragma solidity 0.8.17;
3
3
 
4
4
  import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
@@ -9,7 +9,6 @@ library Errors {
9
9
  error BulkInsufficientTokenForTrade(uint256 currentAmount, uint256 requiredAmount);
10
10
  error BulkInSufficientSyOut(uint256 actualSyOut, uint256 requiredSyOut);
11
11
  error BulkInSufficientTokenOut(uint256 actualTokenOut, uint256 requiredTokenOut);
12
- error BulkInsufficientTokenReceived(uint256 actualBalance, uint256 requiredBalance);
13
12
  error BulkInsufficientSyReceived(uint256 actualBalance, uint256 requiredBalance);
14
13
  error BulkNotMaintainer();
15
14
  error BulkNotAdmin();
@@ -1,3 +1,4 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
1
2
  pragma solidity 0.8.17;
2
3
 
3
4
  library MiniHelpers {
@@ -64,10 +64,7 @@ abstract contract TokenHelper {
64
64
  }
65
65
 
66
66
  /// @notice Approves the stipulated contract to spend the given allowance in the given token
67
- /// @dev Errors with 'SA' if transfer fails
68
- /// @param token The contract address of the token to be approved
69
- /// @param to The target of the approval
70
- /// @param value The amount of the given token the target will be allowed to spend
67
+ /// @dev PLS PAY ATTENTION to tokens that requires the approval to be set to 0 before changing it
71
68
  function _safeApprove(
72
69
  address token,
73
70
  address to,
@@ -81,7 +78,9 @@ abstract contract TokenHelper {
81
78
 
82
79
  function _safeApproveInf(address token, address to) internal {
83
80
  if (token == NATIVE) return;
84
- if (IERC20(token).allowance(address(this), to) < LOWER_BOUND_APPROVAL)
81
+ if (IERC20(token).allowance(address(this), to) < LOWER_BOUND_APPROVAL) {
82
+ _safeApprove(token, to, 0);
85
83
  _safeApprove(token, to, type(uint256).max);
84
+ }
86
85
  }
87
86
  }
@@ -25,10 +25,9 @@ interface ICrvPool {
25
25
  uint256 min_dy // The amount of i being exchanged.
26
26
  ) external returns (uint256);
27
27
 
28
- function add_liquidity(
29
- uint256[2] memory _deposit_amount,
30
- uint256 _min_amount
31
- ) external returns (uint256 lpOut);
28
+ function add_liquidity(uint256[2] memory _deposit_amount, uint256 _min_amount)
29
+ external
30
+ returns (uint256 lpOut);
32
31
 
33
32
  function remove_liquidity_one_coin(
34
33
  uint256 _burn_amount,
@@ -19,10 +19,7 @@ interface ITriCrvPool {
19
19
  uint256 min_dy // The amount of i being exchanged.
20
20
  ) external returns (uint256);
21
21
 
22
- function add_liquidity(
23
- uint256[3] memory _deposit_amount,
24
- uint256 _min_amount
25
- ) external;
22
+ function add_liquidity(uint256[3] memory _deposit_amount, uint256 _min_amount) external;
26
23
 
27
24
  function remove_liquidity_one_coin(
28
25
  uint256 _burn_amount,
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
  pragma solidity 0.8.17;
3
3
 
4
4
  interface IBoringOwnableUpgradeable {
@@ -7,4 +7,4 @@ interface IBoringOwnableUpgradeable {
7
7
  bool direct,
8
8
  bool renounce
9
9
  ) external;
10
- }
10
+ }
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
 
3
3
  pragma solidity >=0.5.0;
4
4
 
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: BUSL-1.1
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
2
 
3
3
  pragma solidity >=0.5.0;
4
4
 
@@ -8,5 +8,10 @@ interface ILayerZeroReceiver {
8
8
  // @param _srcAddress - the source sending contract address from the source chain
9
9
  // @param _nonce - the ordered message nonce
10
10
  // @param _payload - the signed payload is the UA bytes has encoded to be sent
11
- function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;
12
- }
11
+ function lzReceive(
12
+ uint16 _srcChainId,
13
+ bytes calldata _srcAddress,
14
+ uint64 _nonce,
15
+ bytes calldata _payload
16
+ ) external;
17
+ }