@pendle/core-v2 0.8.0-beta-12 → 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.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +39 -7
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +833 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +39 -7
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +723 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +723 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +38 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +864 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +56 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +38 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +784 -0
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.json +36 -4
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +36 -4
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +242 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerSidechain.sol → PendleGaugeControllerSidechainUpg.sol}/PendleGaugeControllerSidechainUpg.json +3 -3
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +46 -40
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +0 -13
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +66 -4
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +26 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +24 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +2 -2
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -77
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +21 -96
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +2 -2
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.json +162 -0
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.json +87 -0
- package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +38 -23
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.json +24 -0
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +27 -27
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.json +199 -0
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.json +168 -0
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.json +92 -0
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.json +137 -0
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.json +135 -0
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.json +63 -0
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +36 -4
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.json +252 -0
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{SCY/SCYIndex.sol/SCYIndexLib.json → helpers/PYIndex.sol/PYIndexLib.json} +4 -4
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.json +2 -2
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +209 -41
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +13 -3
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +242 -0
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +14 -10
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +146 -0
- package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +170 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +12 -2
- package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +194 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +41 -10
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +12 -8
- package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +184 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +10 -12
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +1 -2
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +20 -10
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +3 -1
- package/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerMainchain.sol → PendleGaugeControllerMainchainUpg.sol} +0 -0
- package/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerSidechain.sol → PendleGaugeControllerSidechainUpg.sol} +0 -0
- package/contracts/core/LiquidityMining/PendleGauge.sol +3 -2
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +41 -29
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +4 -10
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +33 -16
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +2 -4
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +5 -1
- package/contracts/core/Market/PendleMarket.sol +4 -5
- package/contracts/core/Market/PendleMarketFactory.sol +2 -1
- package/contracts/core/PendleERC20.sol +1 -1
- package/contracts/core/YieldContracts/InterestManagerYT.sol +0 -2
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +2 -2
- package/contracts/core/YieldContracts/PendleYieldToken.sol +24 -32
- package/contracts/core/actions/ActionCallback.sol +10 -8
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +10 -9
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +5 -4
- package/contracts/core/actions/base/CallbackHelper.sol +1 -1
- package/contracts/interfaces/IEulerEToken.sol +60 -0
- package/contracts/interfaces/IEulerMarkets.sol +46 -0
- package/contracts/interfaces/IPGaugeController.sol +1 -1
- package/contracts/interfaces/IPInterestManagerYT.sol +1 -1
- package/contracts/interfaces/IPMarket.sol +1 -0
- package/contracts/interfaces/IPRouterStatic.sol +17 -10
- package/contracts/interfaces/IPVeToken.sol +2 -0
- package/contracts/interfaces/IPYieldToken.sol +2 -2
- package/contracts/interfaces/ISAvax.sol +61 -0
- package/contracts/interfaces/ISJoe.sol +60 -0
- package/contracts/interfaces/IStETH.sol +14 -0
- package/contracts/interfaces/IStargateLPStaking.sol +47 -0
- package/contracts/interfaces/IStargatePool.sol +49 -0
- package/contracts/interfaces/IStargateRouter.sol +37 -0
- package/contracts/interfaces/ISuperComposableYield.sol +6 -9
- package/contracts/interfaces/IWAvax.sol +34 -0
- package/contracts/libraries/RewardManager.sol +2 -3
- package/contracts/libraries/RewardManagerAbstract.sol +1 -0
- package/contracts/libraries/VeBalanceLib.sol +13 -0
- package/contracts/libraries/helpers/ArrayLib.sol +0 -17
- package/contracts/libraries/helpers/PYIndex.sol +69 -0
- package/contracts/libraries/helpers/TokenHelper.sol +4 -2
- package/contracts/libraries/math/LogExpMath.sol +46 -44
- package/contracts/libraries/math/MarketApproxLib.sol +10 -12
- package/contracts/libraries/math/MarketMathCore.sol +24 -15
- package/contracts/libraries/math/Math.sol +14 -0
- package/contracts/offchain-helpers/RouterStatic.sol +177 -66
- package/deployments/43113-benqi.json +2 -2
- package/deployments/43113-core.json +7 -7
- package/deployments/43113-markets/benqi-market-599408.json +7 -0
- package/deployments/43113-markets/benqi-market-93bbf0.json +7 -0
- package/deployments/80001-benqi.json +2 -2
- package/deployments/80001-core.json +6 -6
- package/deployments/80001-markets/benqi-market-007811.json +7 -0
- package/deployments/80001-markets/benqi-market-3fe528.json +7 -0
- package/package.json +3 -3
- package/typechain-types/CelerSenderUpg.ts +16 -16
- package/typechain-types/IERC20Upgradeable.ts +300 -0
- package/typechain-types/IEulerEToken.ts +320 -0
- package/typechain-types/IEulerMarkets.ts +204 -0
- package/typechain-types/IPInterestManagerYT.ts +3 -3
- package/typechain-types/IPRouterStatic.ts +75 -97
- package/typechain-types/IPVeToken.ts +34 -0
- package/typechain-types/IPYieldToken.ts +47 -47
- package/typechain-types/ISAvax.ts +430 -0
- package/typechain-types/ISJoe.ts +340 -0
- package/typechain-types/IStETH.ts +201 -0
- package/typechain-types/IStargateLPStaking.ts +108 -0
- package/typechain-types/IStargatePool.ts +94 -0
- package/typechain-types/ISuperComposableYield.ts +72 -26
- package/typechain-types/IWAvax.ts +380 -0
- package/typechain-types/PendleAaveV3SCY.ts +74 -28
- package/typechain-types/PendleERC4626SCY.ts +73 -27
- package/typechain-types/PendleEulerSCY.ts +965 -0
- package/typechain-types/PendlePrincipalToken.ts +0 -104
- package/typechain-types/PendleQiSAvaxSCY.ts +1098 -0
- package/typechain-types/PendleQiTokenSCY.ts +74 -28
- package/typechain-types/PendleSAvaxSCY.ts +962 -0
- package/typechain-types/PendleSJoeSCY.ts +1053 -0
- package/typechain-types/PendleStargatePool.ts +73 -27
- package/typechain-types/PendleStargateSCY.ts +1135 -0
- package/typechain-types/PendleVotingControllerUpg.ts +88 -75
- package/typechain-types/PendleWstEthSCY.ts +86 -27
- package/typechain-types/PendleYearnVaultScy.ts +73 -27
- package/typechain-types/PendleYieldToken.ts +44 -148
- package/typechain-types/RouterStatic.ts +327 -253
- package/typechain-types/SCYBase.ts +73 -27
- package/typechain-types/SCYBaseWithRewards.ts +73 -27
- package/typechain-types/VotingControllerStorageUpg.ts +0 -21
- package/typechain-types/VotingEscrowPendleMainchain.ts +118 -16
- package/typechain-types/VotingEscrowPendleSidechain.ts +34 -0
- package/typechain-types/VotingEscrowTokenBase.ts +34 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +1 -1
- package/typechain-types/factories/ActionYT__factory.ts +1 -1
- package/typechain-types/factories/CelerSenderUpg__factory.ts +2 -2
- package/typechain-types/factories/IERC20Upgradeable__factory.ts +209 -0
- package/typechain-types/factories/IEulerEToken__factory.ts +174 -0
- package/typechain-types/factories/IEulerMarkets__factory.ts +99 -0
- package/typechain-types/factories/IPInterestManagerYT__factory.ts +1 -1
- package/typechain-types/factories/IPRouterStatic__factory.ts +38 -23
- package/typechain-types/factories/IPVeToken__factory.ts +24 -0
- package/typechain-types/factories/IPYieldToken__factory.ts +27 -27
- package/typechain-types/factories/ISAvax__factory.ts +208 -0
- package/typechain-types/factories/ISJoe__factory.ts +177 -0
- package/typechain-types/factories/IStETH__factory.ts +101 -0
- package/typechain-types/factories/IStargateLPStaking__factory.ts +90 -0
- package/typechain-types/factories/IStargatePool__factory.ts +79 -0
- package/typechain-types/factories/ISuperComposableYield__factory.ts +36 -4
- package/typechain-types/factories/IWAvax__factory.ts +261 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +38 -6
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +37 -5
- package/typechain-types/factories/PendleEulerSCY__factory.ts +796 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -76
- package/typechain-types/factories/PendleQiSAvaxSCY__factory.ts +917 -0
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +38 -6
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleSAvaxSCY__factory.ts +796 -0
- package/typechain-types/factories/PendleSJoeSCY__factory.ts +845 -0
- package/typechain-types/factories/PendleStargatePool__factory.ts +37 -5
- package/typechain-types/factories/PendleStargateSCY__factory.ts +952 -0
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +44 -38
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +65 -6
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +37 -5
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +19 -94
- package/typechain-types/factories/RouterStatic__factory.ts +208 -40
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +36 -4
- package/typechain-types/factories/SCYBase__factory.ts +36 -4
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +0 -13
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +65 -3
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +25 -1
- package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +24 -0
- package/typechain-types/hardhat.d.ts +103 -13
- package/typechain-types/index.ts +24 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +0 -242
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +0 -329
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
- package/contracts/core/PendleERC20Permit.sol +0 -84
- package/contracts/libraries/SCY/SCYIndex.sol +0 -72
- package/deployments/43113-markets/benqi-market-5C60ba.json +0 -7
- package/deployments/43113-markets/benqi-market-611eA3.json +0 -7
- package/deployments/43113-markets/benqi-market-A386eA.json +0 -7
- package/deployments/43113-markets/benqi-market-bf8841.json +0 -7
- package/deployments/80001-markets/benqi-market-5E1104.json +0 -7
- package/deployments/80001-markets/benqi-market-899134.json +0 -7
- package/deployments/80001-markets/benqi-market-94C86f.json +0 -7
- package/deployments/80001-markets/benqi-market-c68429.json +0 -7
|
@@ -80,8 +80,9 @@ abstract contract PendleGauge is RewardManager {
|
|
|
80
80
|
virtual
|
|
81
81
|
returns (uint256)
|
|
82
82
|
{
|
|
83
|
-
uint256 vePendleBalance = vePENDLE.
|
|
84
|
-
|
|
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) {
|
|
@@ -73,20 +73,28 @@ contract PendleVotingControllerUpg is
|
|
|
73
73
|
require(vePendle.balanceOf(user) > 0, "zero vependle balance");
|
|
74
74
|
|
|
75
75
|
UserData storage uData = userData[user];
|
|
76
|
+
LockedPosition memory userPosition = _getUserVePendlePosition(user);
|
|
76
77
|
|
|
77
78
|
for (uint256 i = 0; i < pools.length; ++i) {
|
|
78
79
|
if (_isPoolActive(pools[i])) applyPoolSlopeChanges(pools[i]);
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
// Process weight-decrease pools first
|
|
81
83
|
for (uint256 i = 0; i < pools.length; ++i) {
|
|
82
|
-
if (uData.voteForPools[pools[i]].weight
|
|
83
|
-
_modifyVoteWeight(user, pools[i], weights[i]);
|
|
84
|
+
if (uData.voteForPools[pools[i]].weight > weights[i])
|
|
85
|
+
_modifyVoteWeight(user, pools[i], userPosition, weights[i]);
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
// Process weight-increase pools
|
|
86
89
|
for (uint256 i = 0; i < pools.length; ++i) {
|
|
87
|
-
if (uData.voteForPools[pools[i]].weight
|
|
88
|
-
_modifyVoteWeight(user, pools[i], weights[i]);
|
|
90
|
+
if (uData.voteForPools[pools[i]].weight <= weights[i])
|
|
91
|
+
_modifyVoteWeight(user, pools[i], userPosition, weights[i]);
|
|
89
92
|
}
|
|
93
|
+
|
|
94
|
+
require(
|
|
95
|
+
uData.totalVotedWeight <= VeBalanceLib.USER_VOTE_MAX_WEIGHT,
|
|
96
|
+
"exceeded max weight"
|
|
97
|
+
);
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
/**
|
|
@@ -140,7 +148,7 @@ contract PendleVotingControllerUpg is
|
|
|
140
148
|
* @dev state changes expected:
|
|
141
149
|
- the gaugeController receives the new pendle allocation
|
|
142
150
|
*/
|
|
143
|
-
function broadcastResults(uint64 chainId) external payable {
|
|
151
|
+
function broadcastResults(uint64 chainId) external payable refundUnusedEth {
|
|
144
152
|
uint128 wTime = WeekMath.getCurrentWeekStart();
|
|
145
153
|
require(weekData[wTime].isEpochFinalized, "epoch not finalized");
|
|
146
154
|
_broadcastResults(chainId, wTime, pendlePerSec);
|
|
@@ -157,6 +165,8 @@ contract PendleVotingControllerUpg is
|
|
|
157
165
|
* @dev state changes expected:
|
|
158
166
|
- add to allActivePools & chainPools
|
|
159
167
|
- set params in poolData
|
|
168
|
+
* @dev NOTE TO GOV: previous week's results should have been broadcasted prior to calling
|
|
169
|
+
this function
|
|
160
170
|
*/
|
|
161
171
|
function addPool(uint64 chainId, address pool) external onlyGovernance {
|
|
162
172
|
require(!_isPoolActive(pool), "pool already added");
|
|
@@ -173,6 +183,8 @@ contract PendleVotingControllerUpg is
|
|
|
173
183
|
- update weekData (if any)
|
|
174
184
|
- remove from allActivePools & chainPools
|
|
175
185
|
- clear data in poolData
|
|
186
|
+
* @dev NOTE TO GOV: previous week's results should have been broadcasted prior to calling
|
|
187
|
+
this function
|
|
176
188
|
*/
|
|
177
189
|
function removePool(address pool) external onlyGovernance {
|
|
178
190
|
require(_isPoolActive(pool), "invalid pool");
|
|
@@ -197,7 +209,7 @@ contract PendleVotingControllerUpg is
|
|
|
197
209
|
uint64 chainId,
|
|
198
210
|
uint128 wTime,
|
|
199
211
|
uint128 forcedPendlePerSec
|
|
200
|
-
) external payable onlyGovernance {
|
|
212
|
+
) external payable onlyGovernance refundUnusedEth {
|
|
201
213
|
_broadcastResults(chainId, wTime, forcedPendlePerSec);
|
|
202
214
|
}
|
|
203
215
|
|
|
@@ -205,12 +217,26 @@ contract PendleVotingControllerUpg is
|
|
|
205
217
|
* @notice set new pendlePerSec
|
|
206
218
|
* @dev no zero checks because gov may want to stop liquidity mining
|
|
207
219
|
* @dev state changes expected: pendlePerSec is updated
|
|
220
|
+
* @dev NOTE TO GOV: This should be done mid-week, well before the next broadcast to avoid
|
|
221
|
+
race condition
|
|
208
222
|
*/
|
|
209
223
|
function setPendlePerSec(uint128 newPendlePerSec) external onlyGovernance {
|
|
210
224
|
pendlePerSec = newPendlePerSec;
|
|
211
225
|
emit SetPendlePerSec(newPendlePerSec);
|
|
212
226
|
}
|
|
213
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
|
+
|
|
214
240
|
/*///////////////////////////////////////////////////////////////
|
|
215
241
|
INTERNAL FUNCTIONS
|
|
216
242
|
//////////////////////////////////////////////////////////////*/
|
|
@@ -237,12 +263,11 @@ contract PendleVotingControllerUpg is
|
|
|
237
263
|
|
|
238
264
|
for (uint256 i = 0; i < length; ++i) {
|
|
239
265
|
uint256 poolVotes = weekData[wTime].poolVotes[pools[i]];
|
|
240
|
-
|
|
241
|
-
totalPendleAmounts[i] = pendlePerSec * WEEK;
|
|
266
|
+
totalPendleAmounts[i] = (totalPendlePerSec * poolVotes * WEEK) / totalVotes;
|
|
242
267
|
}
|
|
243
268
|
|
|
244
269
|
if (chainId == block.chainid) {
|
|
245
|
-
address gaugeController =
|
|
270
|
+
address gaugeController = destinationContracts.get(chainId);
|
|
246
271
|
IPGaugeControllerMainchain(gaugeController).updateVotingResults(
|
|
247
272
|
wTime,
|
|
248
273
|
pools,
|
|
@@ -255,32 +280,19 @@ contract PendleVotingControllerUpg is
|
|
|
255
280
|
emit BroadcastResults(chainId, wTime, totalPendlePerSec);
|
|
256
281
|
}
|
|
257
282
|
|
|
258
|
-
|
|
259
|
-
* @notice return the corresponding voting power of an user given the weight. Basically his voting power
|
|
260
|
-
will be vePendle * weight / USER_VOTE_MAX_WEIGHT
|
|
261
|
-
* @notice governance will always has the vePendle equivalent to 1M PENDLE locked for MAX_LOCK_TIME
|
|
262
|
-
*/
|
|
263
|
-
function _getVotingPowerByWeight(address user, uint64 weight)
|
|
283
|
+
function _getUserVePendlePosition(address user)
|
|
264
284
|
internal
|
|
265
285
|
view
|
|
266
|
-
|
|
267
|
-
override
|
|
268
|
-
returns (VeBalance memory res)
|
|
286
|
+
returns (LockedPosition memory userPosition)
|
|
269
287
|
{
|
|
270
|
-
uint128 amount;
|
|
271
|
-
uint128 expiry;
|
|
272
|
-
|
|
273
288
|
if (user == _governance()) {
|
|
274
|
-
amount =
|
|
275
|
-
|
|
289
|
+
(userPosition.amount, userPosition.expiry) = (
|
|
290
|
+
GOVERNANCE_PENDLE_VOTE,
|
|
291
|
+
WeekMath.getWeekStartTimestamp(uint128(block.timestamp) + MAX_LOCK_TIME)
|
|
292
|
+
);
|
|
276
293
|
} else {
|
|
277
|
-
(amount, expiry) = vePendle.positionData(user);
|
|
294
|
+
(userPosition.amount, userPosition.expiry) = vePendle.positionData(user);
|
|
278
295
|
}
|
|
279
|
-
|
|
280
|
-
(res.bias, res.slope) = VeBalanceLib.convertToVeBalance(
|
|
281
|
-
uint128((uint256(amount) * weight) / USER_VOTE_MAX_WEIGHT),
|
|
282
|
-
expiry
|
|
283
|
-
);
|
|
284
296
|
}
|
|
285
297
|
|
|
286
298
|
function _authorizeUpgrade(address newImplementation) internal override onlyGovernance {}
|
|
@@ -14,6 +14,7 @@ import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
|
14
14
|
/// - it inherits only upgradable contract
|
|
15
15
|
abstract contract VotingControllerStorageUpg {
|
|
16
16
|
using VeBalanceLib for VeBalance;
|
|
17
|
+
using VeBalanceLib for LockedPosition;
|
|
17
18
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
18
19
|
using Checkpoints for Checkpoints.History;
|
|
19
20
|
|
|
@@ -42,7 +43,6 @@ abstract contract VotingControllerStorageUpg {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
uint128 public constant MAX_LOCK_TIME = 104 weeks;
|
|
45
|
-
uint64 public constant USER_VOTE_MAX_WEIGHT = 10**18;
|
|
46
46
|
uint128 public constant WEEK = 1 weeks;
|
|
47
47
|
uint128 public constant GOVERNANCE_PENDLE_VOTE = 10**24;
|
|
48
48
|
|
|
@@ -181,6 +181,7 @@ abstract contract VotingControllerStorageUpg {
|
|
|
181
181
|
function _modifyVoteWeight(
|
|
182
182
|
address user,
|
|
183
183
|
address pool,
|
|
184
|
+
LockedPosition memory userPosition,
|
|
184
185
|
uint64 weight
|
|
185
186
|
) internal returns (VeBalance memory newVote) {
|
|
186
187
|
UserData storage uData = userData[user];
|
|
@@ -202,14 +203,13 @@ abstract contract VotingControllerStorageUpg {
|
|
|
202
203
|
if (weight != 0) {
|
|
203
204
|
require(_isPoolActive(pool), "pool not active");
|
|
204
205
|
|
|
205
|
-
newVote =
|
|
206
|
+
newVote = userPosition.convertToVeBalance(weight);
|
|
206
207
|
|
|
207
208
|
pData.totalVote = pData.totalVote.add(newVote);
|
|
208
209
|
pData.slopeChanges[newVote.getExpiry()] += newVote.slope;
|
|
209
210
|
|
|
210
211
|
uData.voteForPools[pool] = UserPoolData(weight, newVote);
|
|
211
212
|
uData.totalVotedWeight += weight;
|
|
212
|
-
require(uData.totalVotedWeight <= USER_VOTE_MAX_WEIGHT, "exceeded max weight");
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
userPoolHistory[user][pool].push(newVote);
|
|
@@ -217,7 +217,7 @@ abstract contract VotingControllerStorageUpg {
|
|
|
217
217
|
|
|
218
218
|
function _setAllPastEpochsAsFinalized() internal {
|
|
219
219
|
uint128 wTime = WeekMath.getCurrentWeekStart();
|
|
220
|
-
while (wTime
|
|
220
|
+
while (wTime > deployedWTime && weekData[wTime].isEpochFinalized == false) {
|
|
221
221
|
weekData[wTime].isEpochFinalized = true;
|
|
222
222
|
wTime -= WEEK;
|
|
223
223
|
}
|
|
@@ -232,10 +232,4 @@ abstract contract VotingControllerStorageUpg {
|
|
|
232
232
|
function _isVoteActive(VeBalance memory vote) internal view returns (bool) {
|
|
233
233
|
return vote.slope != 0 && !MiniHelpers.isCurrentlyExpired(vote.getExpiry());
|
|
234
234
|
}
|
|
235
|
-
|
|
236
|
-
function _getVotingPowerByWeight(address user, uint64 weight)
|
|
237
|
-
internal
|
|
238
|
-
view
|
|
239
|
-
virtual
|
|
240
|
-
returns (VeBalance memory res);
|
|
241
235
|
}
|
|
@@ -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");
|
|
@@ -77,7 +82,7 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
77
82
|
pendle.safeTransferFrom(user, address(this), additionalAmountToLock);
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
newVeBalance = _increasePosition(user,
|
|
85
|
+
newVeBalance = _increasePosition(user, additionalAmountToLock, additionalDurationToLock);
|
|
81
86
|
|
|
82
87
|
emit NewLockPosition(user, newTotalAmountLocked, newExpiry);
|
|
83
88
|
}
|
|
@@ -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()
|
|
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)
|
|
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
|
|
@@ -152,8 +169,8 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
152
169
|
*/
|
|
153
170
|
function _increasePosition(
|
|
154
171
|
address user,
|
|
155
|
-
uint128
|
|
156
|
-
uint128
|
|
172
|
+
uint128 amountToIncrease,
|
|
173
|
+
uint128 durationToIncrease
|
|
157
174
|
) internal returns (uint128) {
|
|
158
175
|
LockedPosition memory oldPosition = positionData[user];
|
|
159
176
|
|
|
@@ -206,38 +223,38 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
206
223
|
_totalSupply = supply;
|
|
207
224
|
lastSlopeChangeAppliedAt = wTime;
|
|
208
225
|
|
|
209
|
-
return (supply,
|
|
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,
|
|
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(
|
|
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
|
|
234
|
-
(VeBalance memory supply,
|
|
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
|
-
|
|
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()
|
|
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 (
|
|
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()
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
200
|
+
YT.newIndex(),
|
|
202
201
|
exactPtOut,
|
|
203
202
|
block.timestamp
|
|
204
203
|
);
|
|
@@ -78,13 +78,14 @@ contract PendleMarketFactory is PermissionsV2Upg, Initializable, IPMarketFactory
|
|
|
78
78
|
int256 scalarRoot,
|
|
79
79
|
int256 initialAnchor
|
|
80
80
|
) external returns (address market) {
|
|
81
|
+
require(!IPPrincipalToken(PT).isExpired(), "PT is expired");
|
|
81
82
|
require(IPYieldContractFactory(yieldContractFactory).isPT(PT), "Invalid PT");
|
|
82
83
|
require(markets[PT][scalarRoot][initialAnchor] == address(0), "market already created");
|
|
83
84
|
|
|
84
85
|
// no need salt since market's existence has been checked before hand
|
|
85
86
|
market = SSTORE2Deployer.create2(
|
|
86
87
|
marketCreationCodePointer,
|
|
87
|
-
bytes32(
|
|
88
|
+
bytes32(block.chainid),
|
|
88
89
|
abi.encode(PT, scalarRoot, initialAnchor, vePendle, gaugeController)
|
|
89
90
|
);
|
|
90
91
|
|
|
@@ -352,7 +352,7 @@ contract PendleERC20 is Context, IERC20, IERC20Metadata {
|
|
|
352
352
|
) internal virtual {}
|
|
353
353
|
|
|
354
354
|
function toUint248(uint256 x) internal virtual returns (uint248) {
|
|
355
|
-
require(x
|
|
355
|
+
require(x <= type(uint248).max); // signed, lim = bit-1
|
|
356
356
|
return uint248(x);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -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 "../
|
|
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
|
|
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
|
-
)
|
|
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(
|
|
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(
|
|
113
|
+
bytes32(block.chainid),
|
|
114
114
|
abi.encode(
|
|
115
115
|
SCY,
|
|
116
116
|
PT,
|