@pendle/core-v2 0.6.9 → 0.7.0

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 (720) hide show
  1. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +4 -0
  2. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +751 -0
  3. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +4 -0
  4. package/build/artifacts/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol/WadRayMath.json +3 -3
  5. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +4 -0
  6. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +27 -0
  7. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +4 -0
  8. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +761 -0
  9. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +4 -0
  10. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.json +635 -0
  11. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +4 -0
  12. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +609 -0
  13. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.dbg.json +4 -0
  14. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.json +653 -0
  15. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +4 -0
  16. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +622 -0
  17. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +4 -0
  18. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +622 -0
  19. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +4 -0
  20. package/build/artifacts/contracts/SuperComposableYield/{ISuperComposableYield.sol/ISuperComposableYield.json → base-implementations/SCYBase.sol/SCYBase.json} +221 -141
  21. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +4 -0
  22. package/build/artifacts/contracts/SuperComposableYield/{implementations → base-implementations}/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +247 -223
  23. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol/CelerReceiver.dbg.json +4 -0
  24. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol/CelerReceiver.json +128 -0
  25. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSender.sol/CelerSender.dbg.json +4 -0
  26. package/build/artifacts/contracts/{SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.json → core/LiquidityMining/CelerAbstracts/CelerSender.sol/CelerSender.json} +29 -33
  27. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol/PendleGaugeController.dbg.json +4 -0
  28. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol/PendleGaugeController.json +193 -0
  29. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchain.dbg.json +4 -0
  30. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchain.json +255 -0
  31. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechain.dbg.json +4 -0
  32. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechain.json +318 -0
  33. package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +4 -0
  34. package/build/artifacts/contracts/{interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.json → core/LiquidityMining/PendleGauge.sol/PendleGauge.json} +57 -65
  35. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol/PendleVotingController.dbg.json +4 -0
  36. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol/PendleVotingController.json +707 -0
  37. package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol/VotingControllerStorage.dbg.json +4 -0
  38. package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol/VotingControllerStorage.json +342 -0
  39. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +4 -0
  40. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +547 -0
  41. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +4 -0
  42. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +353 -0
  43. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol/VotingEscrowToken.dbg.json +4 -0
  44. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol/VotingEscrowToken.json +138 -0
  45. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +4 -0
  46. package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +922 -0
  47. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +4 -0
  48. package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +345 -0
  49. package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +4 -0
  50. package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +254 -0
  51. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
  52. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
  53. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -20
  55. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +4 -0
  56. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +445 -0
  57. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +4 -0
  58. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +344 -0
  59. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +4 -0
  60. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +750 -0
  61. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
  63. package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +1 -1
  64. package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +123 -77
  65. package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
  66. package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +39 -42
  67. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
  68. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.json +163 -1
  69. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
  70. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.json +0 -13
  71. package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
  72. package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.json +1 -14
  73. package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +4 -0
  74. package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.json +10 -0
  75. package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
  76. package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.json +39 -0
  77. package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
  78. package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
  79. package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
  80. package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.json +13 -0
  81. package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +4 -0
  82. package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.json +74 -0
  83. package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +4 -0
  84. package/build/artifacts/contracts/interfaces/{IVePToken.sol/IVePToken.json → ICelerMessageBus.sol/ICelerMessageBus.json} +21 -11
  85. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +4 -0
  86. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.json +45 -0
  87. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +4 -0
  88. package/build/artifacts/contracts/{core/PendleBaseToken.sol/PendleBaseToken.json → interfaces/IERC4626.sol/IERC4626.json} +53 -68
  89. package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
  90. package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
  91. package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +4 -0
  92. package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.json +962 -0
  93. package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
  94. package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.json +122 -58
  95. package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.json +36 -21
  97. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +116 -81
  99. package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +4 -0
  100. package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.json +109 -0
  101. package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +4 -0
  102. package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.json +132 -0
  103. package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
  104. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  105. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +35 -54
  106. package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.dbg.json +1 -1
  107. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
  108. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +31 -0
  109. package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
  110. package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.json +5 -5
  113. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
  115. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +61 -5
  116. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +4 -0
  117. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +167 -0
  118. package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
  119. package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.json +70 -89
  120. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  121. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  122. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +85 -83
  123. package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +4 -0
  124. package/build/artifacts/contracts/interfaces/{IPBaseToken.sol/IPBaseToken.json → IQiAvax.sol/IQiAvax.json} +106 -15
  125. package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
  126. package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.json +117 -0
  127. package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
  128. package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.json +117 -0
  129. package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
  130. package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +4 -0
  131. package/build/artifacts/contracts/{periphery/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json → interfaces/IRewardManager.sol/IRewardManager.json} +12 -14
  132. package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +4 -0
  133. package/build/artifacts/contracts/{SuperComposableYield/implementations/SCYBase.sol/SCYBase.json → interfaces/ISuperComposableYield.sol/ISuperComposableYield.json} +183 -181
  134. package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
  135. package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
  136. package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.json +13 -0
  137. package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
  138. package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.json +13 -0
  139. package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
  140. package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.json +13 -0
  141. package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +4 -0
  142. package/build/artifacts/contracts/{SuperComposableYield/implementations → libraries}/RewardManager.sol/RewardManager.json +44 -33
  143. package/build/artifacts/contracts/libraries/RewardManagerMini.sol/RewardManagerMini.dbg.json +4 -0
  144. package/build/artifacts/contracts/libraries/RewardManagerMini.sol/RewardManagerMini.json +101 -0
  145. package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +4 -0
  146. package/build/artifacts/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol}/SCYIndexLib.json +3 -3
  147. package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +4 -0
  148. package/build/artifacts/contracts/{SuperComposableYield → libraries/SCY}/SCYUtils.sol/SCYUtils.json +3 -3
  149. package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +4 -0
  150. package/build/artifacts/contracts/libraries/{math/MarketMathAux.sol/MarketMathAux.json → VeBalanceLib.sol/VeBalanceLib.json} +4 -4
  151. package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +4 -0
  152. package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +10 -0
  153. package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
  154. package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.json +2 -2
  155. package/build/artifacts/contracts/libraries/helpers/MiniDeployer.sol/MiniDeployer.dbg.json +4 -0
  156. package/build/artifacts/contracts/libraries/helpers/MiniDeployer.sol/MiniDeployer.json +10 -0
  157. package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +4 -0
  158. package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.json +10 -0
  159. package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +4 -0
  160. package/build/artifacts/contracts/{core/actions/base/ActionType.sol/ActionType.json → libraries/helpers/TokenHelper.sol/TokenHelper.json} +2 -2
  161. package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
  162. package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.json +2 -2
  163. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
  164. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.json +2 -2
  165. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  166. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
  167. package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
  168. package/build/artifacts/contracts/libraries/math/Math.sol/Math.json +2 -2
  169. package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +4 -0
  170. package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +10 -0
  171. package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.dbg.json +4 -0
  172. package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.json +10 -0
  173. package/build/artifacts/contracts/libraries/solmate/LibRLP.sol/LibRLP.dbg.json +4 -0
  174. package/build/artifacts/contracts/libraries/solmate/LibRLP.sol/LibRLP.json +10 -0
  175. package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +4 -0
  176. package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.json +10 -0
  177. package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +4 -0
  178. package/build/artifacts/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol}/JoeLibrary.json +3 -3
  179. package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +4 -0
  180. package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json +24 -0
  181. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +4 -0
  182. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +862 -0
  183. package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.dbg.json +1 -1
  184. package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.json +2 -2
  185. package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
  186. package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +147 -0
  187. package/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol +1 -1
  188. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +74 -0
  189. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +187 -0
  190. package/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol +123 -0
  191. package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +99 -0
  192. package/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol +245 -0
  193. package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +107 -0
  194. package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +120 -0
  195. package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +197 -0
  196. package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +131 -0
  197. package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiver.sol +47 -0
  198. package/contracts/core/LiquidityMining/CelerAbstracts/CelerSender.sol +52 -0
  199. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeController.sol +141 -0
  200. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol +30 -0
  201. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol +22 -0
  202. package/contracts/core/LiquidityMining/PendleGauge.sol +118 -0
  203. package/contracts/core/LiquidityMining/README.md +63 -0
  204. package/contracts/core/LiquidityMining/VotingController/PendleVotingController.sol +323 -0
  205. package/contracts/core/LiquidityMining/VotingController/VotingControllerStorage.sol +224 -0
  206. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +241 -0
  207. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +73 -0
  208. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowToken.sol +53 -0
  209. package/contracts/core/{PendleMarket.sol → Market/PendleMarket.sol} +139 -103
  210. package/contracts/core/{PendleMarketFactory.sol → Market/PendleMarketFactory.sol} +62 -19
  211. package/contracts/core/PendleERC20.sol +358 -0
  212. package/contracts/core/PendleERC20Permit.sol +84 -0
  213. package/contracts/core/PendleRouter.sol +6 -12
  214. package/contracts/core/YieldContracts/InterestManagerYT.sol +87 -0
  215. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +52 -0
  216. package/contracts/core/{PendleYieldContractFactory.sol → YieldContracts/PendleYieldContractFactory.sol} +46 -25
  217. package/contracts/core/YieldContracts/PendleYieldToken.sol +340 -0
  218. package/contracts/core/actions/ActionCallback.sol +63 -43
  219. package/contracts/core/actions/ActionCore.sol +95 -78
  220. package/contracts/core/actions/ActionYT.sol +35 -86
  221. package/contracts/core/actions/base/ActionSCYAndPTBase.sol +133 -78
  222. package/contracts/core/actions/base/ActionSCYAndPYBase.sol +31 -46
  223. package/contracts/core/actions/base/ActionSCYAndYTBase.sol +127 -45
  224. package/contracts/core/actions/base/CallbackHelper.sol +81 -0
  225. package/contracts/interfaces/IAToken.sol +11 -1
  226. package/contracts/interfaces/IAavePool.sol +1 -1
  227. package/contracts/interfaces/IAaveRewardsController.sol +1 -1
  228. package/contracts/interfaces/IBenQiComptroller.sol +3 -1
  229. package/contracts/interfaces/IBenQiInterestRateModel.sol +16 -0
  230. package/contracts/interfaces/ICelerMessageBus.sol +28 -0
  231. package/contracts/interfaces/ICelerMessageReceiverApp.sol +25 -0
  232. package/contracts/interfaces/IERC4626.sol +39 -0
  233. package/contracts/interfaces/IJoeRouter01.sol +1 -1
  234. package/contracts/interfaces/IJoeRouter02.sol +52 -0
  235. package/contracts/interfaces/IPActionCore.sol +44 -27
  236. package/contracts/interfaces/IPActionYT.sol +12 -9
  237. package/contracts/interfaces/IPAllAction.sol +2 -3
  238. package/contracts/interfaces/IPGaugeController.sol +22 -0
  239. package/contracts/interfaces/IPGaugeControllerMainchain.sol +12 -0
  240. package/contracts/interfaces/IPGovernanceManager.sol +1 -1
  241. package/contracts/interfaces/IPInterestManagerYT.sol +9 -0
  242. package/contracts/interfaces/IPMarket.sol +13 -13
  243. package/contracts/interfaces/IPMarketAddRemoveCallback.sol +3 -3
  244. package/contracts/interfaces/IPMarketFactory.sol +8 -1
  245. package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
  246. package/contracts/interfaces/IPPermissionsV2Upg.sol +1 -1
  247. package/contracts/interfaces/IPPrincipalToken.sol +9 -5
  248. package/contracts/interfaces/IPRouterStatic.sol +1 -1
  249. package/contracts/interfaces/IPVeToken.sol +9 -4
  250. package/contracts/interfaces/IPVotingController.sol +21 -0
  251. package/contracts/interfaces/IPVotingEscrow.sol +14 -22
  252. package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
  253. package/contracts/interfaces/IPYieldToken.sol +17 -17
  254. package/contracts/interfaces/IQiAvax.sol +31 -0
  255. package/contracts/interfaces/IQiErc20.sol +1 -1
  256. package/contracts/interfaces/IQiToken.sol +22 -1
  257. package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
  258. package/contracts/interfaces/IRewardManager.sol +9 -0
  259. package/contracts/interfaces/ISuperComposableYield.sol +182 -0
  260. package/contracts/interfaces/IWETH.sol +1 -1
  261. package/contracts/interfaces/IWXBTRFLY.sol +3 -1
  262. package/contracts/interfaces/IWstETH.sol +3 -1
  263. package/contracts/interfaces/IYearnVault.sol +3 -1
  264. package/contracts/libraries/RewardManager.sol +78 -0
  265. package/contracts/libraries/RewardManagerAbstract.sol +81 -0
  266. package/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol} +8 -8
  267. package/contracts/libraries/SCY/SCYUtils.sol +18 -0
  268. package/contracts/libraries/VeBalanceLib.sol +114 -0
  269. package/contracts/libraries/helpers/ArrayLib.sol +65 -0
  270. package/contracts/libraries/helpers/ExpiryUtilsLib.sol +1 -1
  271. package/contracts/libraries/helpers/MiniDeployer.sol +23 -0
  272. package/contracts/libraries/helpers/MiniHelpers.sol +15 -0
  273. package/contracts/libraries/helpers/TokenHelper.sol +105 -0
  274. package/contracts/libraries/math/LogExpMath.sol +59 -1
  275. package/contracts/libraries/math/MarketApproxLib.sol +167 -164
  276. package/contracts/libraries/math/MarketMathCore.sol +106 -25
  277. package/contracts/libraries/math/Math.sol +28 -21
  278. package/contracts/libraries/math/WeekMath.sol +19 -0
  279. package/contracts/libraries/solmate/Bytes32AddressLib.sol +14 -0
  280. package/contracts/libraries/solmate/LibRLP.sol +30 -0
  281. package/contracts/libraries/solmate/SSTORE2.sol +99 -0
  282. package/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol} +3 -2
  283. package/contracts/{periphery → libraries/traderjoe}/PendleJoeSwapHelperUpg.sol +8 -10
  284. package/contracts/{core → offchain-helpers}/RouterStatic.sol +24 -19
  285. package/contracts/periphery/PendleGovernanceManager.sol +1 -1
  286. package/contracts/periphery/PermissionsV2Upg.sol +1 -1
  287. package/package.json +1 -1
  288. package/typechain-types/ActionCore.ts +169 -96
  289. package/typechain-types/{ActionSCYAndYOBase.ts → ActionSCYAndPTBase.ts} +54 -67
  290. package/typechain-types/ActionSCYAndPYBase.ts +0 -13
  291. package/typechain-types/ActionSCYAndYTBase.ts +8 -21
  292. package/typechain-types/ActionYT.ts +73 -64
  293. package/typechain-types/BeaconProxy.ts +97 -0
  294. package/typechain-types/CelerReceiver.ts +267 -0
  295. package/typechain-types/CelerSender.ts +197 -0
  296. package/typechain-types/ERC1967Upgrade.ts +97 -0
  297. package/typechain-types/{ERC20Burnable.ts → ERC20Permit.ts} +116 -68
  298. package/typechain-types/IAToken.ts +55 -0
  299. package/typechain-types/{QiDelegationStorage.ts → IBeacon.ts} +11 -6
  300. package/typechain-types/IBenQiComptroller.ts +13 -0
  301. package/typechain-types/{InterestRateModel.ts → IBenQiInterestRateModel.ts} +12 -28
  302. package/typechain-types/ICelerMessageBus.ts +134 -0
  303. package/typechain-types/{IMessageReceiverApp.ts → ICelerMessageReceiverApp.ts} +19 -9
  304. package/typechain-types/{PermissionsV2.ts → IERC1822Proxiable.ts} +13 -13
  305. package/typechain-types/IERC20Permit.ts +175 -0
  306. package/typechain-types/{ERC20Premined.ts → IERC4626.ts} +103 -113
  307. package/typechain-types/IJoeRouter02.ts +1420 -0
  308. package/typechain-types/IPActionCore.ts +169 -83
  309. package/typechain-types/IPActionYT.ts +65 -43
  310. package/typechain-types/IPAllAction.ts +190 -137
  311. package/typechain-types/IPGauge.ts +1 -138
  312. package/typechain-types/IPGaugeController.ts +191 -0
  313. package/typechain-types/IPGaugeControllerMainchain.ts +236 -0
  314. package/typechain-types/IPMarket.ts +73 -74
  315. package/typechain-types/IPMarketFactory.ts +27 -0
  316. package/typechain-types/IPPrincipalToken.ts +8 -20
  317. package/typechain-types/IPVeToken.ts +103 -8
  318. package/typechain-types/IPVotingController.ts +179 -0
  319. package/typechain-types/IPVotingEscrow.ts +100 -180
  320. package/typechain-types/IPYieldToken.ts +176 -213
  321. package/typechain-types/{IPOwnershipToken.ts → IQiAvax.ts} +190 -127
  322. package/typechain-types/IQiErc20.ts +171 -0
  323. package/typechain-types/IQiToken.ts +171 -0
  324. package/typechain-types/IRewardManager.ts +16 -87
  325. package/typechain-types/ISuperComposableYield.ts +283 -269
  326. package/typechain-types/IWXBTRFLY.ts +13 -0
  327. package/typechain-types/IWstETH.ts +13 -0
  328. package/typechain-types/IYearnVault.ts +13 -0
  329. package/typechain-types/PendleAaveV3SCY.ts +382 -477
  330. package/typechain-types/PendleBtrflyScy.ts +287 -348
  331. package/typechain-types/{EIP20Interface.ts → PendleERC20.ts} +39 -37
  332. package/typechain-types/{ERC20PresetFixedSupply.ts → PendleERC20Permit.ts} +100 -130
  333. package/typechain-types/{LYTBaseWithRewards.ts → PendleERC4626SCY.ts} +311 -316
  334. package/typechain-types/PendleGauge.ts +113 -306
  335. package/typechain-types/PendleGaugeController.ts +346 -0
  336. package/typechain-types/PendleGaugeControllerMainchain.ts +410 -0
  337. package/typechain-types/PendleGaugeControllerSidechain.ts +524 -0
  338. package/typechain-types/{PendleYTLYTBenqi.ts → PendleJoeLpSCY.ts} +336 -362
  339. package/typechain-types/PendleJoeSwapHelperUpg.ts +0 -13
  340. package/typechain-types/PendleMarket.ts +265 -151
  341. package/typechain-types/PendleMarketFactory.ts +111 -16
  342. package/typechain-types/PendleMarketRewards.ts +1317 -0
  343. package/typechain-types/PendlePrincipalToken.ts +103 -130
  344. package/typechain-types/{PermlessAbstract.ts → PendleQiTokenHelper.ts} +5 -5
  345. package/typechain-types/{PendleBenQiErc20LYT.ts → PendleQiTokenSCY.ts} +395 -305
  346. package/typechain-types/PendleRouter.ts +0 -19
  347. package/typechain-types/PendleVotingController.ts +1042 -0
  348. package/typechain-types/{PendleAaveV3LYT.ts → PendleWstEthSCY.ts} +325 -320
  349. package/typechain-types/PendleYearnVaultScy.ts +278 -339
  350. package/typechain-types/PendleYieldContractFactory.ts +43 -27
  351. package/typechain-types/PendleYieldToken.ts +297 -428
  352. package/typechain-types/RewardManager.ts +70 -69
  353. package/typechain-types/RewardManagerMini.ts +200 -0
  354. package/typechain-types/SCYBase.ts +276 -335
  355. package/typechain-types/SCYBaseWithRewards.ts +367 -424
  356. package/typechain-types/VotingControllerStorage.ts +507 -0
  357. package/typechain-types/VotingEscrowPendleMainchain.ts +854 -0
  358. package/typechain-types/VotingEscrowPendleSidechain.ts +546 -0
  359. package/typechain-types/VotingEscrowToken.ts +251 -0
  360. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  361. package/typechain-types/factories/ActionCore__factory.ts +122 -80
  362. package/typechain-types/factories/ActionRedeem__factory.ts +1 -1
  363. package/typechain-types/factories/{ActionSCYAndYOBase__factory.ts → ActionSCYAndPTBase__factory.ts} +20 -33
  364. package/typechain-types/factories/ActionSCYAndPYBase__factory.ts +0 -13
  365. package/typechain-types/factories/ActionSCYAndYTBase__factory.ts +1 -14
  366. package/typechain-types/factories/ActionYT__factory.ts +39 -48
  367. package/typechain-types/factories/BeaconProxy__factory.ts +141 -0
  368. package/typechain-types/factories/{CrosschainReceiver__factory.ts → CelerReceiver__factory.ts} +37 -84
  369. package/typechain-types/factories/CelerSender__factory.ts +85 -0
  370. package/typechain-types/factories/{IRainbowBridge__factory.ts → ERC1967Upgrade__factory.ts} +27 -32
  371. package/typechain-types/factories/{IPOwnershipToken__factory.ts → ERC20Permit__factory.ts} +83 -64
  372. package/typechain-types/factories/ERC20__factory.ts +1 -1
  373. package/typechain-types/factories/IAToken__factory.ts +39 -0
  374. package/typechain-types/factories/{PermissionsV2__factory.ts → IBeacon__factory.ts} +7 -7
  375. package/typechain-types/factories/IBenQiComptroller__factory.ts +13 -0
  376. package/typechain-types/factories/{InterestRateModel__factory.ts → IBenQiInterestRateModel__factory.ts} +12 -27
  377. package/typechain-types/factories/{PendleRouterBase__factory.ts → ICelerMessageBus__factory.ts} +29 -29
  378. package/typechain-types/factories/{IMessageReceiverApp__factory.ts → ICelerMessageReceiverApp__factory.ts} +19 -10
  379. package/typechain-types/factories/{IPermissionsV2__factory.ts → IERC1822Proxiable__factory.ts} +11 -11
  380. package/typechain-types/factories/IERC20Permit__factory.ts +98 -0
  381. package/typechain-types/factories/{ERC20Burnable__factory.ts → IERC4626__factory.ts} +55 -49
  382. package/typechain-types/factories/IJoeRouter02__factory.ts +974 -0
  383. package/typechain-types/factories/IPActionCore__factory.ts +122 -58
  384. package/typechain-types/factories/IPActionYT__factory.ts +36 -21
  385. package/typechain-types/factories/IPAllAction__factory.ts +116 -81
  386. package/typechain-types/factories/IPGaugeControllerMainchain__factory.ts +151 -0
  387. package/typechain-types/factories/IPGaugeController__factory.ts +124 -0
  388. package/typechain-types/factories/IPGauge__factory.ts +3 -86
  389. package/typechain-types/factories/IPMarketFactory__factory.ts +31 -0
  390. package/typechain-types/factories/IPMarket__factory.ts +35 -54
  391. package/typechain-types/factories/IPPrincipalToken__factory.ts +5 -5
  392. package/typechain-types/factories/IPVeToken__factory.ts +61 -5
  393. package/typechain-types/factories/IPVotingController__factory.ts +182 -0
  394. package/typechain-types/factories/IPVotingEscrow__factory.ts +68 -87
  395. package/typechain-types/factories/IPYieldToken__factory.ts +85 -83
  396. package/typechain-types/factories/{ILiquidYieldToken__factory.ts → IQiAvax__factory.ts} +58 -125
  397. package/typechain-types/factories/IQiErc20__factory.ts +117 -0
  398. package/typechain-types/factories/IQiToken__factory.ts +117 -0
  399. package/typechain-types/factories/IRewardManager__factory.ts +5 -47
  400. package/typechain-types/factories/ISuperComposableYield__factory.ts +201 -138
  401. package/typechain-types/factories/IWXBTRFLY__factory.ts +13 -0
  402. package/typechain-types/factories/IWstETH__factory.ts +13 -0
  403. package/typechain-types/factories/IYearnVault__factory.ts +13 -0
  404. package/typechain-types/factories/PendleAaveV3SCY__factory.ts +246 -315
  405. package/typechain-types/factories/PendleBtrflyScy__factory.ts +200 -234
  406. package/typechain-types/factories/PendleERC20Permit__factory.ts +405 -0
  407. package/typechain-types/factories/PendleERC20__factory.ts +327 -0
  408. package/typechain-types/factories/PendleERC4626SCY__factory.ts +678 -0
  409. package/typechain-types/factories/PendleGaugeControllerMainchain__factory.ts +332 -0
  410. package/typechain-types/factories/PendleGaugeControllerSidechain__factory.ts +391 -0
  411. package/typechain-types/factories/{EIP20NonStandardInterface__factory.ts → PendleGaugeController__factory.ts} +90 -91
  412. package/typechain-types/factories/PendleGauge__factory.ts +42 -254
  413. package/typechain-types/factories/PendleGovernanceManager__factory.ts +1 -1
  414. package/typechain-types/factories/PendleJoeLpSCY__factory.ts +726 -0
  415. package/typechain-types/factories/PendleJoeSwapHelperUpg__factory.ts +0 -13
  416. package/typechain-types/factories/PendleMarketFactory__factory.ts +90 -5
  417. package/typechain-types/factories/PendleMarketRewards__factory.ts +1140 -0
  418. package/typechain-types/factories/PendleMarket__factory.ts +182 -94
  419. package/typechain-types/factories/PendlePrincipalToken__factory.ts +74 -77
  420. package/typechain-types/factories/PendleQiTokenHelper__factory.ts +99 -0
  421. package/typechain-types/factories/PendleQiTokenSCY__factory.ts +845 -0
  422. package/typechain-types/factories/PendleRouter__factory.ts +1 -23
  423. package/typechain-types/factories/PendleVotingController__factory.ts +776 -0
  424. package/typechain-types/factories/PendleWstEthSCY__factory.ts +686 -0
  425. package/typechain-types/factories/PendleYearnVaultScy__factory.ts +218 -243
  426. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +39 -29
  427. package/typechain-types/factories/PendleYieldToken__factory.ts +153 -211
  428. package/typechain-types/factories/RewardManagerMini__factory.ts +116 -0
  429. package/typechain-types/factories/RewardManager__factory.ts +43 -32
  430. package/typechain-types/factories/RouterStatic__factory.ts +1 -1
  431. package/typechain-types/factories/SCYBaseWithRewards__factory.ts +242 -218
  432. package/typechain-types/factories/SCYBase__factory.ts +195 -176
  433. package/typechain-types/factories/VotingControllerStorage__factory.ts +361 -0
  434. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +616 -0
  435. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +415 -0
  436. package/typechain-types/factories/VotingEscrowToken__factory.ts +153 -0
  437. package/typechain-types/hardhat.d.ts +327 -156
  438. package/typechain-types/index.ts +88 -50
  439. package/build/artifacts/contracts/SuperComposableYield/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +0 -4
  440. package/build/artifacts/contracts/SuperComposableYield/SCYUtils.sol/SCYUtils.dbg.json +0 -4
  441. package/build/artifacts/contracts/SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.dbg.json +0 -4
  442. package/build/artifacts/contracts/SuperComposableYield/implementations/RewardManager.sol/RewardManager.dbg.json +0 -4
  443. package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBase.sol/SCYBase.dbg.json +0 -4
  444. package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +0 -4
  445. package/build/artifacts/contracts/core/PendleBaseToken.sol/PendleBaseToken.dbg.json +0 -4
  446. package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.dbg.json +0 -4
  447. package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.json +0 -842
  448. package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +0 -4
  449. package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.json +0 -265
  450. package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +0 -4
  451. package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.json +0 -452
  452. package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
  453. package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -783
  454. package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
  455. package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.dbg.json +0 -4
  456. package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.json +0 -766
  457. package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +0 -4
  458. package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.json +0 -641
  459. package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.dbg.json +0 -4
  460. package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.json +0 -623
  461. package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.dbg.json +0 -4
  462. package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.json +0 -623
  463. package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +0 -4
  464. package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +0 -339
  465. package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.dbg.json +0 -4
  466. package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.json +0 -808
  467. package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.dbg.json +0 -4
  468. package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.json +0 -862
  469. package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.dbg.json +0 -4
  470. package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.json +0 -55
  471. package/build/artifacts/contracts/core/actions/base/ActionType.sol/ActionType.dbg.json +0 -4
  472. package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.dbg.json +0 -4
  473. package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.json +0 -55
  474. package/build/artifacts/contracts/interfaces/IPBaseToken.sol/IPBaseToken.dbg.json +0 -4
  475. package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +0 -4
  476. package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.json +0 -113
  477. package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.dbg.json +0 -4
  478. package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.json +0 -61
  479. package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.dbg.json +0 -4
  480. package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.json +0 -113
  481. package/build/artifacts/contracts/interfaces/IVePToken.sol/IVePToken.dbg.json +0 -4
  482. package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.dbg.json +0 -4
  483. package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.json +0 -61
  484. package/build/artifacts/contracts/interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.dbg.json +0 -4
  485. package/build/artifacts/contracts/libraries/JoeLibrary.sol/JoeLibrary.dbg.json +0 -4
  486. package/build/artifacts/contracts/libraries/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
  487. package/build/artifacts/contracts/libraries/math/MarketMathAux.sol/MarketMathAux.dbg.json +0 -4
  488. package/build/artifacts/contracts/periphery/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +0 -4
  489. package/contracts/SuperComposableYield/ISuperComposableYield.sol +0 -80
  490. package/contracts/SuperComposableYield/SCYUtils.sol +0 -14
  491. package/contracts/SuperComposableYield/implementations/IRewardManager.sol +0 -16
  492. package/contracts/SuperComposableYield/implementations/RewardManager.sol +0 -151
  493. package/contracts/SuperComposableYield/implementations/SCYBase.sol +0 -166
  494. package/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol +0 -88
  495. package/contracts/core/PendleBaseToken.sol +0 -35
  496. package/contracts/core/PendlePrincipalToken.sol +0 -54
  497. package/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol +0 -140
  498. package/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol +0 -133
  499. package/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol +0 -120
  500. package/contracts/core/PendleSCYImpl/PendleStETHSCY.sol +0 -107
  501. package/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol +0 -109
  502. package/contracts/core/PendleYieldToken.sol +0 -340
  503. package/contracts/core/actions/ActionRedeem.sol +0 -36
  504. package/contracts/core/actions/base/ActionType.sol +0 -11
  505. package/contracts/interfaces/IPActionRedeem.sol +0 -17
  506. package/contracts/interfaces/IPBaseToken.sol +0 -9
  507. package/contracts/interfaces/IPGauge.sol +0 -32
  508. package/contracts/interfaces/IPVotingEscrowController.sol +0 -14
  509. package/contracts/interfaces/IPendleGauge.sol +0 -32
  510. package/contracts/interfaces/IVePToken.sol +0 -14
  511. package/contracts/interfaces/IVotingEscrowController.sol +0 -14
  512. package/contracts/interfaces/IVotingEscrowPendle.sol +0 -32
  513. package/contracts/libraries/math/MarketMathAux.sol +0 -101
  514. package/typechain-types/AggregatorV2V3Interface.ts +0 -380
  515. package/typechain-types/BenqiChainlinkOracle.ts +0 -362
  516. package/typechain-types/BoringOwnable.ts +0 -194
  517. package/typechain-types/BoringOwnableData.ts +0 -100
  518. package/typechain-types/BoringOwnableUpg.ts +0 -194
  519. package/typechain-types/BoringOwnableUpgData.ts +0 -100
  520. package/typechain-types/Comptroller.ts +0 -2860
  521. package/typechain-types/ComptrollerErrorReporter.ts +0 -70
  522. package/typechain-types/ComptrollerInterface.ts +0 -881
  523. package/typechain-types/ComptrollerVXStorage.ts +0 -781
  524. package/typechain-types/CrosschainContract.ts +0 -113
  525. package/typechain-types/CrosschainReceiver.ts +0 -347
  526. package/typechain-types/CrosschainSender.ts +0 -210
  527. package/typechain-types/EIP20NonStandardInterface.ts +0 -298
  528. package/typechain-types/ERC20Locker.ts +0 -91
  529. package/typechain-types/EpochController.ts +0 -195
  530. package/typechain-types/FundKeeper.ts +0 -347
  531. package/typechain-types/GaugeTypeControllerAbstract.ts +0 -546
  532. package/typechain-types/GaugeTypeControllerCrosschain.ts +0 -733
  533. package/typechain-types/GaugeTypeControllerMainchain.ts +0 -604
  534. package/typechain-types/IGaugeController.ts +0 -99
  535. package/typechain-types/ILiquidYieldToken.ts +0 -639
  536. package/typechain-types/ILiquidYieldTokenWrap.ts +0 -790
  537. package/typechain-types/IMessageBus.ts +0 -543
  538. package/typechain-types/IPFlashCallback.ts +0 -115
  539. package/typechain-types/IPLiquidYieldToken.ts +0 -641
  540. package/typechain-types/IPMarketCallback.ts +0 -107
  541. package/typechain-types/IPRouterCore.ts +0 -769
  542. package/typechain-types/IPRouterRedeem.ts +0 -155
  543. package/typechain-types/IPRouterYT.ts +0 -489
  544. package/typechain-types/IPermissionsV2.ts +0 -87
  545. package/typechain-types/IRainbowBridge.ts +0 -91
  546. package/typechain-types/ISCYRewardIndex.ts +0 -695
  547. package/typechain-types/IVEPendleToken.ts +0 -121
  548. package/typechain-types/IXPendle.ts +0 -114
  549. package/typechain-types/JumpRateModel.ts +0 -347
  550. package/typechain-types/LYTBase.ts +0 -721
  551. package/typechain-types/LYTWrap.ts +0 -872
  552. package/typechain-types/LYTWrapWithRewards.ts +0 -979
  553. package/typechain-types/LiquidityMining.ts +0 -468
  554. package/typechain-types/Maximillion.ts +0 -145
  555. package/typechain-types/Ownable.ts +0 -160
  556. package/typechain-types/PendleBenqiLiquidYieldToken.ts +0 -1013
  557. package/typechain-types/PendleBtrflyLYT.ts +0 -781
  558. package/typechain-types/PendleJoeSwapHelper.ts +0 -92
  559. package/typechain-types/PendleLYTMockYT.ts +0 -894
  560. package/typechain-types/PendleLiquidYieldToken.ts +0 -814
  561. package/typechain-types/PendleLiquidYieldTokenBase.ts +0 -941
  562. package/typechain-types/PendleOwnershipToken.ts +0 -598
  563. package/typechain-types/PendleRouter01.ts +0 -184
  564. package/typechain-types/PendleRouter02.ts +0 -564
  565. package/typechain-types/PendleRouter03.ts +0 -224
  566. package/typechain-types/PendleRouterBase.ts +0 -126
  567. package/typechain-types/PendleRouterCore.ts +0 -328
  568. package/typechain-types/PendleRouterCoreUpg.ts +0 -798
  569. package/typechain-types/PendleRouterLytAndForge.ts +0 -331
  570. package/typechain-types/PendleRouterMarketBase.ts +0 -82
  571. package/typechain-types/PendleRouterOT.ts +0 -463
  572. package/typechain-types/PendleRouterProxy.ts +0 -335
  573. package/typechain-types/PendleRouterRawTokenOT.ts +0 -865
  574. package/typechain-types/PendleRouterRawTokenYT.ts +0 -520
  575. package/typechain-types/PendleRouterRedeemUpg.ts +0 -125
  576. package/typechain-types/PendleRouterSCYAndForgeBaseUpg.ts +0 -98
  577. package/typechain-types/PendleRouterStaticUpg.ts +0 -399
  578. package/typechain-types/PendleRouterYT.ts +0 -227
  579. package/typechain-types/PendleRouterYTBaseUpg.ts +0 -134
  580. package/typechain-types/PendleRouterYTUpg.ts +0 -537
  581. package/typechain-types/PendleYearnVaultLYT.ts +0 -723
  582. package/typechain-types/PglStakingContract.ts +0 -662
  583. package/typechain-types/PglStakingContractProxy.ts +0 -256
  584. package/typechain-types/PglStakingContractProxyStorage.ts +0 -136
  585. package/typechain-types/PglStakingContractStorage.ts +0 -397
  586. package/typechain-types/PriceOracle.ts +0 -116
  587. package/typechain-types/ProtocolFakeUser.ts +0 -105
  588. package/typechain-types/Qi.ts +0 -760
  589. package/typechain-types/QiAvax.ts +0 -1720
  590. package/typechain-types/QiDelegateInterface.ts +0 -145
  591. package/typechain-types/QiDelegatorInterface.ts +0 -149
  592. package/typechain-types/QiErc20.ts +0 -1846
  593. package/typechain-types/QiErc20Delegate.ts +0 -1926
  594. package/typechain-types/QiErc20Delegator.ts +0 -1885
  595. package/typechain-types/QiErc20Interface.ts +0 -382
  596. package/typechain-types/QiErc20Storage.ts +0 -79
  597. package/typechain-types/QiToken.ts +0 -1475
  598. package/typechain-types/QiTokenInterface.ts +0 -1419
  599. package/typechain-types/QiTokenSaleDistributor.ts +0 -771
  600. package/typechain-types/QiTokenSaleDistributorProxy.ts +0 -256
  601. package/typechain-types/QiTokenSaleDistributorProxyStorage.ts +0 -136
  602. package/typechain-types/QiTokenSaleDistributorStorage.ts +0 -401
  603. package/typechain-types/QiTokenStorage.ts +0 -311
  604. package/typechain-types/ReentrancyGuard.ts +0 -52
  605. package/typechain-types/SingleGaugeTypeController.ts +0 -478
  606. package/typechain-types/TokenErrorReporter.ts +0 -70
  607. package/typechain-types/Unitroller.ts +0 -356
  608. package/typechain-types/UnitrollerAdminStorage.ts +0 -143
  609. package/typechain-types/VePendle.ts +0 -1156
  610. package/typechain-types/VePendleCrosschain.ts +0 -969
  611. package/typechain-types/VePendleToken.ts +0 -688
  612. package/typechain-types/VotingController.ts +0 -883
  613. package/typechain-types/WETH9.ts +0 -414
  614. package/typechain-types/WhitePaperInterestRateModel.ts +0 -304
  615. package/typechain-types/XPendle.ts +0 -618
  616. package/typechain-types/factories/AggregatorV2V3Interface__factory.ts +0 -288
  617. package/typechain-types/factories/BenqiChainlinkOracle__factory.ts +0 -311
  618. package/typechain-types/factories/BoringOwnableData__factory.ts +0 -90
  619. package/typechain-types/factories/BoringOwnableUpgData__factory.ts +0 -94
  620. package/typechain-types/factories/BoringOwnableUpg__factory.ts +0 -139
  621. package/typechain-types/factories/BoringOwnable__factory.ts +0 -149
  622. package/typechain-types/factories/ComptrollerErrorReporter__factory.ts +0 -93
  623. package/typechain-types/factories/ComptrollerInterface__factory.ts +0 -595
  624. package/typechain-types/factories/ComptrollerVXStorage__factory.ts +0 -610
  625. package/typechain-types/factories/Comptroller__factory.ts +0 -2189
  626. package/typechain-types/factories/CrosschainContract__factory.ts +0 -52
  627. package/typechain-types/factories/CrosschainSender__factory.ts +0 -104
  628. package/typechain-types/factories/EIP20Interface__factory.ts +0 -248
  629. package/typechain-types/factories/ERC20Locker__factory.ts +0 -73
  630. package/typechain-types/factories/ERC20Premined__factory.ts +0 -393
  631. package/typechain-types/factories/ERC20PresetFixedSupply__factory.ts +0 -422
  632. package/typechain-types/factories/EpochController__factory.ts +0 -170
  633. package/typechain-types/factories/FundKeeper__factory.ts +0 -212
  634. package/typechain-types/factories/GaugeTypeControllerAbstract__factory.ts +0 -387
  635. package/typechain-types/factories/GaugeTypeControllerCrosschain__factory.ts +0 -522
  636. package/typechain-types/factories/GaugeTypeControllerMainchain__factory.ts +0 -431
  637. package/typechain-types/factories/IGaugeController__factory.ts +0 -45
  638. package/typechain-types/factories/ILiquidYieldTokenWrap__factory.ts +0 -533
  639. package/typechain-types/factories/IMessageBus__factory.ts +0 -396
  640. package/typechain-types/factories/IPFlashCallback__factory.ts +0 -49
  641. package/typechain-types/factories/IPLiquidYieldToken__factory.ts +0 -433
  642. package/typechain-types/factories/IPMarketCallback__factory.ts +0 -55
  643. package/typechain-types/factories/IPRouterCore__factory.ts +0 -531
  644. package/typechain-types/factories/IPRouterRedeem__factory.ts +0 -72
  645. package/typechain-types/factories/IPRouterYT__factory.ts +0 -305
  646. package/typechain-types/factories/ISCYRewardIndex__factory.ts +0 -465
  647. package/typechain-types/factories/IVEPendleToken__factory.ts +0 -71
  648. package/typechain-types/factories/IXPendle__factory.ts +0 -61
  649. package/typechain-types/factories/JumpRateModel__factory.ts +0 -334
  650. package/typechain-types/factories/LYTBaseWithRewards__factory.ts +0 -530
  651. package/typechain-types/factories/LYTBase__factory.ts +0 -474
  652. package/typechain-types/factories/LYTWrapWithRewards__factory.ts +0 -643
  653. package/typechain-types/factories/LYTWrap__factory.ts +0 -574
  654. package/typechain-types/factories/LiquidityMining__factory.ts +0 -367
  655. package/typechain-types/factories/Maximillion__factory.ts +0 -125
  656. package/typechain-types/factories/Ownable__factory.ts +0 -75
  657. package/typechain-types/factories/PendleAaveV3LYT__factory.ts +0 -657
  658. package/typechain-types/factories/PendleBenQiErc20LYT__factory.ts +0 -748
  659. package/typechain-types/factories/PendleBenqiLiquidYieldToken__factory.ts +0 -785
  660. package/typechain-types/factories/PendleBtrflyLYT__factory.ts +0 -647
  661. package/typechain-types/factories/PendleJoeSwapHelper__factory.ts +0 -52
  662. package/typechain-types/factories/PendleLYTMockYT__factory.ts +0 -732
  663. package/typechain-types/factories/PendleLiquidYieldTokenBase__factory.ts +0 -603
  664. package/typechain-types/factories/PendleLiquidYieldToken__factory.ts +0 -510
  665. package/typechain-types/factories/PendleOwnershipToken__factory.ts +0 -527
  666. package/typechain-types/factories/PendleRouter01__factory.ts +0 -152
  667. package/typechain-types/factories/PendleRouter02__factory.ts +0 -438
  668. package/typechain-types/factories/PendleRouter03__factory.ts +0 -190
  669. package/typechain-types/factories/PendleRouterCoreUpg__factory.ts +0 -635
  670. package/typechain-types/factories/PendleRouterCore__factory.ts +0 -268
  671. package/typechain-types/factories/PendleRouterLytAndForge__factory.ts +0 -294
  672. package/typechain-types/factories/PendleRouterMarketBase__factory.ts +0 -43
  673. package/typechain-types/factories/PendleRouterOT__factory.ts +0 -372
  674. package/typechain-types/factories/PendleRouterProxy__factory.ts +0 -285
  675. package/typechain-types/factories/PendleRouterRawTokenOT__factory.ts +0 -697
  676. package/typechain-types/factories/PendleRouterRawTokenYT__factory.ts +0 -431
  677. package/typechain-types/factories/PendleRouterRedeemUpg__factory.ts +0 -112
  678. package/typechain-types/factories/PendleRouterSCYAndForgeBaseUpg__factory.ts +0 -56
  679. package/typechain-types/factories/PendleRouterStaticUpg__factory.ts +0 -315
  680. package/typechain-types/factories/PendleRouterYTBaseUpg__factory.ts +0 -66
  681. package/typechain-types/factories/PendleRouterYTUpg__factory.ts +0 -422
  682. package/typechain-types/factories/PendleRouterYT__factory.ts +0 -184
  683. package/typechain-types/factories/PendleYTLYTBenqi__factory.ts +0 -713
  684. package/typechain-types/factories/PendleYearnVaultLYT__factory.ts +0 -586
  685. package/typechain-types/factories/PermlessAbstract__factory.ts +0 -30
  686. package/typechain-types/factories/PglStakingContractProxyStorage__factory.ts +0 -130
  687. package/typechain-types/factories/PglStakingContractProxy__factory.ts +0 -187
  688. package/typechain-types/factories/PglStakingContractStorage__factory.ts +0 -309
  689. package/typechain-types/factories/PglStakingContract__factory.ts +0 -446
  690. package/typechain-types/factories/PriceOracle__factory.ts +0 -59
  691. package/typechain-types/factories/ProtocolFakeUser__factory.ts +0 -87
  692. package/typechain-types/factories/QiAvax__factory.ts +0 -1471
  693. package/typechain-types/factories/QiDelegateInterface__factory.ts +0 -65
  694. package/typechain-types/factories/QiDelegationStorage__factory.ts +0 -79
  695. package/typechain-types/factories/QiDelegatorInterface__factory.ts +0 -89
  696. package/typechain-types/factories/QiErc20Delegate__factory.ts +0 -1563
  697. package/typechain-types/factories/QiErc20Delegator__factory.ts +0 -1648
  698. package/typechain-types/factories/QiErc20Interface__factory.ts +0 -239
  699. package/typechain-types/factories/QiErc20Storage__factory.ts +0 -79
  700. package/typechain-types/factories/QiErc20__factory.ts +0 -1515
  701. package/typechain-types/factories/QiTokenInterface__factory.ts +0 -1182
  702. package/typechain-types/factories/QiTokenSaleDistributorProxyStorage__factory.ts +0 -124
  703. package/typechain-types/factories/QiTokenSaleDistributorProxy__factory.ts +0 -171
  704. package/typechain-types/factories/QiTokenSaleDistributorStorage__factory.ts +0 -289
  705. package/typechain-types/factories/QiTokenSaleDistributor__factory.ts +0 -480
  706. package/typechain-types/factories/QiTokenStorage__factory.ts +0 -274
  707. package/typechain-types/factories/QiToken__factory.ts +0 -1219
  708. package/typechain-types/factories/Qi__factory.ts +0 -648
  709. package/typechain-types/factories/ReentrancyGuard__factory.ts +0 -69
  710. package/typechain-types/factories/SingleGaugeTypeController__factory.ts +0 -341
  711. package/typechain-types/factories/TokenErrorReporter__factory.ts +0 -89
  712. package/typechain-types/factories/UnitrollerAdminStorage__factory.ts +0 -128
  713. package/typechain-types/factories/Unitroller__factory.ts +0 -305
  714. package/typechain-types/factories/VePendleCrosschain__factory.ts +0 -727
  715. package/typechain-types/factories/VePendleToken__factory.ts +0 -494
  716. package/typechain-types/factories/VePendle__factory.ts +0 -800
  717. package/typechain-types/factories/VotingController__factory.ts +0 -610
  718. package/typechain-types/factories/WETH9__factory.ts +0 -342
  719. package/typechain-types/factories/WhitePaperInterestRateModel__factory.ts +0 -281
  720. package/typechain-types/factories/XPendle__factory.ts +0 -473
