@pendle/core-v2 0.15.2-mainnet → 0.16.0-testnet

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
  2. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +48 -110
  3. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
  4. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
  5. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +21 -75
  6. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
  7. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json +0 -39
  8. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +1 -1
  9. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
  10. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +2 -15
  11. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +1 -1
  12. package/build/artifacts/contracts/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +2 -15
  13. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  14. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +0 -13
  15. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  16. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -15
  17. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  18. package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -15
  19. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  20. package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -46
  21. package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  22. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  23. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +8 -52
  24. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  25. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -15
  26. package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  27. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  28. package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
  29. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
  30. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
  31. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  32. package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
  33. package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
  34. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  35. package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
  36. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
  37. package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
  38. package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  39. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
  40. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
  41. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
  42. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +17 -77
  43. package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
  44. package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
  46. package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
  47. package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
  49. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
  51. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +2 -2
  53. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.dbg.json +4 -0
  54. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol/Pendle3CrvAndTokenSY.json +1018 -0
  55. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +4 -0
  56. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/{base → ConvexCurveLP}/PendleConvexLPSY.sol/PendleConvexLPSY.json +1 -1
  57. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
  58. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +76 -0
  59. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStaking.sol/PendleLooksStaking.dbg.json +4 -0
  60. package/build/artifacts/contracts/core/StandardizedYield/implementations/{PendleLooksStakingSY.sol/PendleLooksStakingSY.json → PendleLooksStaking.sol/PendleLooksStaking.json} +4 -4
  61. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +2 -2
  63. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  64. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  65. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -15
  66. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  67. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +4 -85
  68. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  69. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +4 -17
  70. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  71. package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.json +2 -2
  72. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
  73. package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
  74. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
  75. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +38 -3
  76. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
  77. package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.json +2 -2
  78. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
  79. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.json +0 -13
  80. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
  81. package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.json +2 -2
  82. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
  83. package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +35 -319
  84. package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  85. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
  86. package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +1 -1
  87. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
  88. package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +85 -39
  89. package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
  90. package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +4 -0
  91. package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.json +53 -0
  92. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +4 -0
  93. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.json +45 -0
  94. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
  95. package/build/artifacts/contracts/interfaces/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.json +0 -7
  98. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +17 -91
  100. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +0 -50
  102. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +0 -20
  104. package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
  105. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
  106. package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +0 -20
  107. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  108. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +17 -181
  109. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  110. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +2 -2
  112. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +2 -12
  114. package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  116. package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.json +1 -1
  119. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  120. package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
  121. package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
  122. package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
  123. package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +1 -1
  124. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
  125. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +0 -45
  126. package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
  127. package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
  128. package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
  129. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
  130. package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -15
  131. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
  132. package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +80 -2
  133. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  134. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +60 -299
  135. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
  136. package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +41 -118
  137. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  138. package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +2 -2
  139. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
  140. package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +24 -61
  141. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
  142. package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +2 -2
  143. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
  144. package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +24 -31
  145. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
  146. package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
  147. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
  148. package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +24 -31
  149. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  150. package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -15
  151. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
  152. package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.json +1 -1
  153. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
  154. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
  155. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
  156. package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
  157. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
  158. package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -191
  159. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
  160. package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.json +1 -1
  161. package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +1 -1
  162. package/contracts/core/Market/PendleMarket.sol +7 -18
  163. package/contracts/core/Market/PendleMarketFactory.sol +5 -15
  164. package/contracts/core/StandardizedYield/implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSY.sol +167 -0
  165. package/contracts/core/StandardizedYield/implementations/Convex/{base → ConvexCurveLP}/PendleConvexLPSY.sol +4 -2
  166. package/contracts/core/StandardizedYield/implementations/Convex/Pendle3CrvHelper.sol +83 -0
  167. package/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol +4 -19
  168. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
  169. package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +7 -21
  170. package/contracts/core/YieldContracts/PendleYieldToken.sol +21 -54
  171. package/contracts/core/erc20/PendleERC20.sol +7 -4
  172. package/contracts/core/libraries/BaseSplitCodeFactory.sol +1 -1
  173. package/contracts/core/libraries/BoringOwnableUpgradeable.sol +1 -1
  174. package/contracts/core/libraries/Errors.sol +2 -28
  175. package/contracts/core/libraries/TokenHelper.sol +0 -9
  176. package/contracts/interfaces/ConvexCurve/IBooster.sol +1 -1
  177. package/contracts/interfaces/Curve/ICrvPool.sol +31 -12
  178. package/contracts/interfaces/IPActionAddRemoveLiq.sol +5 -3
  179. package/contracts/interfaces/IPActionMintRedeem.sol +0 -2
  180. package/contracts/interfaces/IPMarketFactory.sol +1 -1
  181. package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
  182. package/contracts/interfaces/IStETH.sol +0 -6
  183. package/contracts/interfaces/IStandardizedYield.sol +10 -15
  184. package/contracts/offchain-helpers/ImplicitSwapfeeContract.sol +30 -0
  185. package/contracts/offchain-helpers/MarketMathStatic.sol +173 -0
  186. package/contracts/offchain-helpers/RouterStatic.sol +50 -189
  187. package/contracts/router/ActionAddRemoveLiq.sol +52 -71
  188. package/contracts/router/ActionCallback.sol +8 -4
  189. package/contracts/router/ActionMintRedeem.sol +18 -27
  190. package/contracts/router/ActionSwapPT.sol +9 -8
  191. package/contracts/router/ActionSwapPTYT.sol +7 -3
  192. package/contracts/router/ActionSwapYT.sol +10 -15
  193. package/contracts/router/PendleRouter.sol +0 -3
  194. package/contracts/router/base/ActionBaseMintRedeem.sol +83 -78
  195. package/contracts/router/base/MarketApproxLib.sol +1 -1
  196. package/contracts/router/kyberswap/AggregationRouterHelper.sol +1 -17
  197. package/contracts/router/kyberswap/KyberSwapHelper.sol +8 -21
  198. package/deployments/43113-core.json +16 -0
  199. package/deployments/43113-helper.json +3 -0
  200. package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
  201. package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
  202. package/deployments/43113-testenv.json +22 -0
  203. package/deployments/80001-core.json +15 -0
  204. package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
  205. package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
  206. package/deployments/80001-testenv.json +22 -0
  207. package/package.json +2 -3
  208. package/typechain-types/ActionAddRemoveLiq.ts +52 -64
  209. package/typechain-types/ActionBaseMintRedeem.ts +8 -8
  210. package/typechain-types/ActionMintRedeem.ts +16 -48
  211. package/typechain-types/ActionSwapPT.ts +12 -34
  212. package/typechain-types/ActionSwapYT.ts +12 -34
  213. package/typechain-types/AggregationRouterHelper.ts +3 -287
  214. package/typechain-types/BaseSplitCodeFactoryContract.ts +0 -9
  215. package/typechain-types/BoringOwnableUpgradeable.ts +0 -9
  216. package/typechain-types/IBooster.ts +3 -9
  217. package/typechain-types/ICrvPool.ts +172 -69
  218. package/typechain-types/ILooksStaking.ts +0 -27
  219. package/typechain-types/IPActionAddRemoveLiq.ts +44 -56
  220. package/typechain-types/IPActionMintRedeem.ts +8 -40
  221. package/typechain-types/IPActionSwapPT.ts +4 -26
  222. package/typechain-types/IPActionSwapYT.ts +4 -26
  223. package/typechain-types/IPAllAction.ts +54 -76
  224. package/typechain-types/IPMarketFactory.ts +2 -2
  225. package/typechain-types/IPMsgSendEndpoint.ts +14 -24
  226. package/typechain-types/IPYieldContractFactory.ts +3 -3
  227. package/typechain-types/IStETH.ts +0 -56
  228. package/typechain-types/ImplicitSwapfeeContract.ts +17 -9
  229. package/typechain-types/KyberSwapHelper.ts +8 -8
  230. package/typechain-types/MarketMathStatic.ts +117 -0
  231. package/typechain-types/PendleFeeDistributor.ts +0 -9
  232. package/typechain-types/PendleFeeDistributorFactory.ts +0 -9
  233. package/typechain-types/PendleGaugeControllerBaseUpg.ts +0 -9
  234. package/typechain-types/PendleGaugeControllerMainchainUpg.ts +0 -9
  235. package/typechain-types/PendleGaugeControllerSidechainUpg.ts +0 -9
  236. package/typechain-types/PendleMarketFactory.ts +2 -51
  237. package/typechain-types/PendleMsgReceiveEndpointUpg.ts +68 -135
  238. package/typechain-types/PendleMsgSendEndpointUpg.ts +39 -108
  239. package/typechain-types/PendleMsgSenderAppUpg.ts +0 -64
  240. package/typechain-types/PendlePrincipalToken.ts +0 -9
  241. package/typechain-types/PendleRouter.ts +0 -9
  242. package/typechain-types/PendleVotingControllerUpg.ts +0 -64
  243. package/typechain-types/PendleYieldContractFactory.ts +8 -57
  244. package/typechain-types/PendleYieldToken.ts +0 -21
  245. package/typechain-types/RouterStatic.ts +20 -302
  246. package/typechain-types/VotingEscrowPendleMainchain.ts +6 -70
  247. package/typechain-types/VotingEscrowPendleSidechain.ts +0 -9
  248. package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +59 -122
  249. package/typechain-types/factories/ActionBaseMintRedeem__factory.ts +1 -1
  250. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  251. package/typechain-types/factories/ActionMintRedeem__factory.ts +42 -65
  252. package/typechain-types/factories/ActionMisc__factory.ts +1 -1
  253. package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
  254. package/typechain-types/factories/ActionSwapPT__factory.ts +42 -35
  255. package/typechain-types/factories/ActionSwapYT__factory.ts +42 -35
  256. package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -190
  257. package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +1 -14
  258. package/typechain-types/factories/BaseSplitCodeFactory__factory.ts +1 -1
  259. package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +1 -1
  260. package/typechain-types/factories/BoringOwnableUpgradeable__factory.ts +0 -13
  261. package/typechain-types/factories/ERC20__factory.ts +1 -1
  262. package/typechain-types/factories/Errors__factory.ts +34 -318
  263. package/typechain-types/factories/IBooster__factory.ts +1 -1
  264. package/typechain-types/factories/ICrvPool__factory.ts +85 -39
  265. package/typechain-types/factories/ILooksStaking__factory.ts +0 -7
  266. package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +17 -91
  267. package/typechain-types/factories/IPActionMintRedeem__factory.ts +0 -50
  268. package/typechain-types/factories/IPActionSwapPT__factory.ts +0 -20
  269. package/typechain-types/factories/IPActionSwapYT__factory.ts +0 -20
  270. package/typechain-types/factories/IPAllAction__factory.ts +17 -181
  271. package/typechain-types/factories/IPMarketFactory__factory.ts +2 -2
  272. package/typechain-types/factories/IPMsgSendEndpoint__factory.ts +2 -12
  273. package/typechain-types/factories/IPYieldContractFactory__factory.ts +1 -1
  274. package/typechain-types/factories/IStETH__factory.ts +0 -45
  275. package/typechain-types/factories/ImplicitSwapfeeContract__factory.ts +12 -4
  276. package/typechain-types/factories/KyberSwapHelper__factory.ts +1 -1
  277. package/typechain-types/factories/MarketMathStatic__factory.ts +79 -1
  278. package/typechain-types/factories/OracleLib__factory.ts +1 -1
  279. package/typechain-types/factories/Pendle3CrvAndTokenSY__factory.ts +1 -1
  280. package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
  281. package/typechain-types/factories/PendleERC20__factory.ts +1 -1
  282. package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -14
  283. package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -14
  284. package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +0 -13
  285. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -14
  286. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -14
  287. package/typechain-types/factories/PendleMarketFactory__factory.ts +16 -76
  288. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  289. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +51 -113
  290. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +23 -84
  291. package/typechain-types/factories/PendleMsgSenderAppUpg__factory.ts +0 -39
  292. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -14
  293. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
  294. package/typechain-types/factories/PendleQiTokenSY__factory.ts +1 -1
  295. package/typechain-types/factories/PendleRouter__factory.ts +1 -14
  296. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +2 -57
  297. package/typechain-types/factories/PendleWstEthSY__factory.ts +1 -1
  298. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +3 -84
  299. package/typechain-types/factories/PendleYieldToken__factory.ts +3 -16
  300. package/typechain-types/factories/RouterStatic__factory.ts +1 -244
  301. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +8 -63
  302. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -14
  303. package/typechain-types/hardhat.d.ts +39 -219
  304. package/typechain-types/index.ts +12 -48
  305. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +0 -4
  306. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.json +0 -10
  307. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +0 -4
  308. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +0 -10
  309. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +0 -4
  310. package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +0 -699
  311. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +0 -4
  312. package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +0 -515
  313. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +0 -4
  314. package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +0 -10
  315. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +0 -4
  316. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +0 -1003
  317. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +0 -4
  318. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +0 -1068
  319. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +0 -4
  320. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.json +0 -10
  321. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +0 -4
  322. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.json +0 -10
  323. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +0 -4
  324. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.json +0 -10
  325. package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +0 -4
  326. package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +0 -4
  327. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +0 -4
  328. package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.json +0 -213
  329. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +0 -4
  330. package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.json +0 -119
  331. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +0 -4
  332. package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.json +0 -39
  333. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +0 -4
  334. package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.json +0 -173
  335. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +0 -4
  336. package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.json +0 -86
  337. package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.dbg.json +0 -4
  338. package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.json +0 -34
  339. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +0 -4
  340. package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +0 -35
  341. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +0 -4
  342. package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.json +0 -35
  343. package/contracts/core/BulkSeller/BulkSeller.sol +0 -259
  344. package/contracts/core/BulkSeller/BulkSellerFactory.sol +0 -88
  345. package/contracts/core/BulkSeller/BulkSellerMathCore.sol +0 -143
  346. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol +0 -102
  347. package/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol +0 -160
  348. package/contracts/core/StandardizedYield/implementations/Convex/README.md +0 -29
  349. package/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol +0 -215
  350. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol +0 -127
  351. package/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol +0 -152
  352. package/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol +0 -122
  353. package/contracts/interfaces/Curve/ITriCrvPool.sol +0 -41
  354. package/contracts/interfaces/ILooksFeeSharing.sol +0 -5
  355. package/contracts/interfaces/ILooksStaking.sol +0 -13
  356. package/contracts/interfaces/IPBulkSeller.sol +0 -28
  357. package/contracts/interfaces/IPBulkSellerFactory.sol +0 -12
  358. package/contracts/interfaces/IPBulkSellerSYCallback.sol +0 -10
  359. package/contracts/offchain-helpers/BulkSellerOffchain.sol +0 -43
  360. package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +0 -10
  361. package/deployments/1-core.json +0 -16
  362. package/deployments/1-markets/FRAX_30_MAR_23.json +0 -8
  363. package/deployments/1-markets/LOOKS_30_MAR_23.json +0 -8
  364. package/deployments/1-markets/STETH_MARCH_30.json +0 -8
  365. package/deployments/1-markets/USDD_MARCH_30.json +0 -8
  366. package/deployments/1-offchain-helper.json +0 -3
  367. package/typechain-types/AccessControl.ts +0 -360
  368. package/typechain-types/AccessControlUpgradeable.ts +0 -369
  369. package/typechain-types/BeaconProxy.ts +0 -97
  370. package/typechain-types/BulkSeller.ts +0 -777
  371. package/typechain-types/BulkSellerFactory.ts +0 -707
  372. package/typechain-types/BulkSellerOffchain.ts +0 -117
  373. package/typechain-types/ContextUpgradeable.ts +0 -68
  374. package/typechain-types/Curve3CrvPoolHelper.ts +0 -236
  375. package/typechain-types/CurveFraxUsdcPoolHelper.ts +0 -158
  376. package/typechain-types/CurveUsdd3CrvPoolHelper.ts +0 -184
  377. package/typechain-types/ERC165.ts +0 -102
  378. package/typechain-types/ERC165Upgradeable.ts +0 -113
  379. package/typechain-types/IAccessControl.ts +0 -305
  380. package/typechain-types/IAccessControlUpgradeable.ts +0 -305
  381. package/typechain-types/IAggregationRouterHelper.ts +0 -108
  382. package/typechain-types/IERC165.ts +0 -102
  383. package/typechain-types/IERC165Upgradeable.ts +0 -102
  384. package/typechain-types/IPBulkSeller.ts +0 -290
  385. package/typechain-types/IPBulkSellerCallback.ts +0 -115
  386. package/typechain-types/IPBulkSellerFactory.ts +0 -147
  387. package/typechain-types/ITriCrvPool.ts +0 -345
  388. package/typechain-types/Initializable.ts +0 -68
  389. package/typechain-types/PendleConvex2TokensSY.ts +0 -1215
  390. package/typechain-types/PendleCurveFraxUsdcSY.ts +0 -1228
  391. package/typechain-types/PendleCurveUsdd3CrvSY.ts +0 -1299
  392. package/typechain-types/PendleLooksStakingSY.ts +0 -1052
  393. package/typechain-types/ReentrancyGuardUpgradeable.ts +0 -68
  394. package/typechain-types/factories/AccessControlUpgradeable__factory.ts +0 -247
  395. package/typechain-types/factories/AccessControl__factory.ts +0 -227
  396. package/typechain-types/factories/BeaconProxy__factory.ts +0 -141
  397. package/typechain-types/factories/BulkSellerFactory__factory.ts +0 -568
  398. package/typechain-types/factories/BulkSellerOffchain__factory.ts +0 -88
  399. package/typechain-types/factories/BulkSeller__factory.ts +0 -749
  400. package/typechain-types/factories/ContextUpgradeable__factory.ts +0 -39
  401. package/typechain-types/factories/Curve3CrvPoolHelper__factory.ts +0 -220
  402. package/typechain-types/factories/CurveFraxUsdcPoolHelper__factory.ts +0 -146
  403. package/typechain-types/factories/CurveUsdd3CrvPoolHelper__factory.ts +0 -172
  404. package/typechain-types/factories/ERC165Upgradeable__factory.ts +0 -58
  405. package/typechain-types/factories/ERC165__factory.ts +0 -39
  406. package/typechain-types/factories/IAccessControlUpgradeable__factory.ts +0 -202
  407. package/typechain-types/factories/IAccessControl__factory.ts +0 -198
  408. package/typechain-types/factories/IAggregationRouterHelper__factory.ts +0 -54
  409. package/typechain-types/factories/IERC165Upgradeable__factory.ts +0 -45
  410. package/typechain-types/factories/IERC165__factory.ts +0 -42
  411. package/typechain-types/factories/IPBulkSellerCallback__factory.ts +0 -53
  412. package/typechain-types/factories/IPBulkSellerFactory__factory.ts +0 -101
  413. package/typechain-types/factories/IPBulkSeller__factory.ts +0 -185
  414. package/typechain-types/factories/ITriCrvPool__factory.ts +0 -225
  415. package/typechain-types/factories/Initializable__factory.ts +0 -36
  416. package/typechain-types/factories/PendleConvex2TokensSY__factory.ts +0 -1093
  417. package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +0 -1068
  418. package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +0 -1133
  419. package/typechain-types/factories/PendleLooksStakingSY__factory.ts +0 -937
  420. package/typechain-types/factories/ReentrancyGuardUpgradeable__factory.ts +0 -43
