@pendle/core-v2 0.8.1-beta → 0.8.1-gamma

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 (259) hide show
  1. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
  2. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
  3. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +4 -0
  4. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +833 -0
  5. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
  6. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
  7. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +2 -2
  8. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +4 -0
  9. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +723 -0
  10. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +4 -0
  11. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +723 -0
  12. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
  13. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +1 -1
  14. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
  15. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +20 -2
  16. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
  17. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +4 -0
  18. package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +784 -0
  19. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
  20. package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
  21. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
  22. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
  23. package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json +2 -2
  24. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
  25. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
  26. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
  27. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
  28. package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
  29. package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
  30. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
  31. package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +47 -28
  32. package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
  33. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
  34. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +66 -4
  35. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
  36. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +26 -2
  37. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
  38. package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +24 -0
  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 +2 -2
  43. package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
  44. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
  45. package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
  46. package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
  47. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
  48. package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -77
  49. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
  50. package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
  51. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
  52. package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +21 -96
  53. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
  54. package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
  55. package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +1 -1
  56. package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +2 -2
  57. package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
  58. package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +2 -2
  59. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
  60. package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
  61. package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
  62. package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
  63. package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
  64. package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
  65. package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
  66. package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
  67. package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
  68. package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
  69. package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
  70. package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
  71. package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +4 -0
  72. package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.json +162 -0
  73. package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +4 -0
  74. package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.json +87 -0
  75. package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
  76. package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
  77. package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +1 -1
  78. package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
  79. package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
  80. package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
  81. package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
  82. package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
  83. package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
  84. package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
  85. package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.json +1 -1
  86. package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
  87. package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
  88. package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
  89. package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
  90. package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
  91. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
  92. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +23 -23
  93. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
  94. package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +24 -0
  95. package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
  96. package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
  97. package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
  98. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
  99. package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +27 -27
  100. package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
  101. package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
  102. package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
  103. package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
  104. package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +4 -0
  105. package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.json +199 -0
  106. package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +4 -0
  107. package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.json +168 -0
  108. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +4 -0
  109. package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +92 -0
  110. package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
  111. package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
  112. package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
  113. package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
  114. package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +4 -0
  115. package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.json +252 -0
  116. package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
  117. package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
  118. package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
  119. package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
  120. package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
  121. package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
  122. package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
  123. package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
  124. package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
  125. package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
  126. package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
  127. package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +4 -0
  128. package/build/artifacts/contracts/libraries/{SCY/SCYIndex.sol/SCYIndexLib.json → helpers/PYIndex.sol/PYIndexLib.json} +4 -4
  129. package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
  130. package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
  131. package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
  132. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
  133. package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.json +2 -2
  134. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
  135. package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
  136. package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
  137. package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
  138. package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
  139. package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
  140. package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +1 -1
  141. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
  142. package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +39 -39
  143. package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
  144. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +242 -0
  145. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +1 -1
  146. package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +146 -0
  147. package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +170 -0
  148. package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +33 -6
  149. package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +184 -0
  150. package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +19 -10
  151. package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +3 -1
  152. package/contracts/core/LiquidityMining/PendleGauge.sol +3 -2
  153. package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +25 -7
  154. package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +0 -4
  155. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +30 -13
  156. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +2 -4
  157. package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +5 -1
  158. package/contracts/core/Market/PendleMarket.sol +4 -5
  159. package/contracts/core/Market/PendleMarketFactory.sol +1 -1
  160. package/contracts/core/YieldContracts/InterestManagerYT.sol +0 -2
  161. package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
  162. package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +2 -2
  163. package/contracts/core/YieldContracts/PendleYieldToken.sol +24 -25
  164. package/contracts/core/actions/ActionCallback.sol +7 -7
  165. package/contracts/core/actions/base/ActionSCYAndPTBase.sol +10 -9
  166. package/contracts/core/actions/base/ActionSCYAndYTBase.sol +4 -4
  167. package/contracts/interfaces/IEulerEToken.sol +60 -0
  168. package/contracts/interfaces/IEulerMarkets.sol +46 -0
  169. package/contracts/interfaces/IPInterestManagerYT.sol +1 -1
  170. package/contracts/interfaces/IPMarket.sol +1 -0
  171. package/contracts/interfaces/IPRouterStatic.sol +2 -7
  172. package/contracts/interfaces/IPVeToken.sol +2 -0
  173. package/contracts/interfaces/IPYieldToken.sol +2 -2
  174. package/contracts/interfaces/ISAvax.sol +61 -0
  175. package/contracts/interfaces/ISJoe.sol +60 -0
  176. package/contracts/interfaces/IStETH.sol +14 -0
  177. package/contracts/interfaces/IWAvax.sol +34 -0
  178. package/contracts/libraries/helpers/PYIndex.sol +69 -0
  179. package/contracts/libraries/math/MarketApproxLib.sol +5 -5
  180. package/contracts/libraries/math/MarketMathCore.sol +10 -10
  181. package/contracts/offchain-helpers/RouterStatic.sol +21 -39
  182. package/deployments/43113-benqi.json +2 -2
  183. package/deployments/43113-core.json +7 -7
  184. package/deployments/43113-markets/benqi-market-599408.json +7 -0
  185. package/deployments/43113-markets/benqi-market-93bbf0.json +7 -0
  186. package/deployments/80001-benqi.json +2 -2
  187. package/deployments/80001-core.json +6 -6
  188. package/deployments/80001-markets/benqi-market-007811.json +7 -0
  189. package/deployments/80001-markets/benqi-market-3fe528.json +7 -0
  190. package/package.json +1 -1
  191. package/typechain-types/CelerSenderUpg.ts +16 -16
  192. package/typechain-types/IERC20Upgradeable.ts +300 -0
  193. package/typechain-types/IEulerEToken.ts +320 -0
  194. package/typechain-types/IEulerMarkets.ts +204 -0
  195. package/typechain-types/IPInterestManagerYT.ts +3 -3
  196. package/typechain-types/IPRouterStatic.ts +60 -118
  197. package/typechain-types/IPVeToken.ts +34 -0
  198. package/typechain-types/IPYieldToken.ts +47 -47
  199. package/typechain-types/ISAvax.ts +430 -0
  200. package/typechain-types/ISJoe.ts +340 -0
  201. package/typechain-types/IStETH.ts +201 -0
  202. package/typechain-types/IWAvax.ts +380 -0
  203. package/typechain-types/PendleEulerSCY.ts +965 -0
  204. package/typechain-types/PendlePrincipalToken.ts +0 -104
  205. package/typechain-types/PendleQiSAvaxSCY.ts +1098 -0
  206. package/typechain-types/PendleSAvaxSCY.ts +962 -0
  207. package/typechain-types/PendleSJoeSCY.ts +1053 -0
  208. package/typechain-types/PendleVotingControllerUpg.ts +89 -55
  209. package/typechain-types/PendleWstEthSCY.ts +13 -0
  210. package/typechain-types/PendleYieldToken.ts +44 -148
  211. package/typechain-types/RouterStatic.ts +133 -299
  212. package/typechain-types/VotingEscrowPendleMainchain.ts +118 -16
  213. package/typechain-types/VotingEscrowPendleSidechain.ts +34 -0
  214. package/typechain-types/VotingEscrowTokenBase.ts +34 -0
  215. package/typechain-types/factories/ActionCallback__factory.ts +1 -1
  216. package/typechain-types/factories/ActionCore__factory.ts +1 -1
  217. package/typechain-types/factories/ActionYT__factory.ts +1 -1
  218. package/typechain-types/factories/CelerSenderUpg__factory.ts +2 -2
  219. package/typechain-types/factories/IERC20Upgradeable__factory.ts +209 -0
  220. package/typechain-types/factories/IEulerEToken__factory.ts +174 -0
  221. package/typechain-types/factories/IEulerMarkets__factory.ts +99 -0
  222. package/typechain-types/factories/IPInterestManagerYT__factory.ts +1 -1
  223. package/typechain-types/factories/IPRouterStatic__factory.ts +23 -23
  224. package/typechain-types/factories/IPVeToken__factory.ts +24 -0
  225. package/typechain-types/factories/IPYieldToken__factory.ts +27 -27
  226. package/typechain-types/factories/ISAvax__factory.ts +208 -0
  227. package/typechain-types/factories/ISJoe__factory.ts +177 -0
  228. package/typechain-types/factories/IStETH__factory.ts +101 -0
  229. package/typechain-types/factories/IWAvax__factory.ts +261 -0
  230. package/typechain-types/factories/PendleEulerSCY__factory.ts +796 -0
  231. package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
  232. package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
  233. package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
  234. package/typechain-types/factories/PendleMarket__factory.ts +1 -1
  235. package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -76
  236. package/typechain-types/factories/PendleQiSAvaxSCY__factory.ts +917 -0
  237. package/typechain-types/factories/PendleQiTokenSCY__factory.ts +1 -1
  238. package/typechain-types/factories/PendleRouter__factory.ts +1 -1
  239. package/typechain-types/factories/PendleSAvaxSCY__factory.ts +796 -0
  240. package/typechain-types/factories/PendleSJoeSCY__factory.ts +845 -0
  241. package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +45 -26
  242. package/typechain-types/factories/PendleWstEthSCY__factory.ts +29 -2
  243. package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
  244. package/typechain-types/factories/PendleYieldToken__factory.ts +19 -94
  245. package/typechain-types/factories/RouterStatic__factory.ts +38 -38
  246. package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +65 -3
  247. package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +25 -1
  248. package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +24 -0
  249. package/typechain-types/hardhat.d.ts +98 -17
  250. package/typechain-types/index.ts +22 -4
  251. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +0 -4
  252. package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +0 -329
  253. package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
  254. package/contracts/core/PendleERC20Permit.sol +0 -84
  255. package/contracts/libraries/SCY/SCYIndex.sol +0 -72
  256. package/deployments/43113-markets/benqi-market-4Ccb97.json +0 -7
  257. package/deployments/43113-markets/benqi-market-534471.json +0 -7
  258. package/deployments/80001-markets/benqi-market-109acB.json +0 -7
  259. package/deployments/80001-markets/benqi-market-4e470E.json +0 -7