@@ -0,0 +1,118 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.13;
3
+
4
+ import "../../interfaces/IPGaugeController.sol";
5
+ import "../../interfaces/IPVeToken.sol";
6
+ import "../../interfaces/ISuperComposableYield.sol";
7
+ import "../../libraries/RewardManager.sol";
8
+ import "../../libraries/math/Math.sol";
9
+ import "../../libraries/helpers/ArrayLib.sol";
10
+ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
11
+
12
+ abstract contract PendleGauge is RewardManager {
13
+ using Math for uint256;
14
+ using SafeERC20 for IERC20;
15
+ using ArrayLib for address[];
16
+
17
+ address private immutable SCY;
18
+
19
+ uint256 internal constant TOKENLESS_PRODUCTION = 40;
20
+ address internal immutable PENDLE;
21
+
22
+ IPVeToken public immutable vePENDLE;
23
+ address public immutable gaugeController;
24
+
25
+ uint256 public totalActiveSupply;
26
+ mapping(address => uint256) public activeBalance;
27
+
28
+ constructor(
29
+ address _SCY,
30
+ address _vePendle,
31
+ address _gaugeController
32
+ ) {
33
+ SCY = _SCY;
34
+ vePENDLE = IPVeToken(_vePendle);
35
+ gaugeController = _gaugeController;
36
+ PENDLE = IPGaugeController(gaugeController).pendle();
37
+ }
38
+
39
+ /**
40
+ * @dev It is intended to have user's active balance updated when they try to redeem
41
+ */
42
+ function _redeemRewards(address user) internal virtual returns (uint256[] memory) {
43
+ _updateAndDistributeRewards(user);
44
+ _updateUserActiveBalance(user);
45
+ return _doTransferOutRewards(user, user);
46
+ }
47
+
48
+ /**
49
+ * @dev since rewardShares will be modified after this function, it should update user reward beforehand
50
+ */
51
+ function _updateUserActiveBalance(address user) internal virtual {
52
+ uint256 lpBalance = _stakedBalance(user);
53
+ uint256 veBoostedLpBalance = _calcVeBoostedLpBalance(user, lpBalance);
54
+
55
+ uint256 newActiveBalance = Math.min(veBoostedLpBalance, lpBalance);
56
+
57
+ totalActiveSupply = totalActiveSupply - activeBalance[user] + newActiveBalance;
58
+ activeBalance[user] = newActiveBalance;
59
+ }
60
+
61
+ function _calcVeBoostedLpBalance(address user, uint256 lpBalance)
62
+ internal
63
+ virtual
64
+ returns (uint256)
65
+ {
66
+ uint256 vePendleBalance = vePENDLE.balanceOf(user);
67
+ uint256 vePendleSupply = vePENDLE.totalSupplyCurrent();
68
+ // Inspired by Curve's Gauge
69
+ uint256 veBoostedLpBalance = (lpBalance * TOKENLESS_PRODUCTION) / 100;
70
+ if (vePendleSupply > 0) {
71
+ veBoostedLpBalance +=
72
+ (((_totalStaked() * vePendleBalance) / vePendleSupply) *
73
+ (100 - TOKENLESS_PRODUCTION)) /
74
+ 100;
75
+ }
76
+ return veBoostedLpBalance;
77
+ }
78
+
79
+ function _redeemExternalReward() internal virtual override {
80
+ ISuperComposableYield(SCY).claimRewards(address(this));
81
+ IPGaugeController(gaugeController).claimMarketReward();
82
+ }
83
+
84
+ function _stakedBalance(address user) internal view virtual returns (uint256);
85
+
86
+ function _totalStaked() internal view virtual returns (uint256);
87
+
88
+ function _rewardSharesTotal() internal view virtual override returns (uint256) {
89
+ return totalActiveSupply;
90
+ }
91
+
92
+ function _rewardSharesUser(address user) internal view virtual override returns (uint256) {
93
+ return activeBalance[user];
94
+ }
95
+
96
+ function _getRewardTokens() internal view virtual override returns (address[] memory) {
97
+ address[] memory SCYRewards = ISuperComposableYield(SCY).getRewardTokens();
98
+ if (SCYRewards.contains(PENDLE)) return SCYRewards;
99
+ return SCYRewards.append(PENDLE);
100
+ }
101
+
102
+ function _beforeTokenTransfer(
103
+ address from,
104
+ address to,
105
+ uint256
106
+ ) internal virtual {
107
+ _updateAndDistributeRewardsForTwo(from, to);
108
+ }
109
+
110
+ function _afterTokenTransfer(
111
+ address from,
112
+ address to,
113
+ uint256
114
+ ) internal virtual {
115
+ if (from != address(0) && from != address(this)) _updateUserActiveBalance(from);
116
+ if (to != address(0) && to != address(this)) _updateUserActiveBalance(to);
117
+ }
118
+ }
@@ -0,0 +1,63 @@
1
+ # vePendle For Launch
2
+
3
+ ### Locking PENDLE for vePendle (on ETH)
4
+ * Each user can only lock for a maximum of $MAXLOCKTIME$ = 2 years
5
+ * vePendle balance for users is represented by:
6
+ $balance_u(t) = bias_u - slope_u * t$
7
+
8
+ * As such, we just need to store $bias_u$ and $slope_u$ for each user. (Considerations: store $bias_u$ and $t_{expiry}$ for the user instead, because $t_{expiry}$ is always an exact number)
9
+ * The amount of PENDLE locked by user $u$ is $locked_u$
10
+ * For total supply, it's simply $totalBalance = totalBias - totalSlope * t$
11
+ * Possible actions by an user:
12
+ * User $u$ create a new lock by locking $d_{PENDLE}$ of PENDLE tokens, expiring at $t_{expiry}$
13
+ $slope_u = d_{PENDLE} / MAXLOCKTIME$
14
+ $bias_u = slope_u \cdot t_{expiry}$
15
+ * User $u$ locks an additional of $d_{PENDLE}$ PENDLE tokens, into his existing lock expiring at $t_{expiry}$
16
+ $slope_{u_{new}} = slope_u + d_{PENDLE} / MAXLOCKTIME$
17
+ $bias_{u_{new}} = slope_{u_{new}} \cdot t_{expiry}$
18
+ * User $u$ extends his expiry from $t_{expiry}$ to $t_{expiry_{new}}$
19
+ $bias_{u_{new}} = slope_{u} \cdot t_{expiry_{new}}$
20
+
21
+ * Similar to Curve:
22
+ * We store the checkpoints for when a user's $slope$ or $bias$ changes
23
+ * We restrict the possible expiries to exact weeks from UNIX timestamp 0
24
+ * We store the global bias and slope changes due to expiry of user's vote-locks per week, and process it when the week comes
25
+
26
+ ### Cross-chain messaging module
27
+ * There are contracts inheritting `CelerSender` on governance chain - Ethereum, with a function `sendMessage(chain Y, sender, message)` to send messages to other chains.
28
+ * On each non-governance chain, we have contracts inheritting `CelerReceiver`. Each has a function `afterReceivingMessage(sender, message)` to receive the message from governance.
29
+ * When `sendMessage(chain Y, sender, message)` is called on governance chain, `afterReceivingMessage(sender, message)` will be called on chain Y, thanks to the cross-chain messaging module
30
+ * The current mechanics for the module is using Celer
31
+ * The cross-chain messaging module can be plugged in/plugged out by the governance address (which will initially be controlled by a team multisig)
32
+
33
+ ### Voting for incentives on market and chains
34
+ * On Ethereum, there is a `VotingController` contract to control the voting on incentives for the different markets on the different chains.
35
+ * Adding a new chain:
36
+ * Only the governance address will be able to add markets and a new chains' GaugeController.
37
+ * There is a list of `(market)` that are elligible for the voting, added by governance
38
+ * markets that are expired will be removed by governance
39
+ * vePendle holders can allocate their vePendle to multiple markets on multiple chains
40
+ * Similar to Curve, we store the bias and slope of the total vePendle voted for every market
41
+ * Similary, we adjust the slope/bias changes due to expired vePendle at the weekly mark
42
+ * There is a global PENDLE per second rate for all the incentives across all the chains. This is set by governance.
43
+ * The `VotingController` does not hold any fund. The incentivizing PENDLE is transferred directly to GaugeController by governacne.
44
+ * GaugeControllers: admin can withdraw PENDLE from it
45
+ * In each chain, there is a `GaugeController` contract that is responsible for keeping PENDLE incentives and distributing PENDLE to incentivise different markets.
46
+ * At the finalization of each week (starting of new week), anyone can call a function `finalizeVotingResults` and then `broadcastVotes()` in `VotingController` to broadcast to any chain:
47
+ 1. The PENDLE allocation of each market for the next week
48
+ 2. The timestamp to mark which week is the incentivization coming from
49
+ When this happens, the `GaugeController` in each chain will update the PENDLE per second among the different markets
50
+ * At any time, the governacne has the voting power equivalent to locking X PENDLE in 2 years
51
+
52
+ ### GaugeController
53
+
54
+ Gauge controller will receive the voting results from VotingController and incentivize the amount of PENDLE from `block.timestamp` to `block.timestamp + 1 WEEK`.
55
+
56
+ If there is still leftover reward in each pool, the gauge controller will remove and take the leftover to top up the incentivize for the current week.
57
+
58
+ ### Gauge & Market
59
+ * The Gauge/Market will receive rewardTokens from SCY as well as claiming the PENDLE token from gauge controller. All of the reward tokens (including PENDLE) will be distributed with boosting mechanism
60
+
61
+ ### Broadcasting vePendle balance & different address for boosting rewards for each chain
62
+ * At anytime, an address A could send a cross message to update the vePendle balance on a specific chain
63
+ * The governance reserves the right to set the vePENDLE delegator for some address (for other protocols to build on top).
@@ -0,0 +1,323 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.13;
3
+
4
+ import "./VotingControllerStorage.sol";
5
+ import "../CelerAbstracts/CelerSender.sol";
6
+ import "../../../libraries/VeBalanceLib.sol";
7
+ import "../../../libraries/math/Math.sol";
8
+ import "../../../interfaces/IPGaugeControllerMainchain.sol";
9
+ import "../../../interfaces/IPVotingController.sol";
10
+
11
+ /*
12
+ Voting accounting:
13
+ - For gauge controller, it will consider each message from voting controller
14
+ as a pack of money to incentivize it during the very next WEEK (block.timestamp -> block.timestamp + WEEK)
15
+ - If the reward duration for the last pack of money has not ended, it will combine
16
+ the leftover reward with the current reward to distribute.
17
+
18
+ - In the very extreme case where no one broadcast the result of week x, and at week x+1,
19
+ the results for both are now broadcasted, then the WEEK of (block.timestamp -> WEEK)
20
+ will receive both of the reward pack
21
+ - Each pack of money will has it own id as timestamp, a gauge controller does not
22
+ receive a pack of money with the same id twice, this allow governance to rebroadcast
23
+ in case the last message was corrupted by Celer
24
+
25
+ Pros:
26
+ - If governance does not forget broadcasting the reward on the early of the week,
27
+ the mechanism works just the same as the epoch-based one
28
+ - If governance forget to broadcast the reward, the whole system still works normally,
29
+ the reward is still incentivized, but only approximately fair
30
+ Cons:
31
+ - Does not guarantee the reward will be distributed on epoch start and end
32
+ */
33
+
34
+ contract PendleVotingController is CelerSender, VotingControllerStorage, IPVotingController {
35
+ using VeBalanceLib for VeBalance;
36
+ using Math for uint256;
37
+ using Math for int256;
38
+ using EnumerableMap for EnumerableMap.UintToAddressMap;
39
+ using EnumerableSet for EnumerableSet.AddressSet;
40
+
41
+ constructor(address _vePendle, address _governanceManager)
42
+ VotingControllerStorage(_vePendle)
43
+ CelerSender(_governanceManager)
44
+ {}
45
+
46
+ /*///////////////////////////////////////////////////////////////
47
+ FUNCTIONS CAN BE CALLED BY ANYONE
48
+ //////////////////////////////////////////////////////////////*/
49
+
50
+ /**
51
+ * @notice set a new voting weight for the target pool
52
+ * @dev pre-condition:
53
+ - pool must have been added before
54
+ - the vePENDLE position must still be active
55
+ * @dev state changes expected:
56
+ - update weekData (if any)
57
+ - update poolInfo, userData to reflect the new vote
58
+ - add 1 check point for both the unvote & new vote
59
+ * @dev vePENDLE position not expired is a must, else bias - t*slope < 0 & it will be
60
+ negative weight
61
+ */
62
+ function vote(address pool, uint64 weight) external {
63
+ address user = msg.sender;
64
+
65
+ require(weight != 0, "zero weight");
66
+ require(_isPoolVotable(pool), "invalid pool");
67
+ require(!vePendle.isPositionExpired(user), "user position expired");
68
+
69
+ updatePoolVotes(pool);
70
+ _unvote(user, pool, false);
71
+ _vote(user, pool, weight);
72
+ }
73
+
74
+ /**
75
+ * @notice remove the vote from the current pool
76
+ * @dev no pre-condition as opposed to vote since this function is to clear the vote
77
+ * @dev allow removing vote from a non-votable pool BY not requiring pool to be votable
78
+ * @dev state changes expected:
79
+ - update weekData (if any)
80
+ - update poolInfo, userData to reflect the new vote
81
+ - add 1 check point for the unvote
82
+ */
83
+ function unvote(address pool) external {
84
+ if (_isPoolVotable(pool)) {
85
+ updatePoolVotes(pool);
86
+ }
87
+ _unvote(msg.sender, pool, true);
88
+ }
89
+
90
+ /**
91
+ * @notice Process all the slopeChanges that haven't been processed & update these data into
92
+ poolInfo
93
+ * @dev pre-condition: the pool must be votable
94
+ * @dev state changes expected:
95
+ - update weekData
96
+ - update poolInfo
97
+ */
98
+ function updatePoolVotes(address pool) public {
99
+ require(_isPoolVotable(pool), "invalid pool");
100
+
101
+ uint128 wTime = poolInfo[pool].lastUpdated;
102
+ uint128 currentWeekStart = WeekMath.getCurrentWeekStart();
103
+
104
+ // no state changes are expected
105
+ if (wTime >= currentWeekStart) return;
106
+
107
+ VeBalance memory currentVote = poolInfo[pool].vote;
108
+ while (wTime < currentWeekStart) {
109
+ wTime += WEEK;
110
+ currentVote = currentVote.sub(poolInfo[pool].slopeChanges[wTime], wTime);
111
+ _setFinalPoolVoteForWeek(pool, wTime, currentVote.getValueAt(wTime));
112
+ }
113
+
114
+ _setNewVotePoolInfo(pool, currentVote, wTime);
115
+ }
116
+
117
+ /**
118
+ * @notice finalize the voting results of all pools, up to the current epoch
119
+ * @dev state changes expected:
120
+ - weekData, poolInfo is updated for all pools in allPools
121
+ - isEpochFinalized is set to true for all epochs since the last time until now
122
+ * @dev this function might take a lot of gas, but can be mitigated by calling updatePoolVotes
123
+ separately, hence reduce the number of states to be updated
124
+ */
125
+ function finalizeEpoch() public {
126
+ uint256 length = allPools.length();
127
+ for (uint256 i = 0; i < length; ++i) {
128
+ updatePoolVotes(allPools.at(i));
129
+ }
130
+ _setAllPastEpochsAsFinalized();
131
+ }
132
+
133
+ /**
134
+ * @notice broadcast the voting results of the current week to the chain with chainId. Can be
135
+ called by anyone
136
+ * @dev pre-condition: the epoch must have already been finalized by finalizeEpoch
137
+ * @dev state changes expected:
138
+ - the gaugeController receives the new pendle allocation
139
+ */
140
+ function broadcastResults(uint64 chainId) external payable {
141
+ uint128 wTime = WeekMath.getCurrentWeekStart();
142
+ require(isEpochFinalized[wTime], "epoch not finalized");
143
+ _broadcastResults(chainId, wTime, pendlePerSec);
144
+ }
145
+
146
+ /*///////////////////////////////////////////////////////////////
147
+ GOVERNANCE-ONLY FUNCTIONS
148
+ //////////////////////////////////////////////////////////////*/
149
+
150
+ /**
151
+ * @notice add a pool to allow users to vote. Can only be done by governance
152
+ * @dev pre-condition: pool must not have been added before
153
+ * @dev assumption: chainId is valid, pool does exist on the chain (guaranteed by gov)
154
+ * @dev state changes expected:
155
+ - add to allPools & chainPools
156
+ - set params in poolInfo
157
+ */
158
+ function addPool(uint64 chainId, address pool) external onlyGovernance {
159
+ require(!_isPoolVotable(pool), "pool already added");
160
+ _addPool(chainId, pool);
161
+ emit AddPool(chainId, pool);
162
+ }
163
+
164
+ /**
165
+ * @notice remove a pool from voting. Can only be done by governance
166
+ * @dev pre-condition: pool must have been added before
167
+ * @dev state changes expected:
168
+ - update weekData (if any)
169
+ - remove from allPools & chainPools
170
+ - clear info in poolInfo
171
+ */
172
+ function removePool(address pool) external onlyGovernance {
173
+ require(_isPoolVotable(pool), "invalid pool");
174
+ uint64 chainId = poolInfo[pool].chainId;
175
+
176
+ updatePoolVotes(pool);
177
+ _removePool(pool);
178
+
179
+ emit RemovePool(chainId, pool);
180
+ }
181
+
182
+ /**
183
+ * @notice use the gov-privilege to force broadcast a message in case there are issues with Celer
184
+ * @dev it's intentional for this function to have minimal checks since we assume gov has done the
185
+ due dilligence
186
+ * @dev gov should always call finalizeEpoch beforehand
187
+ * @dev state changes expected:
188
+ - the gaugeController receives the new pendle allocation
189
+ */
190
+ function forceBroadcastResults(
191
+ uint64 chainId,
192
+ uint128 wTime,
193
+ uint128 forcedPendlePerSec
194
+ ) external payable onlyGovernance {
195
+ _broadcastResults(chainId, wTime, forcedPendlePerSec);
196
+ }
197
+
198
+ /**
199
+ * @notice set new pendlePerSec
200
+ * @dev no zero checks because gov may want to stop liquidity mining
201
+ * @dev state changes expected: pendlePerSec is updated
202
+ */
203
+ function setPendlePerSec(uint128 newPendlePerSec) external onlyGovernance {
204
+ pendlePerSec = newPendlePerSec;
205
+ emit SetPendlePerSec(newPendlePerSec);
206
+ }
207
+
208
+ /*///////////////////////////////////////////////////////////////
209
+ INTERNAL FUNCTIONS
210
+ //////////////////////////////////////////////////////////////*/
211
+
212
+ /**
213
+ * @notice broadcast voting results of the timestamp to chainId
214
+ * @dev assumption: the epoch is already finalized, lastUpdated of all pools >= currentWeekTimestamp
215
+ * @dev state changes expected:
216
+ - the gaugeController receives the new pendle allocation
217
+ */
218
+ function _broadcastResults(
219
+ uint64 chainId,
220
+ uint128 wTime,
221
+ uint128 totalPendlePerSec
222
+ ) internal {
223
+ uint256 totalVotes = weekData[wTime].totalVotes;
224
+ if (totalVotes == 0) return;
225
+
226
+ uint256 length = chainPools[chainId].length();
227
+ if (length == 0) return;
228
+
229
+ address[] memory pools = chainPools[chainId].values();
230
+ uint256[] memory totalPendleAmounts = new uint256[](length);
231
+
232
+ for (uint256 i = 0; i < length; ++i) {
233
+ uint256 poolVotes = weekData[wTime].poolVotes[pools[i]];
234
+ uint256 pendlePerSec = (uint256(totalPendlePerSec) * poolVotes) / totalVotes;
235
+ totalPendleAmounts[i] = pendlePerSec * WEEK;
236
+ }
237
+
238
+ if (chainId == block.chainid) {
239
+ address gaugeController = sidechainContracts.get(uint256(chainId));
240
+ IPGaugeControllerMainchain(gaugeController).updateVotingResults(
241
+ wTime,
242
+ pools,
243
+ totalPendleAmounts
244
+ );
245
+ } else {
246
+ _sendMessage(chainId, abi.encode(wTime, pools, totalPendleAmounts));
247
+ }
248
+
249
+ emit BroadcastResults(chainId, wTime, totalPendlePerSec);
250
+ }
251
+
252
+ /**
253
+ * @notice remove the vote from the current pool
254
+ * @dev state changes expected:
255
+ - vote in poolInfo is cleared if the vote is still valid
256
+ - update UserData to remove the vote weight
257
+ - add a check-point if required
258
+ */
259
+ function _unvote(
260
+ address user,
261
+ address pool,
262
+ bool doCreateCheckpoint
263
+ ) internal {
264
+ VeBalance memory oldUVote = userData[user].voteForPools[pool].vote;
265
+ if (_isPoolVotable(pool) && _isVoteActive(oldUVote)) {
266
+ _subtractVotePoolInfo(pool, oldUVote);
267
+ }
268
+ _unsetVoteUserData(user, pool);
269
+
270
+ if (doCreateCheckpoint) {
271
+ _addUserPoolCheckpoint(user, pool, VeBalance(0, 0));
272
+ }
273
+ emit Unvote(user, pool, oldUVote);
274
+ }
275
+
276
+ /**
277
+ * @notice remove the vote from the current pool
278
+ * @dev there must not be any current vote on this pool by the user
279
+ * @dev state changes expected:
280
+ - vote in poolInfo is added
281
+ - update UserData to set the new vote weight
282
+ - add a check-point
283
+ */
284
+ function _vote(
285
+ address user,
286
+ address pool,
287
+ uint64 weight
288
+ ) internal {
289
+ VeBalance memory votingPower = _getVotingPowerByWeight(user, weight);
290
+ _addVotePoolInfo(pool, votingPower);
291
+ _setVoteUserData(user, pool, weight, votingPower);
292
+ _addUserPoolCheckpoint(user, pool, votingPower);
293
+
294
+ emit Vote(user, pool, weight, votingPower);
295
+ }
296
+
297
+ /**
298
+ * @notice return the corresponding voting power of an user given the weight. Basically his voting power
299
+ will be vePendle * weight / USER_VOTE_MAX_WEIGHT
300
+ * @notice governance will always has the vePendle equivalent to 1M PENDLE locked for MAX_LOCK_TIME
301
+ */
302
+ function _getVotingPowerByWeight(address user, uint64 weight)
303
+ internal
304
+ view
305
+ virtual
306
+ returns (VeBalance memory res)
307
+ {
308
+ uint128 amount;
309
+ uint128 expiry;
310
+
311
+ if (user == _governance()) {
312
+ amount = GOVERNANCE_PENDLE_VOTE;
313
+ expiry = WeekMath.getWeekStartTimestamp(uint128(block.timestamp) + MAX_LOCK_TIME);
314
+ } else {
315
+ (amount, expiry) = vePendle.positionData(user);
316
+ }
317
+
318
+ (res.bias, res.slope) = VeBalanceLib.convertToVeBalance(
319
+ uint128((uint256(amount) * weight) / USER_VOTE_MAX_WEIGHT),
320
+ expiry
321
+ );
322
+ }
323
+ }