@@ -1,127 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- import "../../../../libraries/math/Math.sol";
5
- import "../../../../../interfaces/Curve/ICrvPool.sol";
6
- import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7
-
8
- library CurveFraxUsdcPoolHelper {
9
- uint256 internal constant N_COINS = 2;
10
- uint256 internal constant A_PRECISION = 100;
11
- uint256 internal constant PRECISION = 10**18;
12
- uint256 internal constant RATE_0 = 1000000000000000000;
13
- uint256 internal constant RATE_1 = 1000000000000000000000000000000;
14
- uint256 internal constant FEE_DENOMINATOR = 10**10;
15
-
16
- address internal constant POOL = 0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2;
17
- address internal constant LP = 0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC;
18
- address internal constant FRAX = 0x853d955aCEf822Db058eb8505911ED77F175b99e;
19
- address internal constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
20
-
21
- using Math for uint256;
22
-
23
- function previewAddLiquidity(address token, uint256 amount) internal view returns (uint256) {
24
- uint256 amp = ICrvPool(POOL).A_precise();
25
- uint256[N_COINS] memory _amounts = _getTokenAmounts(token, amount);
26
- uint256[N_COINS] memory old_balances = _getBalances();
27
- uint256[N_COINS] memory new_balances;
28
- memcpy(new_balances, old_balances);
29
-
30
- uint256 D0 = _get_D_mem(old_balances, amp);
31
- uint256 total_supply = IERC20(LP).totalSupply();
32
-
33
- for (uint256 i = 0; i < N_COINS; ++i) {
34
- // skip totalSupply = 0 check
35
- new_balances[i] += _amounts[i];
36
- }
37
-
38
- uint256 D1 = _get_D_mem(new_balances, amp);
39
- assert(D1 > D0);
40
-
41
- uint256[N_COINS] memory fees;
42
-
43
- // skip total_supply > 0 check
44
- uint256 fee = (ICrvPool(POOL).fee() * N_COINS) / (4 * (N_COINS - 1));
45
- for (uint256 i = 0; i < N_COINS; ++i) {
46
- uint256 ideal_balance = (D1 * old_balances[i]) / D0;
47
- uint256 difference = 0;
48
- uint256 new_balance = new_balances[i];
49
-
50
- if (ideal_balance > new_balance) {
51
- difference = ideal_balance - new_balance;
52
- } else {
53
- difference = new_balance - ideal_balance;
54
- }
55
- fees[i] = (fee * difference) / FEE_DENOMINATOR;
56
- new_balances[i] -= fees[i];
57
- }
58
- uint256 D2 = _get_D_mem(new_balances, amp);
59
- return (total_supply * (D2 - D0)) / D0;
60
- }
61
-
62
- function _get_D_mem(uint256[N_COINS] memory balances, uint256 _amp)
63
- internal
64
- pure
65
- returns (uint256)
66
- {
67
- uint256[N_COINS] memory _xp;
68
- _xp[0] = (RATE_0 * balances[0]) / PRECISION;
69
- _xp[1] = (RATE_1 * balances[1]) / PRECISION;
70
-
71
- return _get_D(_xp, _amp);
72
- }
73
-
74
- function _get_D(uint256[N_COINS] memory _xp, uint256 _amp) internal pure returns (uint256) {
75
- uint256 S = 0;
76
- uint256 Dprev = 0;
77
-
78
- for (uint256 k = 0; k < N_COINS; ++k) {
79
- S += _xp[k];
80
- }
81
- if (S == 0) return 0;
82
-
83
- uint256 D = S;
84
- uint256 Ann = _amp * N_COINS;
85
-
86
- for (uint256 _i = 0; _i < 255; ++_i) {
87
- uint256 D_P = D;
88
- for (uint256 k = 0; k < N_COINS; ++k) {
89
- D_P = (D_P * D) / (_xp[k] * N_COINS);
90
- }
91
- Dprev = D;
92
- D =
93
- (((Ann * S) / A_PRECISION + D_P * N_COINS) * D) /
94
- (((Ann - A_PRECISION) * D) / A_PRECISION + (N_COINS + 1) * D_P);
95
-
96
- if (D > Dprev) {
97
- if (D - Dprev <= 1) {
98
- return D;
99
- }
100
- } else {
101
- if (Dprev - D <= 1) {
102
- return D;
103
- }
104
- }
105
- }
106
- assert(false);
107
- }
108
-
109
- function _getBalances() internal view returns (uint256[N_COINS] memory balances) {
110
- balances[0] = ICrvPool(POOL).balances(0);
111
- balances[1] = ICrvPool(POOL).balances(1);
112
- }
113
-
114
- function memcpy(uint256[N_COINS] memory a, uint256[N_COINS] memory b) internal pure {
115
- for (uint256 i = 0; i < N_COINS; ++i) {
116
- a[i] = b[i];
117
- }
118
- }
119
-
120
- function _getTokenAmounts(address token, uint256 amount)
121
- internal
122
- pure
123
- returns (uint256[N_COINS] memory res)
124
- {
125
- res[token == FRAX ? 0 : 1] = amount;
126
- }
127
- }
@@ -1,152 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- import "../../../../libraries/math/Math.sol";
5
- import "../../../../../interfaces/Curve/ICrvPool.sol";
6
- import "./Curve3CrvPoolHelper.sol";
7
- import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
8
-
9
- library CurveUsdd3CrvPoolHelper {
10
- using Math for uint256;
11
-
12
- uint256 internal constant N_COINS = 2;
13
- uint256 internal constant A_PRECISION = 100;
14
- uint256 internal constant PRECISION = 10**18;
15
- uint256 internal constant rate_multiplier = 10**18;
16
- uint256 internal constant FEE_DENOMINATOR = 10**10;
17
-
18
- // LP == POOL
19
- address internal constant POOL = 0xe6b5CC1B4b47305c58392CE3D359B10282FC36Ea;
20
- address internal constant USDD = 0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6;
21
- address internal constant LP_3CRV = 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490;
22
-
23
- function _getBalances() internal view returns (uint256[N_COINS] memory balances) {
24
- balances[0] = ICrvPool(POOL).balances(0);
25
- balances[1] = ICrvPool(POOL).balances(1);
26
- }
27
-
28
- function _getTokenAmounts(address token, uint256 amount)
29
- internal
30
- pure
31
- returns (uint256[N_COINS] memory res)
32
- {
33
- res[token == USDD ? 0 : 1] = amount;
34
- }
35
-
36
- // ----------------- Forked from https://etherscan.io/address/0xe6b5CC1B4b47305c58392CE3D359B10282FC36Ea#code -----------------
37
- function previewAddLiquidity(address token, uint256 amount) internal view returns (uint256) {
38
- uint256 amp = ICrvPool(POOL).A_precise();
39
-
40
- uint256[N_COINS] memory rates;
41
-
42
- rates[0] = rate_multiplier;
43
-
44
- if (token == USDD || token == LP_3CRV) {
45
- rates[1] = Curve3CrvPoolHelper.get_virtual_price();
46
- } else {
47
- (amount, rates[1]) = Curve3CrvPoolHelper.preview3CrvDeposit(token, amount);
48
- token = LP_3CRV;
49
- }
50
-
51
- uint256[N_COINS] memory amounts = _getTokenAmounts(token, amount);
52
-
53
- uint256[N_COINS] memory old_balances = _getBalances();
54
- uint256 D0 = get_D_mem(rates, old_balances, amp);
55
- uint256[N_COINS] memory new_balances = arrayClone(old_balances);
56
-
57
- uint256 total_supply = IERC20(POOL).totalSupply();
58
- for (uint256 i = 0; i < N_COINS; ++i) {
59
- new_balances[i] += amounts[i];
60
- }
61
-
62
- // Invariant after change
63
- uint256 D1 = get_D_mem(rates, new_balances, amp);
64
- assert(D1 > D0);
65
-
66
- // We need to recalculate the invariant accounting for fees
67
- // to calculate fair user's share
68
- uint256[N_COINS] memory fees;
69
- uint256 mint_amount = 0;
70
-
71
- uint256 base_fee = (ICrvPool(POOL).fee() * N_COINS) / (4 * (N_COINS - 1));
72
- for (uint256 i = 0; i < N_COINS; ++i) {
73
- uint256 ideal_balance = (D1 * old_balances[i]) / D0;
74
- uint256 difference = 0;
75
- uint256 new_balance = new_balances[i];
76
- if (ideal_balance > new_balance) {
77
- difference = ideal_balance - new_balance;
78
- } else {
79
- difference = new_balance - ideal_balance;
80
- }
81
- fees[i] = (base_fee * difference) / FEE_DENOMINATOR;
82
- new_balances[i] -= fees[i];
83
- }
84
- uint256 D2 = get_D_mem(rates, new_balances, amp);
85
- mint_amount = (total_supply * (D2 - D0)) / D0;
86
- return mint_amount;
87
- }
88
-
89
- function get_D_mem(
90
- uint256[N_COINS] memory _rates,
91
- uint256[N_COINS] memory _balances,
92
- uint256 _amp
93
- ) internal pure returns (uint256) {
94
- uint256[N_COINS] memory xp = _xp_mem(_rates, _balances);
95
- return get_D(xp, _amp);
96
- }
97
-
98
- function _xp_mem(uint256[N_COINS] memory _rates, uint256[N_COINS] memory balances)
99
- internal
100
- pure
101
- returns (uint256[N_COINS] memory)
102
- {
103
- uint256[N_COINS] memory result;
104
- for (uint256 i = 0; i < N_COINS; ++i) {
105
- result[i] = balances[i] * _rates[i] / PRECISION;
106
- }
107
- return result;
108
- }
109
-
110
- function get_D(uint256[N_COINS] memory _xp, uint256 _amp) internal pure returns (uint256) {
111
- uint256 S = 0;
112
- uint256 Dprev = 0;
113
- for (uint256 k = 0; k < N_COINS; ++k) {
114
- S += _xp[k];
115
- }
116
- if (S == 0) return 0;
117
-
118
- uint256 D = S;
119
- uint256 Ann = _amp * N_COINS;
120
- for (uint256 _i = 0; _i < 255; ++_i) {
121
- uint256 D_P = D;
122
- for (uint256 k = 0; k < N_COINS; ++k) {
123
- D_P = (D_P * D) / (_xp[k] * N_COINS);
124
- }
125
- Dprev = D;
126
- D =
127
- (((Ann * S) / A_PRECISION + D_P * N_COINS) * D) /
128
- (((Ann - A_PRECISION) * D) / A_PRECISION + (N_COINS + 1) * D_P);
129
-
130
- if (D > Dprev) {
131
- if (D - Dprev <= 1) {
132
- return D;
133
- }
134
- } else {
135
- if (Dprev - D <= 1) {
136
- return D;
137
- }
138
- }
139
- }
140
- assert(false);
141
- }
142
-
143
- function arrayClone(uint256[N_COINS] memory a)
144
- internal
145
- pure
146
- returns (uint256[N_COINS] memory res)
147
- {
148
- for (uint256 i = 0; i < N_COINS; ++i) {
149
- res[i] = a[i];
150
- }
151
- }
152
- }
@@ -1,122 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- import "../SYBase.sol";
5
- import "../../../interfaces/ILooksFeeSharing.sol";
6
- import "../../../interfaces/ILooksStaking.sol";
7
-
8
- contract PendleLooksStakingSY is SYBase {
9
- using Math for uint256;
10
-
11
- address public immutable looks;
12
- address public immutable stakingContract;
13
- address public immutable feeSharingContract;
14
-
15
- constructor(
16
- string memory _name,
17
- string memory _symbol,
18
- address _looks,
19
- address _stakingContract,
20
- address _feeSharingContract
21
- ) SYBase(_name, _symbol, _looks) {
22
- looks = _looks;
23
- stakingContract = _stakingContract;
24
- feeSharingContract = _feeSharingContract;
25
-
26
- _safeApproveInf(_looks, _stakingContract);
27
- }
28
-
29
- /*///////////////////////////////////////////////////////////////
30
- DEPOSIT/REDEEM USING BASE TOKENS
31
- //////////////////////////////////////////////////////////////*/
32
-
33
- function _deposit(address, uint256 amountDeposited)
34
- internal
35
- virtual
36
- override
37
- returns (uint256 amountSharesOut)
38
- {
39
- uint256 previousShare = ILooksStaking(stakingContract).userInfo(address(this));
40
- ILooksStaking(stakingContract).deposit(amountDeposited);
41
- amountSharesOut = ILooksStaking(stakingContract).userInfo(address(this)) - previousShare;
42
- }
43
-
44
- function _redeem(
45
- address receiver,
46
- address,
47
- uint256 amountSharesToRedeem
48
- ) internal virtual override returns (uint256 amountTokenOut) {
49
- uint256 previousBalance = _selfBalance(looks);
50
- ILooksStaking(stakingContract).withdraw(amountSharesToRedeem);
51
- amountTokenOut = _selfBalance(looks) - previousBalance;
52
- _transferOut(looks, receiver, amountTokenOut);
53
- }
54
-
55
- /*///////////////////////////////////////////////////////////////
56
- EXCHANGE-RATE
57
- //////////////////////////////////////////////////////////////*/
58
-
59
- function exchangeRate() public view virtual override returns (uint256) {
60
- uint256 totalShares = ILooksStaking(stakingContract).totalShares();
61
- uint256 totalLooks = ILooksFeeSharing(feeSharingContract).calculateSharesValueInLOOKS(
62
- stakingContract
63
- );
64
- return totalLooks.divDown(totalShares);
65
- }
66
-
67
- /*///////////////////////////////////////////////////////////////
68
- MISC FUNCTIONS FOR METADATA
69
- //////////////////////////////////////////////////////////////*/
70
-
71
- /**
72
- * @dev LooksRare also uses 1e18 precision, so it is accurate to
73
- * calculate preview results using our built-in exchangeRate function
74
- */
75
- function _previewDeposit(address, uint256 amountTokenToDeposit)
76
- internal
77
- view
78
- override
79
- returns (uint256 amountSharesOut)
80
- {
81
- amountSharesOut = amountTokenToDeposit.divDown(exchangeRate());
82
- }
83
-
84
- function _previewRedeem(address, uint256 amountSharesToRedeem)
85
- internal
86
- view
87
- override
88
- returns (uint256 amountTokenOut)
89
- {
90
- amountTokenOut = amountSharesToRedeem.mulDown(exchangeRate());
91
- }
92
-
93
- function getTokensIn() public view virtual override returns (address[] memory res) {
94
- res = new address[](1);
95
- res[0] = looks;
96
- }
97
-
98
- function getTokensOut() public view virtual override returns (address[] memory res) {
99
- res = new address[](1);
100
- res[0] = looks;
101
- }
102
-
103
- function isValidTokenIn(address token) public view virtual override returns (bool) {
104
- return token == looks;
105
- }
106
-
107
- function isValidTokenOut(address token) public view virtual override returns (bool) {
108
- return token == looks;
109
- }
110
-
111
- function assetInfo()
112
- external
113
- view
114
- returns (
115
- AssetType assetType,
116
- address assetAddress,
117
- uint8 assetDecimals
118
- )
119
- {
120
- return (AssetType.TOKEN, looks, IERC20Metadata(looks).decimals());
121
- }
122
- }
@@ -1,41 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- interface ITriCrvPool {
5
- function coins(uint256 i) external view returns (address);
6
-
7
- function get_virtual_price() external view returns (uint256);
8
-
9
- function lp_token() external view returns (address);
10
-
11
- function fee() external view returns (uint256);
12
-
13
- function admin_fee() external view returns (uint256);
14
-
15
- function exchange(
16
- int128 i,
17
- int128 j,
18
- uint256 dx,
19
- uint256 min_dy // The amount of i being exchanged.
20
- ) external returns (uint256);
21
-
22
- function add_liquidity(
23
- uint256[3] memory _deposit_amount,
24
- uint256 _min_amount
25
- ) external;
26
-
27
- function remove_liquidity_one_coin(
28
- uint256 _burn_amount,
29
- int128 i,
30
- uint256 _min_amount
31
- ) external;
32
-
33
- function calc_withdraw_one_coin(uint256 _burn_amount, int128 i)
34
- external
35
- view
36
- returns (uint256);
37
-
38
- function balances(uint256 i) external view returns (uint256);
39
-
40
- function A() external view returns (uint256);
41
- }
@@ -1,5 +0,0 @@
1
- pragma solidity 0.8.17;
2
-
3
- interface ILooksFeeSharing {
4
- function calculateSharesValueInLOOKS(address user) external view returns (uint256);
5
- }
@@ -1,13 +0,0 @@
1
- pragma solidity 0.8.17;
2
-
3
- interface ILooksStaking {
4
- function totalShares() external view returns (uint256);
5
-
6
- function deposit(uint256 amount) external;
7
-
8
- function userInfo(address user) external view returns (uint256);
9
-
10
- function withdraw(uint256 shares) external;
11
-
12
- function harvestAndSellAndCompound() external;
13
- }
@@ -1,28 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- import "../core/BulkSeller/BulkSellerMathCore.sol";
5
-
6
- interface IPBulkSeller {
7
- function swapExactSyForToken(
8
- address receiver,
9
- uint256 exactSyIn,
10
- uint256 minTokenOut
11
- ) external returns (uint256 netTokenOut);
12
-
13
- function swapExactTokenForSy(
14
- address receiver,
15
- uint256 netTokenIn,
16
- uint256 minSyOut
17
- ) external returns (uint256 netSyOut);
18
-
19
- function calcSwapExactTokenForSy(uint256 netTokenIn) external view returns (uint256 netSyOut);
20
-
21
- function calcSwapExactSyForToken(uint256 netSyIn) external view returns (uint256 netTokenOut);
22
-
23
- function SY() external view returns (address);
24
-
25
- function token() external view returns (address);
26
-
27
- function readState() external view returns (BulkSellerState memory);
28
- }
@@ -1,12 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- interface IPBulkSellerFactory {
5
- event UpgradedBeacon(address indexed implementation);
6
-
7
- function get(address token, address SY) external view returns (address);
8
-
9
- function isMaintainer(address addr) external view returns (bool);
10
-
11
- function isAdmin(address addr) external view returns (bool);
12
- }
@@ -1,10 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- interface IPBulkSellerCallback {
5
- function swapCallback(
6
- int256 ptToAccount,
7
- int256 syToAccount,
8
- bytes calldata data
9
- ) external;
10
- }
@@ -1,43 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity 0.8.17;
3
-
4
- import "../core/BulkSeller/BulkSellerMathCore.sol";
5
- import "../core/BulkSeller/BulkSeller.sol";
6
- import "hardhat/console.sol";
7
-
8
- // upgradable bla bla
9
- contract BulkSellerOffchain {
10
- using BulkSellerMathCore for BulkSellerState;
11
- using Math for uint256;
12
-
13
- // rmb to add fee here
14
- function calcCurrentRates(IPBulkSeller bulk)
15
- external
16
- view
17
- returns (uint256 rateTokenToSy, uint256 rateSyToToken)
18
- {
19
- BulkSellerState memory state = bulk.readState();
20
- address SY = bulk.SY();
21
- address token = bulk.token();
22
-
23
- {
24
- uint256 hypoTotalToken = state.totalToken +
25
- state.totalSy.mulDown(state.rateSyToToken);
26
- uint256 netSyFromToken = IStandardizedYield(SY).previewDeposit(token, hypoTotalToken);
27
-
28
- rateTokenToSy = netSyFromToken.divDown(hypoTotalToken);
29
- }
30
-
31
- {
32
- uint256 hypoTotalSy = state.totalSy + state.totalToken.mulDown(state.rateTokenToSy);
33
- uint256 netTokenFromSy = IStandardizedYield(SY).previewRedeem(token, hypoTotalSy);
34
- rateSyToToken = netTokenFromSy.divDown(hypoTotalSy);
35
- }
36
- }
37
-
38
- // TODO: pause contract when rate is bad compared to market
39
- // TODO: Sound alarm if updates fail
40
- // TODO: audit even the typescript code
41
- // TODO: add a max with currentRate to guarantee no loss?
42
- // TODO: pause immediately if lost enough money
43
- }
@@ -1,10 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
-
3
- pragma solidity 0.8.17;
4
-
5
- interface IAggregationRouterHelper {
6
- function getScaledInputData(bytes calldata kybercall, uint256 newAmount)
7
- external
8
- pure
9
- returns (bytes memory);
10
- }
@@ -1,16 +0,0 @@
1
- {
2
- "deployer": "0x1FcCC097db89A86Bfc474A1028F93958295b1Fb7",
3
- "network": 1,
4
- "splitter": "0x1e56299EbC8A1010cEc26005d12e3e5c5cC2db00",
5
- "celerBus": "0x4066D196A423b2b3B8B054f4F40efB47a74E200C",
6
- "treasury": "0x8D407705b0a3d78167E979f71e009F5820f51C5E",
7
- "PENDLE": "0x59968008a703dC13E6beaECed644bdCe4ee45d13",
8
- "yieldContractFactory": "0xaD511b12F73c145Cf158EB92E4fa256937d952A4",
9
- "marketFactory": "0x4d717868F4Bd14ac8B29Bb6361901e30Ae05e340",
10
- "router": "0xB4205a645c7e920BD8504181B1D7f2c5C955C3e7",
11
- "routerStatic": "0x96F77F24b3d17166FcaF3a9E3B8330fF38B966F9",
12
- "vePendle": "0x6875e4a945e498fe1b90bbb13cfbaf0b68658c9c",
13
- "senderEndpoint": "0xd5C47D2383Fddc19596489280C0A33AC42b2bB18",
14
- "votingController": "0xC33B62D73cf92970e71Ce2A6162C63D4bd7AeB26",
15
- "gaugeController": "0x998CF52b2585e05494BF9F2bF502351a9C7FdA8f"
16
- }
@@ -1,8 +0,0 @@
1
- {
2
- "symbol": "SY-testFRAX-USDC",
3
- "SY": "0x896f4D49916aC5cfC36d7a260a7039ba4Ea317b6",
4
- "expiry": 1680134400,
5
- "PT": "0xa369ba382968bE6cb95ebc666e77bA479414677C",
6
- "YT": "0x16DebA598Af5c182A26eAEf0D73CB3A1d12B8372",
7
- "market": "0x0e3e152673BAf2023502C7Ea38b1B792E1b12eAa"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "symbol": "SY-testLOOKS",
3
- "SY": "0xCE9431Ba71784819FF63BEa631E8D131a8FDBABc",
4
- "expiry": 1680134400,
5
- "PT": "0x84c681550Ec6C2793CE6aD2f906685F2746b5a43",
6
- "YT": "0x39DE6b48ce57F2E41ddceb6977408d39a8Dc6984",
7
- "market": "0xc46AE2E2b09d60A3B3F431EdCcDe63Abc5c992D2"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "symbol": "SY-testETH",
3
- "SY": "0xaA7495dcbe99A8dbd0cfA8b27b95f77565a077c8",
4
- "expiry": 1680134400,
5
- "PT": "0xc7fCFEfB2055ba61118C93722feECDD4A72E160D",
6
- "YT": "0xc4a38a6236B2BcF4f4B25690B4B5f770aD8B1195",
7
- "market": "0x8967Eff7FD95491573576534ed24bD9F5E89fEB2"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "symbol": "SY-testUSDD-3CRV",
3
- "SY": "0x38bB37BC4F871b1485aB5fdfa75c42bA09fb2694",
4
- "expiry": 1680134400,
5
- "PT": "0xbbfe183460119d201e8fa95935f12EF29E2FE1F1",
6
- "YT": "0xee970d5f17cB9e8E67544676DCC4d41385b58c5B",
7
- "market": "0x97b9ba585D1e218fC1F9057A7729D78D2Dc23ab1"
8
- }
@@ -1,3 +0,0 @@
1
- {
2
- "bulkSellerOffchain": "0xFc7A495389cD3454f5cC0Ecaa55D30E343A1Fc16"
3
- }