@@ -0,0 +1,184 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.15;
3
+
4
+ import "../../base-implementations/SCYBaseWithRewards.sol";
5
+ import "../../../interfaces/ISJoe.sol";
6
+
7
+ /*
8
+ sJOE Staking
9
+ sJOE Staking is a highly accessible Staking option. Users can Stake into sJOE and unstake from sJOE at any time. There is however a deposit fee mechanism to prevent over-saturation.
10
+
11
+ Deposit Fee
12
+ Staking into sJOE may come with a fee
13
+ The fee can scale up to 3% Max, depending on the number of JOEs already Staked
14
+ The 3% Fee is taken from the JOEs that you deposit into the sJOE Pool
15
+ Currently any deposit fee taken will be sent to the Treasury
16
+
17
+
18
+ Yield Generating Mechanism - Stake JOE into SJOE Contract
19
+
20
+ Asset - JOE
21
+
22
+ Shares - Shares (in contract *take note of deduction of fees after depositing)
23
+
24
+ Exchange Rate - Increases with sJOE rewards
25
+
26
+
27
+ */
28
+ // sJOE -> Staking contract that accepts JOE and yields USDC as the ONLY reward token
29
+ // sJOE Contract Address on Avalanche -> 0x1a731B2299E22FbAC282E7094EdA41046343Cb51
30
+
31
+ // JOE Contract Address on Avalanche -> 0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd
32
+
33
+ contract PendleSJoeSCY is SCYBaseWithRewards {
34
+ using SafeERC20 for IERC20;
35
+
36
+ address public immutable SJOE;
37
+ address public immutable JOE;
38
+
39
+ constructor(
40
+ string memory _name,
41
+ string memory _symbol,
42
+ address _sJOE
43
+ ) SCYBaseWithRewards(_name, _symbol, _sJOE) {
44
+ require(_sJOE != address(0), "zero address");
45
+ SJOE = _sJOE;
46
+ JOE = ISJoe(SJOE).joe();
47
+
48
+ _safeApprove(JOE, SJOE, type(uint256).max);
49
+ }
50
+
51
+ /*///////////////////////////////////////////////////////////////
52
+ DEPOSIT/REDEEM USING BASE TOKENS
53
+ //////////////////////////////////////////////////////////////*/
54
+
55
+ /**
56
+ * @dev See {SCYBase-_deposit}
57
+ *
58
+ * The underlying yield token is JOE (Since the amount of rewards is based on how much staked JOE inside sJOE contract). Only the base token JOE should be accepted. Then the corresponding amount of shares is returned.
59
+ *
60
+ * The exchange rate of JOE to shares is 1:1
61
+
62
+ * Each time deposit() is called, any pending rewards will be sent back to the SCY by default.
63
+ */
64
+ function _deposit(address, uint256 amount)
65
+ internal
66
+ override
67
+ returns (uint256 amountSharesOut)
68
+ {
69
+ uint256 preBalanceSJoe = ISJoe(SJOE).internalJoeBalance();
70
+
71
+ ISJoe(SJOE).deposit(amount);
72
+
73
+ // Depositing JOE will incur deposit fee, hence amountSharesOut has to be calculated like this for accurate amount of SCY exchanged.
74
+ amountSharesOut = ISJoe(SJOE).internalJoeBalance() - preBalanceSJoe;
75
+ }
76
+
77
+ /**
78
+ * @dev See {SCYBase-_redeem}
79
+ *
80
+ * The shares are redeemed into the same amount of JOE Tokens. Hence `tokenOut` will only be the underlying asset (JOE) in this case. Since there will NOT be any withdrawal fee from sJOE, amountSharesToRedeem will always correspond amountTokenOut.
81
+ */
82
+ function _redeem(address, uint256 amountSharesToRedeem)
83
+ internal
84
+ override
85
+ returns (uint256 amountTokenOut)
86
+ {
87
+ ISJoe(SJOE).withdraw(amountSharesToRedeem);
88
+ amountTokenOut = amountSharesToRedeem;
89
+ }
90
+
91
+ /*///////////////////////////////////////////////////////////////
92
+ EXCHANGE-RATE
93
+ //////////////////////////////////////////////////////////////*/
94
+
95
+ /**
96
+ * @notice Exchange rate for JOE to SCY is 1:1
97
+ * @dev It is the exchange rate of Shares in sJOE to its underlying asset (JOE)
98
+ */
99
+ function exchangeRate() public pure override returns (uint256) {
100
+ return SCYUtils.ONE;
101
+ }
102
+
103
+ /*///////////////////////////////////////////////////////////////
104
+ REWARDS-RELATED
105
+ //////////////////////////////////////////////////////////////*/
106
+
107
+ /**
108
+ * @dev See {ISuperComposableYield-getRewardTokens}
109
+ */
110
+ function _getRewardTokens() internal view override returns (address[] memory res) {
111
+ ISJoe SJOEContract = ISJoe(SJOE);
112
+
113
+ uint256 length = SJOEContract.rewardTokensLength();
114
+
115
+ res = new address[](length);
116
+ for (uint256 i = 0; i < length; ) {
117
+ res[i] = SJOEContract.rewardTokens(i);
118
+ unchecked {
119
+ i++;
120
+ }
121
+ }
122
+ }
123
+
124
+ function _redeemExternalReward() internal override {
125
+ // Since sJOE contract has no 'claimRewards' function, call withdraw() with a 0 amount to claim the rewards - Same as how sJOE pool is doing for their frontend.
126
+ ISJoe(SJOE).withdraw(0);
127
+ }
128
+
129
+ /*///////////////////////////////////////////////////////////////
130
+ MISC FUNCTIONS FOR METADATA
131
+ //////////////////////////////////////////////////////////////*/
132
+
133
+ function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
134
+ internal
135
+ view
136
+ override
137
+ returns (uint256 amountSharesOut)
138
+ {
139
+ uint256 sJoeDepositFeePrecision = ISJoe(SJOE).depositFeePercent();
140
+
141
+ amountSharesOut =
142
+ (((1e18 - sJoeDepositFeePrecision / 1e18) * amountTokenToDeposit) * 1e18) /
143
+ exchangeRate();
144
+ }
145
+
146
+ function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
147
+ internal
148
+ pure
149
+ override
150
+ returns (uint256 amountTokenOut)
151
+ {
152
+ amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
153
+ }
154
+
155
+ function getTokensIn() public view virtual override returns (address[] memory res) {
156
+ res = new address[](1);
157
+ res[0] = JOE;
158
+ }
159
+
160
+ function getTokensOut() public view virtual override returns (address[] memory res) {
161
+ res = new address[](1);
162
+ res[0] = JOE;
163
+ }
164
+
165
+ function isValidTokenIn(address token) public view virtual override returns (bool) {
166
+ return token == JOE;
167
+ }
168
+
169
+ function isValidTokenOut(address token) public view virtual override returns (bool) {
170
+ return token == JOE;
171
+ }
172
+
173
+ function assetInfo()
174
+ external
175
+ view
176
+ returns (
177
+ AssetType assetType,
178
+ address assetAddress,
179
+ uint8 assetDecimals
180
+ )
181
+ {
182
+ return (AssetType.TOKEN, JOE, IERC20Metadata(JOE).decimals());
183
+ }
184
+ }
@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
3
3
 
