@pendle/core-v2 1.0.0-mainnet → 1.0.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 (552) 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/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
  10. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
  11. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  12. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  13. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  14. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  15. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  16. package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
  17. package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +592 -0
  18. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  19. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
  20. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  21. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  22. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
  23. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  24. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  26. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  27. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  28. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
  29. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
  30. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  31. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  32. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
  33. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -2
  34. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
  35. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
  36. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
  38. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  40. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  41. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  42. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  43. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  44. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  45. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  46. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
  47. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  49. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  51. package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.dbg.json +4 -0
  52. package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.json +10 -0
  53. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +4 -0
  54. package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +1075 -0
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAura3EthSY.sol/PendleAura3EthSY.dbg.json +4 -0
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAura3EthSY.sol/PendleAura3EthSY.json +1257 -0
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraCbethWstethSY.sol/PendleAuraCbethWstethSY.dbg.json +4 -0
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraCbethWstethSY.sol/PendleAuraCbethWstethSY.json +1244 -0
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol/PendleAuraWethRethSY.dbg.json +4 -0
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol/PendleAuraWethRethSY.json +1218 -0
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol/PendleAuraWethWstethSY.dbg.json +4 -0
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol/PendleAuraWethWstethSY.json +1192 -0
  63. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.dbg.json +4 -0
  64. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.json +10 -0
  65. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.dbg.json +4 -0
  66. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.json +133 -0
  67. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.dbg.json +4 -0
  68. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.json +10 -0
  69. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.dbg.json +4 -0
  70. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.json +40 -0
  71. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.dbg.json +4 -0
  72. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.json +322 -0
  73. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol/PendleAuraBalancerStableLPSY.dbg.json +4 -0
  74. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol/PendleAuraBalancerStableLPSY.json +1171 -0
  75. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.dbg.json +4 -0
  76. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.json +10 -0
  77. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.dbg.json +4 -0
  78. package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.json +133 -0
  79. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  80. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  81. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  82. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
  83. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
  84. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +2 -2
  85. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
  86. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +2 -2
  87. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
  88. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
  89. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
  90. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
  91. package/build/artifacts/contracts/core/StandardizedYield/implementations/GMX/GMXPreviewHelper.sol/GMXPreviewHelper.dbg.json +4 -0
  92. package/build/artifacts/contracts/core/StandardizedYield/implementations/GMX/GMXPreviewHelper.sol/GMXPreviewHelper.json +50 -0
  93. package/build/artifacts/contracts/core/StandardizedYield/implementations/GMX/PendleGlpSY.sol/PendleGlpSY.dbg.json +4 -0
  94. package/build/artifacts/contracts/core/StandardizedYield/implementations/GMX/PendleGlpSY.sol/PendleGlpSY.json +1163 -0
  95. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
  96. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +2 -2
  97. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  98. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
  99. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  100. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  101. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
  102. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  103. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
  104. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  105. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
  106. package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +4 -0
  107. package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.json +66 -0
  108. package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +4 -0
  109. package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.json +476 -0
  110. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +4 -0
  111. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.json +590 -0
  112. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +4 -0
  113. package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.json +1017 -0
  114. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  115. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  116. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  117. package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.json +2 -2
  118. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  119. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  120. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  121. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +182 -5
  122. package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
  123. package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  124. package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.dbg.json +4 -0
  125. package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.json +10 -0
  126. package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.dbg.json +4 -0
  127. package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.json +24 -0
  128. package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +4 -0
  129. package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.json +133 -0
  130. package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.dbg.json +4 -0
  131. package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.json +328 -0
  132. package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.dbg.json +4 -0
  133. package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.json +467 -0
  134. package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.dbg.json +4 -0
  135. package/build/artifacts/contracts/interfaces/{IPFeeDistributorFactory.sol/IPFeeDistributorFactory.json → Balancer/IGauge.sol/IGauge.json} +18 -33
  136. package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.dbg.json +4 -0
  137. package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.json +30 -0
  138. package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.dbg.json +4 -0
  139. package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.json +398 -0
  140. package/build/artifacts/contracts/interfaces/Balancer/IRateProvider.sol/IRateProvider.dbg.json +4 -0
  141. package/build/artifacts/contracts/{router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.json → interfaces/Balancer/IRateProvider.sol/IRateProvider.json} +5 -5
  142. package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.dbg.json +4 -0
  143. package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.json +278 -0
  144. package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +1 -1
  145. package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.json +18 -0
  146. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  147. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
  148. package/build/artifacts/contracts/interfaces/GMX/IGMXVault.sol/IGMXVault.dbg.json +4 -0
  149. package/build/artifacts/contracts/interfaces/GMX/IGMXVault.sol/IGMXVault.json +308 -0
  150. package/build/artifacts/contracts/interfaces/GMX/IGlpManager.sol/IGlpManager.dbg.json +4 -0
  151. package/build/artifacts/contracts/interfaces/GMX/IGlpManager.sol/IGlpManager.json +43 -0
  152. package/build/artifacts/contracts/interfaces/GMX/IRewardRouterV2.sol/IRewardRouterV2.dbg.json +4 -0
  153. package/build/artifacts/contracts/interfaces/GMX/IRewardRouterV2.sol/IRewardRouterV2.json +165 -0
  154. package/build/artifacts/contracts/interfaces/GMX/IVaultPriceFeed.sol/IVaultPriceFeed.dbg.json +4 -0
  155. package/build/artifacts/contracts/interfaces/GMX/IVaultPriceFeed.sol/IVaultPriceFeed.json +45 -0
  156. package/build/artifacts/contracts/interfaces/IApeStaking.sol/IApeStaking.dbg.json +4 -0
  157. package/build/artifacts/contracts/{LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.json → interfaces/IApeStaking.sol/IApeStaking.json} +70 -52
  158. package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +1 -1
  159. package/build/artifacts/contracts/interfaces/IDiamondCut.sol/IDiamondCut.dbg.json +4 -0
  160. package/build/artifacts/contracts/interfaces/IDiamondCut.sol/IDiamondCut.json +93 -0
  161. package/build/artifacts/contracts/interfaces/IDiamondLoupe.sol/IDiamondLoupe.dbg.json +4 -0
  162. package/build/artifacts/contracts/interfaces/IDiamondLoupe.sol/IDiamondLoupe.json +87 -0
  163. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
  164. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
  165. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  166. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +338 -16
  167. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  168. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +105 -224
  169. package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
  170. package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.json +56 -12
  171. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  172. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +52 -8
  173. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  174. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +231 -8
  175. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  176. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +675 -241
  177. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
  178. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
  179. package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +1 -1
  180. package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.json +43 -32
  181. package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.dbg.json +4 -0
  182. package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.json +40 -0
  183. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  184. package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
  185. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  186. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
  187. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  188. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  189. package/build/artifacts/contracts/interfaces/IPYieldTokenV2.sol/IPYieldTokenV2.dbg.json +4 -0
  190. package/build/artifacts/contracts/interfaces/IPYieldTokenV2.sol/IPYieldTokenV2.json +679 -0
  191. package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
  192. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
  193. package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
  194. package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
  195. package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
  196. package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
  197. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  198. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
  199. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
  200. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  201. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +42 -28
  202. package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +4 -0
  203. package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.json +322 -0
  204. package/build/artifacts/contracts/offchain-helpers/PendleMulticall.sol/PendleMulticall.dbg.json +4 -0
  205. package/build/artifacts/contracts/offchain-helpers/PendleMulticall.sol/PendleMulticall.json +47 -0
  206. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  207. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +257 -100
  208. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  209. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +345 -62
  210. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  211. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +107 -260
  212. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  213. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +57 -18
  214. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  215. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +54 -65
  216. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  217. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +338 -45
  218. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  219. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +76 -67
  220. package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +4 -0
  221. package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.json +141 -0
  222. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  223. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.json +1 -15
  224. package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
  225. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  226. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  227. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  228. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  229. package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.dbg.json +4 -0
  230. package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.json +160 -0
  231. package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.dbg.json +4 -0
  232. package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.json +10 -0
  233. package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +4 -0
  234. package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.json +56 -0
  235. package/build/artifacts/contracts/router/swap-aggregator/PendleSwapAggregator.sol/PendleSwapAggregator.dbg.json +4 -0
  236. package/build/artifacts/contracts/router/swap-aggregator/PendleSwapAggregator.sol/PendleSwapAggregator.json +97 -0
  237. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol/KyberAggregationRouterHelper.dbg.json +4 -0
  238. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol/KyberAggregationRouterHelper.json +10 -0
  239. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol/ScaleDataHelperEthereum1.dbg.json +4 -0
  240. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol/ScaleDataHelperEthereum1.json +10 -0
  241. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +4 -0
  242. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol/IAggregationExecutor.json +65 -0
  243. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.dbg.json +4 -0
  244. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.json +388 -0
  245. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol/IHashflow.dbg.json +4 -0
  246. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol/IHashflow.json +101 -0
  247. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +4 -0
  248. package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.json +215 -0
  249. package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +7 -9
  250. package/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol +224 -0
  251. package/contracts/core/BulkSeller/BulkSeller.sol +1 -1
  252. package/contracts/core/StandardizedYield/SYBaseWithRewards.sol +1 -3
  253. package/contracts/core/StandardizedYield/StEthHelper.sol +71 -0
  254. package/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol +197 -0
  255. package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAura3EthSY.sol +170 -0
  256. package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraCbethWstethSY.sol +162 -0
  257. package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol +134 -0
  258. package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol +154 -0
  259. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol +289 -0
  260. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol +618 -0
  261. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol +68 -0
  262. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol +322 -0
  263. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol +390 -0
  264. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol +329 -0
  265. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol +30 -0
  266. package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol +189 -0
  267. package/contracts/core/StandardizedYield/implementations/GMX/GMXPreviewHelper.sol +142 -0
  268. package/contracts/core/StandardizedYield/implementations/GMX/PendleGlpSY.sol +244 -0
  269. package/contracts/core/StandardizedYield/implementations/GMX/README.md +61 -0
  270. package/contracts/core/YieldContractsV2/InterestManagerYTV2.sol +114 -0
  271. package/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol +63 -0
  272. package/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol +200 -0
  273. package/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol +485 -0
  274. package/contracts/core/libraries/ArrayLib.sol +12 -0
  275. package/contracts/core/libraries/Errors.sol +20 -2
  276. package/contracts/core/libraries/TokenHelper.sol +10 -0
  277. package/contracts/interfaces/Balancer/IAsset.sol +4 -0
  278. package/contracts/interfaces/Balancer/IBalancerFees.sol +6 -0
  279. package/contracts/interfaces/Balancer/IBalancerStablePreview.sol +22 -0
  280. package/contracts/interfaces/Balancer/IBasePool.sol +30 -0
  281. package/contracts/interfaces/Balancer/IComposableStable.sol +39 -0
  282. package/contracts/interfaces/Balancer/IGauge.sol +10 -0
  283. package/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol +6 -0
  284. package/contracts/interfaces/Balancer/IMetaStablePool.sol +31 -0
  285. package/contracts/interfaces/Balancer/IRateProvider.sol +6 -0
  286. package/contracts/interfaces/Balancer/IVault.sol +78 -0
  287. package/contracts/interfaces/ConvexCurve/IRewards.sol +5 -0
  288. package/contracts/interfaces/GMX/IGMXVault.sol +47 -0
  289. package/contracts/interfaces/GMX/IGlpManager.sol +8 -0
  290. package/contracts/interfaces/GMX/IRewardRouterV2.sol +35 -0
  291. package/contracts/interfaces/GMX/IVaultPriceFeed.sol +11 -0
  292. package/contracts/interfaces/IApeStaking.sol +30 -0
  293. package/contracts/interfaces/IDiamondCut.sol +36 -0
  294. package/contracts/interfaces/IDiamondLoupe.sol +38 -0
  295. package/contracts/interfaces/IPActionAddRemoveLiq.sol +36 -1
  296. package/contracts/interfaces/IPActionMintRedeem.sol +2 -55
  297. package/contracts/interfaces/IPActionMisc.sol +20 -3
  298. package/contracts/interfaces/IPActionSwapPT.sol +1 -1
  299. package/contracts/interfaces/IPActionSwapYT.sol +28 -4
  300. package/contracts/interfaces/IPAllAction.sol +5 -3
  301. package/contracts/interfaces/IPFeeDistributor.sol +12 -10
  302. package/contracts/interfaces/IPInterestManagerYTV2.sol +13 -0
  303. package/contracts/interfaces/IPYieldTokenV2.sol +66 -0
  304. package/contracts/offchain-helpers/MarketMathStatic.sol +196 -88
  305. package/contracts/offchain-helpers/Multicall2.sol +103 -0
  306. package/contracts/offchain-helpers/PendleMulticall.sol +26 -0
  307. package/contracts/offchain-helpers/RouterStatic.sol +94 -72
  308. package/contracts/router/ActionAddRemoveLiq.sol +116 -6
  309. package/contracts/router/ActionMintRedeem.sol +12 -202
  310. package/contracts/router/ActionMisc.sol +45 -19
  311. package/contracts/router/ActionSwapPT.sol +0 -5
  312. package/contracts/router/ActionSwapYT.sol +98 -13
  313. package/contracts/router/PendleRouter.sol +211 -72
  314. package/contracts/router/{ActionCallback.sol → base/ActionBaseCallback.sol} +47 -47
  315. package/contracts/router/base/ActionBaseMintRedeem.sol +105 -60
  316. package/contracts/router/base/CallbackHelper.sol +137 -44
  317. package/contracts/router/base/MarketApproxLib.sol +227 -350
  318. package/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol +45 -0
  319. package/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol +69 -0
  320. package/contracts/router/swap-aggregator/IPSwapAggregator.sol +30 -0
  321. package/contracts/router/swap-aggregator/PendleSwapAggregator.sol +63 -0
  322. package/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol +214 -0
  323. package/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol +147 -0
  324. package/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol +17 -0
  325. package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol +191 -0
  326. package/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol +30 -0
  327. package/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol +42 -0
  328. package/deployments/43113-core.json +30 -0
  329. package/deployments/43113-markets/APE-30-MARCH.json +10 -0
  330. package/deployments/43113-markets/USDC-FEB-2ND.json +10 -0
  331. package/deployments/43113-markets/USDC-FEB-4TH.json +10 -0
  332. package/deployments/43113-markets/WETH-FEB-2ND.json +11 -0
  333. package/deployments/43113-markets/WETH-FEB-4TH.json +11 -0
  334. package/deployments/43113-offchain-helper.json +4 -0
  335. package/deployments/43113-testenv.json +22 -0
  336. package/deployments/80001-core.json +29 -0
  337. package/deployments/80001-markets/GLP-DEC-8TH.json +10 -0
  338. package/deployments/80001-markets/USDC-DEC-8TH.json +10 -0
  339. package/deployments/80001-markets/USDC-FEB-4TH.json +10 -0
  340. package/deployments/80001-markets/WETH-FEB-4TH.json +11 -0
  341. package/deployments/80001-offchain-helper.json +4 -0
  342. package/deployments/80001-testenv.json +22 -0
  343. package/package.json +6 -6
  344. package/typechain-types/ActionAddRemoveLiq.ts +203 -23
  345. package/typechain-types/ActionBaseCallback.ts +115 -0
  346. package/typechain-types/ActionMintRedeem.ts +29 -230
  347. package/typechain-types/ActionMisc.ts +78 -27
  348. package/typechain-types/ActionSwapPT.ts +26 -31
  349. package/typechain-types/ActionSwapYT.ts +202 -21
  350. package/typechain-types/BribeDistributor.ts +363 -0
  351. package/typechain-types/ComposableStablePreview.ts +217 -0
  352. package/typechain-types/DistributorBase.ts +363 -0
  353. package/typechain-types/FeeDistributor.ts +416 -0
  354. package/typechain-types/GMXPreviewHelper.ts +121 -0
  355. package/typechain-types/I1inchAggregationRouterV5.ts +257 -0
  356. package/typechain-types/IAggregationExecutor.ts +182 -0
  357. package/typechain-types/IApeStaking.ts +305 -0
  358. package/typechain-types/IBalancerFees.ts +89 -0
  359. package/typechain-types/IBalancerStablePreview.ts +217 -0
  360. package/typechain-types/IBasePool.ts +482 -0
  361. package/typechain-types/IComposableStable.ts +730 -0
  362. package/typechain-types/IDiamondCut.ts +152 -0
  363. package/typechain-types/IDiamondLoupe.ts +190 -0
  364. package/typechain-types/IExecutorHelperEthereum1.ts +643 -0
  365. package/typechain-types/IGMXVault.ts +494 -0
  366. package/typechain-types/IGauge.ts +160 -0
  367. package/typechain-types/IGlpManager.ts +115 -0
  368. package/typechain-types/IHashflow.ts +159 -0
  369. package/typechain-types/IKyberSwapAggregationRouterHelper.ts +109 -0
  370. package/typechain-types/ILiquidityGaugeFactory.ts +99 -0
  371. package/typechain-types/IMetaAggregationRouter.ts +213 -0
  372. package/typechain-types/IMetaAggregationRouterV2.ts +221 -0
  373. package/typechain-types/IMetaStablePool.ts +619 -0
  374. package/typechain-types/IMultihopRouterEthereum.ts +209 -0
  375. package/typechain-types/IPActionAddRemoveLiq.ts +213 -14
  376. package/typechain-types/IPActionMintRedeem.ts +29 -211
  377. package/typechain-types/IPActionMisc.ts +78 -27
  378. package/typechain-types/IPActionSwapPT.ts +26 -12
  379. package/typechain-types/IPActionSwapYT.ts +168 -12
  380. package/typechain-types/IPAllAction.ts +445 -227
  381. package/typechain-types/IPFeeDistributor.ts +61 -78
  382. package/typechain-types/IPFeeDistributorFactory.ts +53 -139
  383. package/typechain-types/IPInterestManagerYTV2.ts +117 -0
  384. package/typechain-types/IPSwapAggregator.ts +126 -0
  385. package/typechain-types/IPYieldTokenV2.ts +901 -0
  386. package/typechain-types/IRateProvider.ts +81 -0
  387. package/typechain-types/IRewardRouterV2.ts +303 -0
  388. package/typechain-types/IRewards.ts +35 -5
  389. package/typechain-types/ISwapAggregator.ts +124 -0
  390. package/typechain-types/IVault.ts +410 -0
  391. package/typechain-types/IVaultPriceFeed.ts +114 -0
  392. package/typechain-types/InterestManagerYTV2.ts +157 -0
  393. package/typechain-types/MarketMathStatic.ts +49 -0
  394. package/typechain-types/MetaStableMath.ts +113 -0
  395. package/typechain-types/MetaStablePreview.ts +501 -0
  396. package/typechain-types/Multicall2.ts +437 -0
  397. package/typechain-types/PendleApeStakingSY.ts +1135 -0
  398. package/typechain-types/PendleAura3EthSY.ts +1600 -0
  399. package/typechain-types/PendleAuraBalancerStableLPSY.ts +1523 -0
  400. package/typechain-types/PendleAuraCbethWstethSY.ts +1587 -0
  401. package/typechain-types/PendleAuraWethRethSY.ts +1549 -0
  402. package/typechain-types/PendleAuraWethWstethSY.ts +1523 -0
  403. package/typechain-types/PendleFeeDistributor.ts +409 -117
  404. package/typechain-types/PendleGlpSY.ts +1463 -0
  405. package/typechain-types/PendleMulticall.ts +110 -0
  406. package/typechain-types/PendlePrincipalTokenV2.ts +614 -0
  407. package/typechain-types/PendleRouter.ts +109 -131
  408. package/typechain-types/PendleSwapAggregator.ts +167 -0
  409. package/typechain-types/PendleYieldContractFactoryV2.ts +801 -0
  410. package/typechain-types/PendleYieldTokenV2.ts +1298 -0
  411. package/typechain-types/RouterStatic.ts +132 -69
  412. package/typechain-types/SAPE.ts +1395 -0
  413. package/typechain-types/SYBaseAutoCompound.ts +1203 -0
  414. package/typechain-types/StEthHelper.ts +107 -0
  415. package/typechain-types/StablePreviewBase.ts +217 -0
  416. package/typechain-types/SwapAggregator.ts +406 -0
  417. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +346 -68
  418. package/typechain-types/factories/ActionBaseCallback__factory.ts +156 -0
  419. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  420. package/typechain-types/factories/ActionMintRedeem__factory.ts +108 -266
  421. package/typechain-types/factories/ActionMisc__factory.ts +56 -17
  422. package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
  423. package/typechain-types/factories/ActionSwapPT__factory.ts +55 -71
  424. package/typechain-types/factories/ActionSwapYT__factory.ts +341 -48
  425. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
  426. package/typechain-types/factories/BribeDistributor__factory.ts +303 -0
  427. package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
  428. package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
  429. package/typechain-types/factories/BulkSeller__factory.ts +1 -1
  430. package/typechain-types/factories/ComposableStablePreview__factory.ts +190 -0
  431. package/typechain-types/factories/DistributorBase__factory.ts +249 -0
  432. package/typechain-types/factories/Errors__factory.ts +181 -4
  433. package/typechain-types/factories/FeeDistributor__factory.ts +339 -0
  434. package/typechain-types/factories/GMXPreviewHelper__factory.ts +65 -0
  435. package/typechain-types/factories/I1inchAggregationRouterV5__factory.ts +179 -0
  436. package/typechain-types/factories/IAggregationExecutor__factory.ts +84 -0
  437. package/typechain-types/factories/IApeStaking__factory.ts +161 -0
  438. package/typechain-types/factories/IBalancerFees__factory.ts +36 -0
  439. package/typechain-types/factories/IBalancerStablePreview__factory.ts +152 -0
  440. package/typechain-types/factories/IBasePool__factory.ts +340 -0
  441. package/typechain-types/factories/IComposableStable__factory.ts +482 -0
  442. package/typechain-types/factories/IDiamondCut__factory.ts +105 -0
  443. package/typechain-types/factories/IDiamondLoupe__factory.ts +99 -0
  444. package/typechain-types/factories/IExecutorHelperEthereum1__factory.ts +407 -0
  445. package/typechain-types/factories/IGMXVault__factory.ts +320 -0
  446. package/typechain-types/factories/IGauge__factory.ts +70 -0
  447. package/typechain-types/factories/IGlpManager__factory.ts +55 -0
  448. package/typechain-types/factories/IHashflow__factory.ts +113 -0
  449. package/typechain-types/factories/IKyberSwapAggregationRouterHelper__factory.ts +56 -0
  450. package/typechain-types/factories/ILiquidityGaugeFactory__factory.ts +49 -0
  451. package/typechain-types/factories/IMetaAggregationRouterV2__factory.ts +234 -0
  452. package/typechain-types/factories/IMetaAggregationRouter__factory.ts +202 -0
  453. package/typechain-types/factories/IMetaStablePool__factory.ts +413 -0
  454. package/typechain-types/factories/IMultihopRouterEthereum__factory.ts +155 -0
  455. package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +338 -16
  456. package/typechain-types/factories/IPActionMintRedeem__factory.ts +105 -224
  457. package/typechain-types/factories/IPActionMisc__factory.ts +55 -11
  458. package/typechain-types/factories/IPActionSwapPT__factory.ts +52 -8
  459. package/typechain-types/factories/IPActionSwapYT__factory.ts +231 -8
  460. package/typechain-types/factories/IPAllAction__factory.ts +675 -241
  461. package/typechain-types/factories/IPFeeDistributorFactory__factory.ts +25 -34
  462. package/typechain-types/factories/IPFeeDistributor__factory.ts +42 -31
  463. package/typechain-types/factories/IPInterestManagerYTV2__factory.ts +59 -0
  464. package/typechain-types/factories/IPSwapAggregator__factory.ts +71 -0
  465. package/typechain-types/factories/IPYieldTokenV2__factory.ts +694 -0
  466. package/typechain-types/factories/IRateProvider__factory.ts +36 -0
  467. package/typechain-types/factories/IRewardRouterV2__factory.ts +180 -0
  468. package/typechain-types/factories/IRewards__factory.ts +18 -0
  469. package/typechain-types/factories/ISwapAggregator__factory.ts +66 -0
  470. package/typechain-types/factories/IVaultPriceFeed__factory.ts +60 -0
  471. package/typechain-types/factories/IVault__factory.ts +287 -0
  472. package/typechain-types/factories/InterestManagerYTV2__factory.ts +81 -0
  473. package/typechain-types/factories/MarketMathStatic__factory.ts +41 -27
  474. package/typechain-types/factories/MetaStableMath__factory.ts +93 -0
  475. package/typechain-types/factories/MetaStablePreview__factory.ts +375 -0
  476. package/typechain-types/factories/Multicall2__factory.ts +372 -0
  477. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  478. package/typechain-types/factories/PendleApeStakingSY__factory.ts +981 -0
  479. package/typechain-types/factories/PendleAura3EthSY__factory.ts +1326 -0
  480. package/typechain-types/factories/PendleAuraBalancerStableLPSY__factory.ts +1190 -0
  481. package/typechain-types/factories/PendleAuraCbethWstethSY__factory.ts +1317 -0
  482. package/typechain-types/factories/PendleAuraWethRethSY__factory.ts +1291 -0
  483. package/typechain-types/factories/PendleAuraWethWstethSY__factory.ts +1265 -0
  484. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +1 -1
  485. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +1 -1
  486. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
  487. package/typechain-types/factories/PendleFeeDistributor__factory.ts +341 -66
  488. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  489. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  490. package/typechain-types/factories/PendleGlpSY__factory.ts +1249 -0
  491. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +1 -1
  492. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  493. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  494. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  495. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  496. package/typechain-types/factories/PendleMulticall__factory.ts +100 -0
  497. package/typechain-types/factories/PendlePrincipalTokenV2__factory.ts +564 -0
  498. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
  499. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  500. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
  501. package/typechain-types/factories/PendleRouter__factory.ts +75 -74
  502. package/typechain-types/factories/PendleSwapAggregator__factory.ts +154 -0
  503. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
  504. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
  505. package/typechain-types/factories/PendleYieldContractFactoryV2__factory.ts +674 -0
  506. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
  507. package/typechain-types/factories/PendleYieldTokenV2__factory.ts +1109 -0
  508. package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
  509. package/typechain-types/factories/RouterStatic__factory.ts +186 -41
  510. package/typechain-types/factories/SAPE__factory.ts +1142 -0
  511. package/typechain-types/factories/SYBaseAutoCompound__factory.ts +942 -0
  512. package/typechain-types/factories/StEthHelper__factory.ts +62 -0
  513. package/typechain-types/factories/StablePreviewBase__factory.ts +148 -0
  514. package/typechain-types/factories/SwapAggregator__factory.ts +309 -0
  515. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
  516. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
  517. package/typechain-types/hardhat.d.ts +383 -86
  518. package/typechain-types/index.ts +90 -24
  519. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +0 -4
  520. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +0 -4
  521. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +0 -310
  522. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +0 -4
  523. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +0 -389
  524. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +0 -4
  525. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +0 -190
  526. package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.dbg.json +0 -4
  527. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +0 -4
  528. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +0 -165
  529. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +0 -4
  530. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +0 -343
  531. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +0 -4
  532. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +0 -224
  533. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +0 -4
  534. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.json +0 -35
  535. package/build/artifacts/contracts/router/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +0 -4
  536. package/build/artifacts/contracts/router/kyberswap/IMultihopRouter.sol/IMultihopRouter.json +0 -136
  537. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +0 -4
  538. package/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol +0 -159
  539. package/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol +0 -99
  540. package/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol +0 -70
  541. package/contracts/interfaces/IPActionSwapPTYT.sol +0 -31
  542. package/contracts/interfaces/IPFeeDistributorFactory.sol +0 -14
  543. package/contracts/router/ActionSwapPTYT.sol +0 -108
  544. package/contracts/router/kyberswap/AggregationRouterHelper.sol +0 -317
  545. package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +0 -10
  546. package/contracts/router/kyberswap/IMultihopRouter.sol +0 -139
  547. package/contracts/router/kyberswap/KyberSwapHelper.sol +0 -79
  548. package/deployments/1-core.json +0 -29
  549. package/deployments/1-markets/FRAXUSDC-CURVELP-MARCH30.json +0 -11
  550. package/deployments/1-markets/LOOKS-STAKING-MARCH30.json +0 -10
  551. package/deployments/1-markets/STETH-JUNE29.json +0 -10
  552. package/deployments/1-markets/STETH-MARCH30.json +0 -10