4
4
  import "../../../interfaces/ICelerMessageBus.sol";
5
5
  import "../../../periphery/PermissionsV2Upg.sol";
6
+ import "@openzeppelin/contracts/utils/Address.sol";
6
7
  import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
7
8
 
8
9
  // solhint-disable no-empty-blocks
@@ -15,10 +16,18 @@ abstract contract CelerSenderUpg is PermissionsV2Upg {
15
16
 
16
17
  ICelerMessageBus public celerMessageBus;
17
18
 
18
- EnumerableMap.UintToAddressMap internal sidechainContracts;
19
+ // destinationContracts mapping contains one address for each chainId only
20
+ EnumerableMap.UintToAddressMap internal destinationContracts;
19
21
 
20
22
  uint256[100] private __gap;
21
23
 
24
+ modifier refundUnusedEth() {
25
+ _;
26
+ if (address(this).balance > 0) {
27
+ Address.sendValue(payable(msg.sender), address(this).balance);
28
+ }
29
+ }
30
+
22
31
  constructor(address _governanceManager) PermissionsV2Upg(_governanceManager) {}
23
32
 
24
33
  function setCelerMessageBus(address _celerMessageBus) external onlyGovernance {
@@ -26,35 +35,35 @@ abstract contract CelerSenderUpg is PermissionsV2Upg {
26
35
  }
27
36
 
28
37
  function _sendMessage(uint256 chainId, bytes memory message) internal {
29
- assert(sidechainContracts.contains(chainId));
30
- address toAddr = sidechainContracts.get(chainId);
38
+ assert(destinationContracts.contains(chainId));
39
+ address toAddr = destinationContracts.get(chainId);
31
40
  uint256 fee = celerMessageBus.calcFee(message);
32
41
  require(msg.value >= fee, "Insufficient celer fee");
33
42
  celerMessageBus.sendMessage{ value: fee }(toAddr, chainId, message);
34
43
  }
35
44
 
36
- function _afterAddSidechainContract(address addr, uint256 chainId) internal virtual {}
45
+ function _afterAddDestinationContract(address addr, uint256 chainId) internal virtual {}
37
46
 
38
- function addSidechainContract(address _address, uint256 _chainId)
47
+ function addDestinationContract(address _address, uint256 _chainId)
39
48
  external
40
49
  payable
41
50
  onlyGovernance
42
51
  {
43
- sidechainContracts.set(_chainId, _address);
44
- _afterAddSidechainContract(_address, _chainId);
52
+ destinationContracts.set(_chainId, _address);
53
+ _afterAddDestinationContract(_address, _chainId);
45
54
  }
46
55
 
47
- function getAllSidechainContracts()
56
+ function getAllDestinationContracts()
48
57
  public
49
58
  view
50
59
  returns (uint256[] memory chainIds, address[] memory addrs)
51
60
  {
52
- uint256 length = sidechainContracts.length();
61
+ uint256 length = destinationContracts.length();
53
62
  chainIds = new uint256[](length);
54
63
  addrs = new address[](length);
55
64
 
56
65
  for (uint256 i = 0; i < length; ++i) {
57
- (chainIds[i], addrs[i]) = sidechainContracts.at(i);
66
+ (chainIds[i], addrs[i]) = destinationContracts.at(i);
58
67
  }
59
68
  }
60
69
  }
@@ -7,6 +7,7 @@ import "../../../libraries/math/Math.sol";
7
7
  import "../../../libraries/math/WeekMath.sol";
8
8
  import "../../../interfaces/IPGaugeController.sol";
9
9
  import "../../../interfaces/IPMarketFactory.sol";
10
+ import "../../../interfaces/IPMarket.sol";
10
11
  import "../../../periphery/PermissionsV2Upg.sol";
11
12
  import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
12
13
 
@@ -101,7 +102,8 @@ abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, Permissions
101
102
  epochRewardReceived[wTime] = true;
102
103
 
103
104
  for (uint256 i = 0; i < markets.length; ++i) {
104
- _addRewardsToMarket(markets[i], pendleAmounts[i].Uint128());
105
+ if (!IPMarket(markets[i]).isExpired())
106
+ _addRewardsToMarket(markets[i], pendleAmounts[i].Uint128());
105
107
  }
106
108
 
107
109
  emit ReceiveVotingResults(wTime, markets, pendleAmounts);
@@ -80,8 +80,9 @@ abstract contract PendleGauge is RewardManager {
80
80
  virtual
81
81
  returns (uint256)
82
82
  {
83
- uint256 vePendleBalance = vePENDLE.balanceOf(user);
84
- uint256 vePendleSupply = vePENDLE.totalSupplyCurrent();
83
+ (uint256 vePendleBalance, uint256 vePendleSupply) = vePENDLE.totalSupplyAndBlanaceCurrent(
84
+ user
85
+ );
85
86
  // Inspired by Curve's Gauge
86
87
  uint256 veBoostedLpBalance = (lpBalance * TOKENLESS_PRODUCTION) / 100;
87
88
  if (vePendleSupply > 0) {
@@ -79,15 +79,22 @@ contract PendleVotingControllerUpg is
79
79
  if (_isPoolActive(pools[i])) applyPoolSlopeChanges(pools[i]);
80
80
  }
81
81
 
82
+ // Process weight-decrease pools first
82
83
  for (uint256 i = 0; i < pools.length; ++i) {
83
- if (uData.voteForPools[pools[i]].weight <= weights[i])
84
+ if (uData.voteForPools[pools[i]].weight > weights[i])
84
85
  _modifyVoteWeight(user, pools[i], userPosition, weights[i]);
85
86
  }
86
87
 
88
+ // Process weight-increase pools
87
89
  for (uint256 i = 0; i < pools.length; ++i) {
88
- if (uData.voteForPools[pools[i]].weight > weights[i])
90
+ if (uData.voteForPools[pools[i]].weight <= weights[i])
89
91
  _modifyVoteWeight(user, pools[i], userPosition, weights[i]);
90
92
  }
93
+
94
+ require(
95
+ uData.totalVotedWeight <= VeBalanceLib.USER_VOTE_MAX_WEIGHT,
96
+ "exceeded max weight"
97
+ );
91
98
  }
92
99
 
93
100
  /**
@@ -141,7 +148,7 @@ contract PendleVotingControllerUpg is
141
148
  * @dev state changes expected:
142
149
  - the gaugeController receives the new pendle allocation
143
150
  */
144
- function broadcastResults(uint64 chainId) external payable {
151
+ function broadcastResults(uint64 chainId) external payable refundUnusedEth {
145
152
  uint128 wTime = WeekMath.getCurrentWeekStart();
146
153
  require(weekData[wTime].isEpochFinalized, "epoch not finalized");
147
154
  _broadcastResults(chainId, wTime, pendlePerSec);
@@ -202,7 +209,7 @@ contract PendleVotingControllerUpg is
202
209
  uint64 chainId,
203
210
  uint128 wTime,
204
211
  uint128 forcedPendlePerSec
205
- ) external payable onlyGovernance {
212
+ ) external payable onlyGovernance refundUnusedEth {
206
213
  _broadcastResults(chainId, wTime, forcedPendlePerSec);
207
214
  }
208
215
 
@@ -218,6 +225,18 @@ contract PendleVotingControllerUpg is
218
225
  emit SetPendlePerSec(newPendlePerSec);
219
226
  }
220
227
 
228
+ function getBroadcastResultFee(uint64 chainId) external view returns (uint256) {
229
+ if (chainId == block.chainid) return 0; // Mainchain broadcast
230
+
231
+ uint256 length = chainPools[chainId].length();
232
+ if (length == 0) return 0;
233
+
234
+ address[] memory pools = new address[](length);
235
+ uint256[] memory totalPendleAmounts = new uint256[](length);
236
+
237
+ return celerMessageBus.calcFee(abi.encode(uint128(0), pools, totalPendleAmounts));
238
+ }
239
+
221
240
  /*///////////////////////////////////////////////////////////////
222
241
  INTERNAL FUNCTIONS
223
242
  //////////////////////////////////////////////////////////////*/
@@ -244,12 +263,11 @@ contract PendleVotingControllerUpg is
244
263
 
245
264
  for (uint256 i = 0; i < length; ++i) {
246
265
  uint256 poolVotes = weekData[wTime].poolVotes[pools[i]];
247
- uint256 pendlePerSec = (totalPendlePerSec * poolVotes) / totalVotes;
248
- totalPendleAmounts[i] = pendlePerSec * WEEK;
266
+ totalPendleAmounts[i] = (totalPendlePerSec * poolVotes * WEEK) / totalVotes;
249
267
  }
250
268
 
251
269
  if (chainId == block.chainid) {
252
- address gaugeController = sidechainContracts.get(chainId);
270
+ address gaugeController = destinationContracts.get(chainId);
253
271
  IPGaugeControllerMainchain(gaugeController).updateVotingResults(
254
272
  wTime,
255
273
  pools,
@@ -210,10 +210,6 @@ abstract contract VotingControllerStorageUpg {
210
210
 
211
211
  uData.voteForPools[pool] = UserPoolData(weight, newVote);
212
212
  uData.totalVotedWeight += weight;
213
- require(
214
- uData.totalVotedWeight <= VeBalanceLib.USER_VOTE_MAX_WEIGHT,
215
- "exceeded max weight"
216
- );
217
213
  }
218
214
 
219
215
  userPoolHistory[user][pool].push(newVote);
@@ -16,6 +16,10 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
16
16
  using EnumerableMap for EnumerableMap.UintToAddressMap;
17
17
 
18
18
  bytes private constant EMPTY_BYTES = abi.encode();
19
+ bytes private constant SAMPLE_SUPPLY_UPDATE_MESSAGE =
20
+ abi.encode(0, VeBalance(0, 0), EMPTY_BYTES);
21
+ bytes private constant SAMPLE_POSITION_UPDATE_MESSAGE =
22
+ abi.encode(0, VeBalance(0, 0), abi.encode(address(0), LockedPosition(0, 0)));
19
23
 
20
24
  IERC20 public immutable pendle;
21
25
 
@@ -41,7 +45,7 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
41
45
  uint128 additionalAmountToLock,
42
46
  uint128 newExpiry,
43
47
  uint256[] calldata chainIds
44
- ) external payable returns (uint128 newVeBalance) {
48
+ ) external payable refundUnusedEth returns (uint128 newVeBalance) {
45
49
  newVeBalance = increaseLockPosition(additionalAmountToLock, newExpiry);
46
50
  broadcastUserPosition(msg.sender, chainIds);
47
51
  }
@@ -67,6 +71,7 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
67
71
  );
68
72
 
69
73
  require(newExpiry <= block.timestamp + MAX_LOCK_TIME, "max lock time exceeded");
74
+ require(positionData[user].expiry <= newExpiry, "new expiry must be after current expiry");
70
75
 
71
76
  uint128 newTotalAmountLocked = additionalAmountToLock + positionData[user].amount;
72
77
  require(newTotalAmountLocked > 0, "zero total amount locked");
@@ -111,7 +116,7 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
111
116
  * @dev state changes expected:
112
117
  - _totalSupply & lastSlopeChangeAppliedAt is updated
113
118
  */
114
- function totalSupplyCurrent() external virtual override returns (uint128) {
119
+ function totalSupplyCurrent() public virtual override returns (uint128) {
115
120
  (VeBalance memory supply, ) = _applySlopeChange();
116
121
  return supply.getCurrentValue();
117
122
  }
@@ -121,7 +126,7 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
121
126
  * @dev state changes expected:
122
127
  - all chains in chainIds receive the new totalSupply
123
128
  */
124
- function broadcastTotalSupply(uint256[] calldata chainIds) public payable {
129
+ function broadcastTotalSupply(uint256[] calldata chainIds) public payable refundUnusedEth {
125
130
  _broadcastPosition(address(0), chainIds);
126
131
  }
127
132
 
@@ -130,7 +135,11 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
130
135
  * @dev state changes expected:
131
136
  - all chains in chainIds receive the new totalSupply & user's new position
132
137
  */
133
- function broadcastUserPosition(address user, uint256[] calldata chainIds) public payable {
138
+ function broadcastUserPosition(address user, uint256[] calldata chainIds)
139
+ public
140
+ payable
141
+ refundUnusedEth
142
+ {
134
143
  require(user != address(0), "zero address user");
135
144
  _broadcastPosition(user, chainIds);
136
145
  }
@@ -140,6 +149,14 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
140
149
  return userHistory[user].getAtTimestamp(timestamp);
141
150
  }
142
151
 
152
+ function getBroadcastSupplyFee(uint256[] calldata chainIds) external view returns (uint256) {
153
+ return celerMessageBus.calcFee(SAMPLE_SUPPLY_UPDATE_MESSAGE) * chainIds.length;
154
+ }
155
+
156
+ function getBroadcastPositionFee(uint256[] calldata chainIds) external view returns (uint256) {
157
+ return celerMessageBus.calcFee(SAMPLE_POSITION_UPDATE_MESSAGE) * chainIds.length;
158
+ }
159
+
143
160
  /**
144
161
  * @notice increase the locking position of the user
145
162
  * @dev it works by simply removing the old position from all relevant data (as if the user has never locked) and
@@ -206,38 +223,38 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
206
223
  _totalSupply = supply;
207
224
  lastSlopeChangeAppliedAt = wTime;
208
225
 
209
- return (supply, lastSlopeChangeAppliedAt);
226
+ return (supply, wTime);
210
227
  }
211
228
 
212
229
  /// @notice broadcast position to all chains in chainIds
213
230
  function _broadcastPosition(address user, uint256[] calldata chainIds) public payable {
214
231
  require(chainIds.length != 0, "empty chainIds");
215
232
 
216
- (VeBalance memory supply, uint256 wTime) = _applySlopeChange();
233
+ (VeBalance memory supply, uint128 wTime) = _applySlopeChange();
217
234
 
218
235
  bytes memory userData = (
219
236
  user == address(0) ? EMPTY_BYTES : abi.encode(user, positionData[user])
220
237
  );
221
238
 
222
239
  for (uint256 i = 0; i < chainIds.length; ++i) {
223
- require(sidechainContracts.contains(chainIds[i]), "not supported chain");
240
+ require(destinationContracts.contains(chainIds[i]), "not supported chain");
224
241
  _broadcast(chainIds[i], wTime, supply, userData);
225
- if (user != address(0)) {
226
- emit BroadcastUserPosition(user, chainIds);
227
- }
228
242
  }
229
243
 
244
+ if (user != address(0)) {
245
+ emit BroadcastUserPosition(user, chainIds);
246
+ }
230
247
  emit BroadcastTotalSupply(supply, chainIds);
231
248
  }
232
249
 
233
- function _afterAddSidechainContract(address, uint256 chainId) internal virtual override {
234
- (VeBalance memory supply, uint256 wTime) = _applySlopeChange();
250
+ function _afterAddDestinationContract(address, uint256 chainId) internal virtual override {
251
+ (VeBalance memory supply, uint128 wTime) = _applySlopeChange();
235
252
  _broadcast(chainId, wTime, supply, EMPTY_BYTES);
236
253
  }
237
254
 
238
255
  function _broadcast(
239
256
  uint256 chainId,
240
- uint256 wTime,
257
+ uint128 wTime,
241
258
  VeBalance memory supply,
242
259
  bytes memory userData
243
260
  ) internal {
@@ -19,7 +19,7 @@ contract VotingEscrowPendleSidechain is VotingEscrowTokenBase, CelerReceiverUpg
19
19
 
20
20
  constructor(address _governanceManager) CelerReceiverUpg(_governanceManager) {}
21
21
 
22
- function totalSupplyCurrent() external view virtual override returns (uint128) {
22
+ function totalSupplyCurrent() public view virtual override returns (uint128) {
23
23
  return totalSupplyStored();
24
24
  }
25
25
 
@@ -65,9 +65,7 @@ contract VotingEscrowPendleSidechain is VotingEscrowTokenBase, CelerReceiverUpg
65
65
 
66
66
  function balanceOf(address user) public view virtual override returns (uint128) {
67
67
  address delegator = delegatorOf[user];
68
- if (delegatorOf[user] == address(0)) {
69
- return super.balanceOf(user);
70
- }
68
+ if (delegator == address(0)) return super.balanceOf(user);
71
69
  return super.balanceOf(delegator);
72
70
  }
73
71
  }
@@ -43,9 +43,13 @@ abstract contract VotingEscrowTokenBase is IPVeToken {
43
43
  return _totalSupply.getCurrentValue();
44
44
  }
45
45
 
46
- function totalSupplyCurrent() external virtual returns (uint128);
46
+ function totalSupplyCurrent() public virtual returns (uint128);
47
47
 
48
48
  function _isPositionExpired(address user) internal view returns (bool) {
49
49
  return MiniHelpers.isCurrentlyExpired(positionData[user].expiry);
50
50
  }
51
+
52
+ function totalSupplyAndBlanaceCurrent(address user) external returns (uint128, uint128) {
53
+ return (balanceOf(user), totalSupplyCurrent());
54
+ }
51
55
  }
@@ -13,7 +13,6 @@ import "../../libraries/math/Math.sol";
13
13
  import "../../libraries/helpers/MiniHelpers.sol";
14
14
 
15
15
  import "../LiquidityMining/PendleGauge.sol";
16
- import "../PendleERC20Permit.sol";
17
16
  import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
18
17
 
19
18
  /**
@@ -27,7 +26,7 @@ contract PendleMarket is PendleERC20, PendleGauge, IPMarket {
27
26
  using Math for int256;
28
27
  using MarketMathCore for MarketState;
29
28
  using SafeERC20 for IERC20;
30
- using SCYIndexLib for ISuperComposableYield;
29
+ using PYIndexLib for IPYieldToken;
31
30
 
32
31
  struct MarketStorage {
33
32
  int128 totalPt;
@@ -90,7 +89,7 @@ contract PendleMarket is PendleERC20, PendleGauge, IPMarket {
90
89
  returns (uint256 lpToAccount)
91
90
  {
92
91
  MarketState memory market = readState(true);
93
- SCYIndex index = SCY.newIndex();
92
+ PYIndex index = YT.newIndex();
94
93
 
95
94
  uint256 scyDesired = IERC20(SCY).balanceOf(address(this)) - market.totalScy.Uint();
96
95
  uint256 ptDesired = IERC20(PT).balanceOf(address(this)) - market.totalPt.Uint();
@@ -161,7 +160,7 @@ contract PendleMarket is PendleERC20, PendleGauge, IPMarket {
161
160
  MarketState memory market = readState(true);
162
161
 
163
162
  (netScyOut, netScyToReserve) = market.swapExactPtForScy(
164
- SCY.newIndex(),
163
+ YT.newIndex(),
165
164
  exactPtIn,
166
165
  block.timestamp
167
166
  );
@@ -198,7 +197,7 @@ contract PendleMarket is PendleERC20, PendleGauge, IPMarket {
198
197
  MarketState memory market = readState(true);
199
198
 
200
199
  (netScyIn, netScyToReserve) = market.swapScyForExactPt(
201
- SCY.newIndex(),
200
+ YT.newIndex(),
202
201
  exactPtOut,
203
202
  block.timestamp
204
203
  );
@@ -85,7 +85,7 @@ contract PendleMarketFactory is PermissionsV2Upg, Initializable, IPMarketFactory
85
85
  // no need salt since market's existence has been checked before hand
86
86
  market = SSTORE2Deployer.create2(
87
87
  marketCreationCodePointer,
88
- bytes32(0),
88
+ bytes32(block.chainid),
89
89
  abi.encode(PT, scalarRoot, initialAnchor, vePendle, gaugeController)
90
90
  );
91
91
 
@@ -12,8 +12,6 @@ import "../../interfaces/IPYieldContractFactory.sol";
12
12
  import "../../libraries/SCY/SCYUtils.sol";
13
13
  import "../../libraries/helpers/TokenHelper.sol";
14
14
 
15
- import "../PendleERC20Permit.sol";
16
-
17
15
  /*
18
16
  With YT yielding more SCYs overtime, which is allowed to be redeemed by users, the reward distribution should
19
17
  be based on the amount of SCYs that their YT currently represent, plus with their dueInterest.
@@ -4,11 +4,11 @@ pragma solidity 0.8.15;
4
4
  import "../../interfaces/IPPrincipalToken.sol";
5
5
  import "../../interfaces/IPYieldToken.sol";
6
6
 
7
- import "../PendleERC20Permit.sol";
7
+ import "../PendleERC20.sol";
8
8
  import "../../libraries/helpers/MiniHelpers.sol";
9
9
  import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
10
10
 
11
- contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalToken {
11
+ contract PendlePrincipalToken is PendleERC20, Initializable, IPPrincipalToken {
12
12
  address public immutable SCY;
13
13
  address public immutable factory;
14
14
  uint256 public immutable expiry;
@@ -30,7 +30,7 @@ contract PendlePrincipalToken is PendleERC20Permit, Initializable, IPPrincipalTo
30
30
  string memory _symbol,
31
31
  uint8 __decimals,
32
32
  uint256 _expiry
33
- ) PendleERC20Permit(_name, _symbol, __decimals) {
33
+ ) PendleERC20(_name, _symbol, __decimals) {
34
34
  SCY = _SCY;
35
35
  expiry = _expiry;
36
36
  factory = msg.sender;
@@ -98,7 +98,7 @@ contract PendleYieldContractFactory is PermissionsV2Upg, Initializable, IPYieldC
98
98
  // no need salt since PT (and also YT) existence has been checked before hand
99
99
  PT = SSTORE2Deployer.create2(
100
100
  type(PendlePrincipalToken).creationCode,
101
- bytes32(0),
101
+ bytes32(block.chainid),
102
102
  abi.encode(
103
103
  SCY,
104
104
  PT_PREFIX.concat(_SCY.name(), expiry, " "),
@@ -110,7 +110,7 @@ contract PendleYieldContractFactory is PermissionsV2Upg, Initializable, IPYieldC
110
110
 
111
111
  YT = SSTORE2Deployer.create2(
112
112
  pendleYtCreationCodePointer,
113
- bytes32(0),
113
+ bytes32(block.chainid),
114
114
  abi.encode(
115
115
  SCY,
116
116
  PT,