@@ -0,0 +1,244 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../../SYBaseWithRewards.sol";
5
+ import "./GMXPreviewHelper.sol";
6
+ import "../../../../interfaces/GMX/IRewardRouterV2.sol";
7
+ import "../../../../interfaces/GMX/IGlpManager.sol";
8
+ import "../../../../interfaces/GMX/IGMXVault.sol";
9
+
10
+ contract PendleGlpSY is SYBaseWithRewards, GMXPreviewHelper {
11
+ address public immutable glp;
12
+ address public immutable stakedGlp;
13
+ address public immutable rewardRouter;
14
+ address public immutable glpRouter;
15
+ address public immutable glpManager;
16
+ address public immutable weth;
17
+
18
+ constructor(
19
+ string memory _name,
20
+ string memory _symbol,
21
+ address _glp,
22
+ address _fsGlp,
23
+ address _stakedGlp,
24
+ address _rewardRouter,
25
+ address _glpRouter,
26
+ address _vault
27
+ ) SYBaseWithRewards(_name, _symbol, _fsGlp) GMXPreviewHelper(_vault) {
28
+ glp = _glp;
29
+ stakedGlp = _stakedGlp;
30
+ rewardRouter = _rewardRouter;
31
+ glpRouter = _glpRouter;
32
+ glpManager = IRewardRouterV2(glpRouter).glpManager();
33
+ weth = IRewardRouterV2(glpRouter).weth();
34
+
35
+ approveAllWhitelisted();
36
+ }
37
+
38
+ function approveAllWhitelisted() public {
39
+ uint256 length = vault.allWhitelistedTokensLength();
40
+ for (uint256 i = 0; i < length; ++i) {
41
+ address token = vault.allWhitelistedTokens(i);
42
+ if (vault.whitelistedTokens(token)) {
43
+ _safeApproveInf(token, glpManager);
44
+ }
45
+ }
46
+ }
47
+
48
+ /*///////////////////////////////////////////////////////////////
49
+ DEPOSIT/REDEEM USING BASE TOKENS
50
+ //////////////////////////////////////////////////////////////*/
51
+
52
+ /**
53
+ * @dev See {SYBase-_deposit}
54
+ */
55
+ function _deposit(address tokenIn, uint256 amountDeposited)
56
+ internal
57
+ virtual
58
+ override
59
+ returns (uint256 amountSharesOut)
60
+ {
61
+ if (tokenIn == stakedGlp) {
62
+ // GLP is already staked in stakedGlp's transferFrom, called in _transferIn()
63
+ amountSharesOut = amountDeposited;
64
+ } else if (tokenIn == NATIVE) {
65
+ amountSharesOut = IRewardRouterV2(glpRouter).mintAndStakeGlpETH{ value: msg.value }(
66
+ 0,
67
+ 0
68
+ );
69
+ } else {
70
+ amountSharesOut = IRewardRouterV2(glpRouter).mintAndStakeGlp(
71
+ tokenIn,
72
+ amountDeposited,
73
+ 0,
74
+ 0
75
+ );
76
+ }
77
+ }
78
+
79
+ /**
80
+ * @dev See {SYBase-_redeem}
81
+ */
82
+ function _redeem(
83
+ address receiver,
84
+ address tokenOut,
85
+ uint256 amountSharesToRedeem
86
+ ) internal virtual override returns (uint256 amountTokenOut) {
87
+ if (tokenOut == stakedGlp) {
88
+ amountTokenOut = amountSharesToRedeem;
89
+ _transferOut(tokenOut, receiver, amountTokenOut);
90
+ } else if (tokenOut == NATIVE) {
91
+ amountTokenOut = IRewardRouterV2(glpRouter).unstakeAndRedeemGlpETH(
92
+ amountSharesToRedeem,
93
+ 0,
94
+ payable(receiver)
95
+ );
96
+ } else {
97
+ amountTokenOut = IRewardRouterV2(glpRouter).unstakeAndRedeemGlp(
98
+ tokenOut,
99
+ amountSharesToRedeem,
100
+ 0,
101
+ receiver
102
+ );
103
+ }
104
+ }
105
+
106
+ /*///////////////////////////////////////////////////////////////
107
+ EXCHANGE-RATE
108
+ //////////////////////////////////////////////////////////////*/
109
+
110
+ /**
111
+ * @notice Calculates and updates the exchange rate of shares to underlying asset token
112
+ * @dev 1 SY = 1 GLP
113
+ */
114
+ function exchangeRate() public view virtual override returns (uint256) {
115
+ return Math.ONE;
116
+ }
117
+
118
+ /*///////////////////////////////////////////////////////////////
119
+ REWARDS-RELATED
120
+ //////////////////////////////////////////////////////////////*/
121
+
122
+ /**
123
+ * @dev See {IStandardizedYield-getRewardTokens}
124
+ */
125
+ function _getRewardTokens() internal view override returns (address[] memory res) {
126
+ res = new address[](1);
127
+ res[0] = weth;
128
+ }
129
+
130
+ function _redeemExternalReward() internal override {
131
+ IRewardRouterV2(rewardRouter).claim();
132
+ }
133
+
134
+ /*///////////////////////////////////////////////////////////////
135
+ MISC FUNCTIONS FOR METADATA
136
+ //////////////////////////////////////////////////////////////*/
137
+
138
+ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
139
+ internal
140
+ view
141
+ override
142
+ returns (uint256 amountSharesOut)
143
+ {
144
+ if (tokenIn == stakedGlp) amountSharesOut = amountTokenToDeposit;
145
+ else {
146
+ if (tokenIn == NATIVE) tokenIn = weth;
147
+
148
+ // Based on GlpManager's _addLiquidity
149
+ uint256 aumInUsdg = IGlpManager(glpManager).getAumInUsdg(true);
150
+ uint256 glpSupply = IERC20(glp).totalSupply();
151
+ uint256 usdgAmount = super._buyUSDG(tokenIn, amountTokenToDeposit);
152
+
153
+ uint256 mintAmount = aumInUsdg == 0
154
+ ? usdgAmount
155
+ : (usdgAmount * glpSupply) / aumInUsdg;
156
+ amountSharesOut = mintAmount;
157
+ }
158
+ }
159
+
160
+ function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
161
+ internal
162
+ view
163
+ override
164
+ returns (uint256 amountTokenOut)
165
+ {
166
+ if (tokenOut == stakedGlp) amountTokenOut = amountSharesToRedeem;
167
+ else {
168
+ if (tokenOut == NATIVE) tokenOut = weth;
169
+
170
+ // Based on GlpManager's _removeLiquidity
171
+ uint256 aumInUsdg = IGlpManager(glpManager).getAumInUsdg(false);
172
+ uint256 glpSupply = IERC20(glp).totalSupply();
173
+
174
+ uint256 usdgAmount = (amountSharesToRedeem * aumInUsdg) / glpSupply;
175
+ uint256 amountOut = super._sellUSDG(tokenOut, usdgAmount);
176
+
177
+ amountTokenOut = amountOut;
178
+ }
179
+ }
180
+
181
+ function getTokensIn() public view virtual override returns (address[] memory res) {
182
+ res = new address[](vault.whitelistedTokenCount() + 2);
183
+ res[0] = stakedGlp;
184
+ res[1] = NATIVE;
185
+
186
+ uint256 resIndex = 2;
187
+ uint256 length = vault.allWhitelistedTokensLength();
188
+ for (uint256 i = 0; i < length; ) {
189
+ address token = vault.allWhitelistedTokens(i);
190
+ if (vault.whitelistedTokens(token)) {
191
+ res[resIndex] = token;
192
+ unchecked {
193
+ ++resIndex;
194
+ }
195
+ }
196
+ unchecked {
197
+ ++i;
198
+ }
199
+ }
200
+ require(resIndex == res.length, "Wrong whitelisted tokens count");
201
+ }
202
+
203
+ function getTokensOut() public view virtual override returns (address[] memory res) {
204
+ res = new address[](vault.whitelistedTokenCount() + 2);
205
+ res[0] = stakedGlp;
206
+ res[1] = NATIVE;
207
+
208
+ uint256 resIndex = 2;
209
+ uint256 length = vault.allWhitelistedTokensLength();
210
+ for (uint256 i = 0; i < length; ) {
211
+ address token = vault.allWhitelistedTokens(i);
212
+ if (vault.whitelistedTokens(token)) {
213
+ res[resIndex] = token;
214
+ unchecked {
215
+ ++resIndex;
216
+ }
217
+ }
218
+ unchecked {
219
+ ++i;
220
+ }
221
+ }
222
+ require(resIndex == res.length, "Wrong whitelisted tokens count");
223
+ }
224
+
225
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
226
+ return token == stakedGlp || token == NATIVE || vault.whitelistedTokens(token);
227
+ }
228
+
229
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
230
+ return token == stakedGlp || token == NATIVE || vault.whitelistedTokens(token);
231
+ }
232
+
233
+ function assetInfo()
234
+ external
235
+ view
236
+ returns (
237
+ AssetType assetType,
238
+ address assetAddress,
239
+ uint8 assetDecimals
240
+ )
241
+ {
242
+ return (AssetType.LIQUIDITY, glp, IERC20Metadata(glp).decimals());
243
+ }
244
+ }
@@ -0,0 +1,61 @@
1
+ # Audit note GLP SY
2
+
3
+ Our goal is to support SY for the GLP token of GMX.
4
+
5
+ The SY supports mint-and-staking GLP with a whitelisted token (ETH, WBTC, etc) or receiving staked GLP from user.
6
+
7
+ ## Overview
8
+
9
+ + _The main contract_ for the SY is: `PendleGlpSY.sol`.
10
+ This contract contains the main logic ofk all SY operations, except GMX's Vault-related logic for preview functions. This part is contained in the abstract preview contract, which is inherited by the main contract.
11
+
12
+ - _The preview contract_ is: `GMXPreviewHelper.sol`.
13
+ This contract simulates the logic of GMX's Vault to preview buying/selling USDG during deposit/redeem.
14
+
15
+ ## About PendleGlpSY
16
+
17
+ A typical, ordinary SY contract.
18
+
19
+ - _Constructor_: Initialize global variables and approve whitelisted tokens to GMX's GlpManager, which would pull tokens in from the SY contract when minting GLP.
20
+ - There are two routers: _rewardRouter_ is used for claiming rewards,, _glpRouter_ is used to deposit/redeem; hence the two global router variables.
21
+ - _Deposit_:
22
+ - In case of receiving staked GLP, then staked GLP is already pulled in with _transferIn() in SYBase.
23
+ **Note:** StakedGLP (sGLP) is a helper contract by GMX for users to transfer their staked GLP between each other, where staking and unstaking happen behind the scenes. It is not an ERC20 token, but it behaves similar enough to one so that we treat it is ERC20 in the contract.
24
+ - Otherwise, use GlpRewardRouter to mint and stake.
25
+ - _Redeem_: Same as deposit, reversed. If user redeems in staked GLP, _transferOut() is used for staked GLP.
26
+ - _Exchange rate_: The SY directly wraps GLP, so the exchange rate is always 1.
27
+ - _Preview deposit_: Mimics the logic of _\_addLiquidity()_ in GMX's GlpManager. The functions needs to preview _buyUSDG()_ of GMX's Vault, which is mimicked in GMXPreviewHelper.
28
+ - _Preview redeem_: Mimics the logic of _\_removeLiquidity()_ in GMX's GlpManager. The functions needs to preview _sellUSDG()_ of GMX's Vault, which is also mimicked in GMXPreviewHelper.
29
+ - _Get tokens in/out_: Queries whitelisted tokens from GMX's Vault, then return them along with staked GLP and native ETH.
30
+ - _Check valid token in/out_: Calls _whitelistedTokens()_ from GMX's Vault to check.
31
+
32
+ ## About GMXPreviewHelper
33
+
34
+ This contract's purpose is to support preview for _buyUSDG()_ and _sellUSDG()_ functions from GMX's Vault. The contracts has two view functions _buyUSDG()_ and _sellUSDG()_ which mimics their respective Vault counterpart's logic.
35
+
36
+ About _buyUSDG()_:
37
+ - First, _tokenAmount_ is calculated with _transferIn(), which should give the same as the corresponding Vault function.
38
+ - _updateCumulativeFundingRate()_ in Vault should not impact amount out, so this is ignored.
39
+ - For _price_ and _usdgAmount_, the Vault view functions used in Vault's buyUSDG() should behave the same as during actual redeeming, so they are called directly from Vault.
40
+ - For _feeBasisPoints_, _getFeeBasisPoints()_ also behave the same as Vault, becacuse the extra parameter _\_burnedUsdg_ = 0 which has no affect on the return value.
41
+ - For _amountAfterFees_, see _\_collectSwapFees()_ below.
42
+ - Finally, _mintAmount_ is calculated normally.
43
+
44
+ About _sellUSDG()_:
45
+ - Again, first _usdgAmount_ is calculated.
46
+ - _updateCumulativeFundingRate()_ in Vault should not impact amount out, so this is ignored.
47
+ - We directly call Vault's getRedemptionAmount() to calculate _redemptionAmount_. Although _useSwapPricing_ is set to true earlier in Vault's _sellUSDG()_, and _getRedemptionAmount()_ calls _getMaxPrice()_, which then calls priceFeed's _getPrice()_ with _useSwapPricing_ as a parameter, this parameter is then ignored in _getPrice()_. So we can ignore _useSwapPricing_, and Vault's _getRedemptionAmount()_ called in preview should behave the same as actual redeem.
48
+ - Next, _decreaseUsdgAmount() and USDG's _burn()_ are called. This affects USDG balances, which would later affect _getFeeBasisPoints()_.
49
+ - _poolAmounts_ and _tokenBalances_ should not affect the amount out, so _\_decreasePoolAmount()_ and _\_updateTokenBalance()_ are ignored.
50
+ - For _feeBasisPoints_, we need _getFeeBasisPoints()_. But _usdgAmounts[\_token]_ has been decreased by _usdgAmount_, so we account for this by adding parameter _\_burnedUsdg_ in our "fake" _getFeeBasisPoints()_.
51
+ - Finally, _amountOut_ is calculated with _\_collectSwapFees()_.
52
+
53
+ Other helper functions:
54
+ - _\_transferIn()_: Mimics Vault's counterpart, should return the same value.
55
+ - _\_collectSwapFees()_: In Vault, this function only changes _feeReserves_ which does not affect deposit/redeem, so we only need the _afterFeeAmount_.
56
+ - _getFeeBasisPoints()_: Since USDG balances are affected in _sellUSDG()_, another parameter _\_burnedUsdg_ is introduced to account for this decrease in USDG. Namely, this affects:
57
+ - _initialAmount_: The new _usdgAmount[\_token]_ is different, which is calculated here similar to Vault's decreaseUsdgAmount().
58
+ - _getTargetUsdgAmount()_: The formula for the target amount concerns the total supply of USDG, which is affected by _burn()_ in _sellUSDG()_. This is accounted for in our "fake" _getTargetUsdgAmount()_, which takes _\_burnedUsdg_ as parameter and uses it to calculate the real _supply_.
59
+
60
+ In our tests, all - intermediate and final return - values perfectly matches between Vault's functions and our replicas.
61
+
@@ -0,0 +1,114 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../../interfaces/IPYieldToken.sol";
5
+ import "../../interfaces/IPPrincipalToken.sol";
6
+ import "../../interfaces/IPInterestManagerYTV2.sol";
7
+ import "../../interfaces/IPYieldContractFactory.sol";
8
+
9
+ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10
+
11
+ import "../libraries/math/Math.sol";
12
+ import "../libraries/TokenHelper.sol";
13
+ import "../StandardizedYield/SYUtils.sol";
14
+
15
+ /*
16
+ With YT yielding more SYs overtime, which is allowed to be redeemed by users, the reward distribution should
17
+ be based on the amount of SYs that their YT currently represent, plus with their dueInterest.
18
+
19
+ It has been proven and tested that totalSyRedeemable will not change over time, unless users redeem their interest or redeemPY.
20
+
21
+ Due to this, it is required to update users' accruedReward STRICTLY BEFORE redeeming their interest.
22
+ */
23
+ abstract contract InterestManagerYTV2 is TokenHelper, IPInterestManagerYTV2 {
24
+ using Math for uint256;
25
+
26
+ struct UserInterest {
27
+ uint128 index;
28
+ uint128 accrued;
29
+ uint256 pyIndex;
30
+ }
31
+
32
+ uint256 public lastInterestBlock;
33
+
34
+ uint256 public globalInterestIndex;
35
+
36
+ mapping(address => UserInterest) public userInterest;
37
+
38
+ uint256 internal constant INITIAL_INTEREST_INDEX = 1;
39
+
40
+ function _updateAndDistributeInterest(address user) internal virtual {
41
+ _updateAndDistributeInterestForTwo(user, address(0));
42
+ }
43
+
44
+ function _updateAndDistributeInterestForTwo(address user1, address user2) internal virtual {
45
+ (uint256 index, uint256 pyIndex) = _updateInterestIndex();
46
+
47
+ if (user1 != address(0) && user1 != address(this))
48
+ _distributeInterestPrivate(user1, index, pyIndex);
49
+ if (user2 != address(0) && user2 != address(this))
50
+ _distributeInterestPrivate(user2, index, pyIndex);
51
+ }
52
+
53
+ function _doTransferOutInterest(address user, address SY)
54
+ internal
55
+ returns (uint256 interestAmount)
56
+ {
57
+ interestAmount = userInterest[user].accrued;
58
+ userInterest[user].accrued = 0;
59
+ _transferOut(SY, user, interestAmount);
60
+ }
61
+
62
+ // should only be callable from `_distributeInterestForTwo` & make sure user != address(0) && user != address(this)
63
+ function _distributeInterestPrivate(
64
+ address user,
65
+ uint256 currentIndex,
66
+ uint256 pyIndex
67
+ ) private {
68
+ assert(user != address(0) && user != address(this));
69
+
70
+ uint256 prevIndex = userInterest[user].index;
71
+ // uint256 interestFeeRate = _getInterestFeeRate();
72
+
73
+ if (prevIndex == currentIndex) return;
74
+
75
+ if (prevIndex == 0) {
76
+ userInterest[user].index = currentIndex.Uint128();
77
+ userInterest[user].pyIndex = pyIndex;
78
+ return;
79
+ }
80
+
81
+ userInterest[user].accrued += _YTbalance(user).mulDown(currentIndex - prevIndex).Uint128();
82
+ userInterest[user].index = currentIndex.Uint128();
83
+ userInterest[user].pyIndex = pyIndex;
84
+ }
85
+
86
+ function _updateInterestIndex() internal returns (uint256 index, uint256 pyIndex) {
87
+ if (lastInterestBlock != block.number) {
88
+ // if we have not yet update the index for this block
89
+ lastInterestBlock = block.number;
90
+
91
+ uint256 totalShares = _YTSupply();
92
+ uint256 accrued;
93
+
94
+ (accrued, pyIndex) = _collectInterest();
95
+ index = globalInterestIndex;
96
+
97
+ if (index == 0) index = INITIAL_INTEREST_INDEX;
98
+ if (totalShares != 0) index += accrued.divDown(totalShares);
99
+
100
+ globalInterestIndex = index;
101
+ } else {
102
+ index = globalInterestIndex;
103
+ pyIndex = _getGlobalPYIndex();
104
+ }
105
+ }
106
+
107
+ function _getGlobalPYIndex() internal view virtual returns (uint256);
108
+
109
+ function _collectInterest() internal virtual returns (uint256, uint256);
110
+
111
+ function _YTbalance(address user) internal view virtual returns (uint256);
112
+
113
+ function _YTSupply() internal view virtual returns (uint256);
114
+ }
@@ -0,0 +1,63 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../../interfaces/IPPrincipalToken.sol";
5
+ import "../../interfaces/IPYieldToken.sol";
6
+
7
+ import "../libraries/MiniHelpers.sol";
8
+ import "../libraries/Errors.sol";
9
+
10
+ import "../erc20/PendleERC20Permit.sol";
11
+
12
+ import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
13
+
14
+ contract PendlePrincipalTokenV2 is PendleERC20Permit, Initializable, IPPrincipalToken {
15
+ address public immutable SY;
16
+ address public immutable factory;
17
+ uint256 public immutable expiry;
18
+ address public YT;
19
+
20
+ modifier onlyYT() {
21
+ if (msg.sender != YT) revert Errors.OnlyYT();
22
+ _;
23
+ }
24
+
25
+ modifier onlyYieldFactory() {
26
+ if (msg.sender != factory) revert Errors.OnlyYCFactory();
27
+ _;
28
+ }
29
+
30
+ constructor(
31
+ address _SY,
32
+ string memory _name,
33
+ string memory _symbol,
34
+ uint8 __decimals,
35
+ uint256 _expiry
36
+ ) PendleERC20Permit(_name, _symbol, __decimals) {
37
+ SY = _SY;
38
+ expiry = _expiry;
39
+ factory = msg.sender;
40
+ }
41
+
42
+ function initialize(address _YT) external initializer onlyYieldFactory {
43
+ YT = _YT;
44
+ }
45
+
46
+ /**
47
+ * @dev only callable by the YT correspond to this PT
48
+ */
49
+ function burnByYT(address user, uint256 amount) external onlyYT {
50
+ _burn(user, amount);
51
+ }
52
+
53
+ /**
54
+ * @dev only callable by the YT correspond to this PT
55
+ */
56
+ function mintByYT(address user, uint256 amount) external onlyYT {
57
+ _mint(user, amount);
58
+ }
59
+
60
+ function isExpired() public view returns (bool) {
61
+ return MiniHelpers.isCurrentlyExpired(expiry);
62
+ }
63
+ }
@@ -0,0 +1,200 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ /*
3
+ * MIT License
4
+ * ===========
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ */
23
+
24
+ pragma solidity 0.8.17;
25
+
26
+ import "../../interfaces/IPYieldContractFactory.sol";
27
+
28
+ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
29
+ import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
30
+
31
+ import "../libraries/ExpiryUtilsLib.sol";
32
+ import "../libraries/BaseSplitCodeFactory.sol";
33
+ import "../libraries/MiniHelpers.sol";
34
+ import "../libraries/Errors.sol";
35
+ import "../libraries/BoringOwnableUpgradeable.sol";
36
+ import "../libraries/StringLib.sol";
37
+
38
+ import "./PendlePrincipalTokenV2.sol";
39
+ import "./PendleYieldTokenV2.sol";
40
+
41
+ /// @dev If this contract is ever made upgradeable, please pay attention to the numContractDeployed variable
42
+ contract PendleYieldContractFactoryV2 is BoringOwnableUpgradeable, IPYieldContractFactory {
43
+ using ExpiryUtils for string;
44
+ using StringLib for string;
45
+ using StringLib for StringLib.slice;
46
+
47
+ string private constant PT_PREFIX = "PT";
48
+ string private constant YT_PREFIX = "YT";
49
+ string private constant SY_SYMBOL_PREF = "SY-";
50
+ string private constant SY_NAME_PREF = "SY ";
51
+
52
+ address public immutable ytCreationCodeContractA;
53
+ uint256 public immutable ytCreationCodeSizeA;
54
+ address public immutable ytCreationCodeContractB;
55
+ uint256 public immutable ytCreationCodeSizeB;
56
+
57
+ // 1 SLOT
58
+ uint128 public interestFeeRate; // a fixed point number
59
+ uint128 public rewardFeeRate; // a fixed point number
60
+
61
+ // 1 SLOT
62
+ address public treasury;
63
+ uint96 public expiryDivisor;
64
+
65
+ // SY => expiry => address
66
+ // returns address(0) if not created
67
+ mapping(address => mapping(uint256 => address)) public getPT;
68
+ mapping(address => mapping(uint256 => address)) public getYT;
69
+ mapping(address => bool) public isPT;
70
+ mapping(address => bool) public isYT;
71
+
72
+ uint256 public constant maxInterestFeeRate = 2e17; // 20%
73
+ uint256 public constant maxRewardFeeRate = 2e17; // 20%
74
+
75
+ constructor(
76
+ address _ytCreationCodeContractA,
77
+ uint256 _ytCreationCodeSizeA,
78
+ address _ytCreationCodeContractB,
79
+ uint256 _ytCreationCodeSizeB
80
+ ) {
81
+ ytCreationCodeContractA = _ytCreationCodeContractA;
82
+ ytCreationCodeSizeA = _ytCreationCodeSizeA;
83
+ ytCreationCodeContractB = _ytCreationCodeContractB;
84
+ ytCreationCodeSizeB = _ytCreationCodeSizeB;
85
+ }
86
+
87
+ function initialize(
88
+ uint96 _expiryDivisor,
89
+ uint128 _interestFeeRate,
90
+ uint128 _rewardFeeRate,
91
+ address _treasury
92
+ ) external initializer {
93
+ __BoringOwnable_init();
94
+ setExpiryDivisor(_expiryDivisor);
95
+ setInterestFeeRate(_interestFeeRate);
96
+ setRewardFeeRate(_rewardFeeRate);
97
+ setTreasury(_treasury);
98
+ }
99
+
100
+ /**
101
+ * @notice Create a pair of (PT, YT) from any SY and valid expiry. Anyone can create a yield contract
102
+ * @dev It's intentional to make expiry an uint32 to guard against fat fingers. uint32.max is year 2106
103
+ */
104
+ function createYieldContract(
105
+ address SY,
106
+ uint32 expiry,
107
+ bool doCacheIndexSameBlock
108
+ ) external returns (address PT, address YT) {
109
+ if (MiniHelpers.isTimeInThePast(expiry) || expiry % expiryDivisor != 0)
110
+ revert Errors.YCFactoryInvalidExpiry();
111
+
112
+ if (getPT[SY][expiry] != address(0)) revert Errors.YCFactoryYieldContractExisted();
113
+
114
+ IStandardizedYield _SY = IStandardizedYield(SY);
115
+
116
+ (, , uint8 assetDecimals) = _SY.assetInfo();
117
+
118
+ string memory syCoreName = _stripSYPrefix(_SY.name());
119
+ string memory syCoreSymbol = _stripSYPrefix(_SY.symbol());
120
+
121
+ PT = Create2.deploy(
122
+ 0,
123
+ bytes32(block.chainid),
124
+ abi.encodePacked(
125
+ type(PendlePrincipalTokenV2).creationCode,
126
+ abi.encode(
127
+ SY,
128
+ PT_PREFIX.concat(syCoreName, expiry, " "),
129
+ PT_PREFIX.concat(syCoreSymbol, expiry, "-"),
130
+ assetDecimals,
131
+ expiry
132
+ )
133
+ )
134
+ );
135
+
136
+ YT = BaseSplitCodeFactory._create2(
137
+ 0,
138
+ bytes32(block.chainid),
139
+ abi.encode(
140
+ SY,
141
+ PT,
142
+ YT_PREFIX.concat(syCoreName, expiry, " "),
143
+ YT_PREFIX.concat(syCoreSymbol, expiry, "-"),
144
+ assetDecimals,
145
+ expiry,
146
+ doCacheIndexSameBlock
147
+ ),
148
+ ytCreationCodeContractA,
149
+ ytCreationCodeSizeA,
150
+ ytCreationCodeContractB,
151
+ ytCreationCodeSizeB
152
+ );
153
+
154
+ IPPrincipalToken(PT).initialize(YT);
155
+
156
+ getPT[SY][expiry] = PT;
157
+ getYT[SY][expiry] = YT;
158
+ isPT[PT] = true;
159
+ isYT[YT] = true;
160
+
161
+ emit CreateYieldContract(SY, expiry, PT, YT);
162
+ }
163
+
164
+ function setExpiryDivisor(uint96 newExpiryDivisor) public onlyOwner {
165
+ if (newExpiryDivisor == 0) revert Errors.YCFactoryZeroExpiryDivisor();
166
+
167
+ expiryDivisor = newExpiryDivisor;
168
+ emit SetExpiryDivisor(newExpiryDivisor);
169
+ }
170
+
171
+ function setInterestFeeRate(uint128 newInterestFeeRate) public onlyOwner {
172
+ if (newInterestFeeRate > maxInterestFeeRate)
173
+ revert Errors.YCFactoryInterestFeeRateTooHigh(newInterestFeeRate, maxInterestFeeRate);
174
+
175
+ interestFeeRate = newInterestFeeRate;
176
+ emit SetInterestFeeRate(newInterestFeeRate);
177
+ }
178
+
179
+ function setRewardFeeRate(uint128 newRewardFeeRate) public onlyOwner {
180
+ if (newRewardFeeRate > maxRewardFeeRate)
181
+ revert Errors.YCFactoryRewardFeeRateTooHigh(newRewardFeeRate, maxRewardFeeRate);
182
+
183
+ rewardFeeRate = newRewardFeeRate;
184
+ emit SetRewardFeeRate(newRewardFeeRate);
185
+ }
186
+
187
+ function setTreasury(address newTreasury) public onlyOwner {
188
+ if (newTreasury == address(0)) revert Errors.YCFactoryZeroTreasury();
189
+
190
+ treasury = newTreasury;
191
+ emit SetTreasury(newTreasury);
192
+ }
193
+
194
+ function _stripSYPrefix(string memory _str) internal pure returns (string memory) {
195
+ StringLib.slice memory str = _str.toSlice();
196
+ StringLib.slice memory delim_name = SY_NAME_PREF.toSlice();
197
+ StringLib.slice memory delim_symbol = SY_SYMBOL_PREF.toSlice();
198
+ return str.beyond(delim_name).beyond(delim_symbol).toString();
199
+ }
200
+ }