@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.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
- 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 +2 -2
- 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/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +1 -1
- 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 +20 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
- 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/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- 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 +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- 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 +47 -28
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- 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/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 +23 -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 +1 -1
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- 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/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- 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/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/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 +39 -39
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +242 -0
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +1 -1
- 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/PendleWstEthSCY.sol +33 -6
- package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +184 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +19 -10
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +3 -1
- package/contracts/core/LiquidityMining/PendleGauge.sol +3 -2
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +25 -7
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +0 -4
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +30 -13
- 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 +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 -25
- package/contracts/core/actions/ActionCallback.sol +7 -7
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +10 -9
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +4 -4
- package/contracts/interfaces/IEulerEToken.sol +60 -0
- package/contracts/interfaces/IEulerMarkets.sol +46 -0
- package/contracts/interfaces/IPInterestManagerYT.sol +1 -1
- package/contracts/interfaces/IPMarket.sol +1 -0
- package/contracts/interfaces/IPRouterStatic.sol +2 -7
- 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/IWAvax.sol +34 -0
- package/contracts/libraries/helpers/PYIndex.sol +69 -0
- package/contracts/libraries/math/MarketApproxLib.sol +5 -5
- package/contracts/libraries/math/MarketMathCore.sol +10 -10
- package/contracts/offchain-helpers/RouterStatic.sol +21 -39
- 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 +1 -1
- 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 +60 -118
- 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/IWAvax.ts +380 -0
- package/typechain-types/PendleEulerSCY.ts +965 -0
- package/typechain-types/PendlePrincipalToken.ts +0 -104
- package/typechain-types/PendleQiSAvaxSCY.ts +1098 -0
- package/typechain-types/PendleSAvaxSCY.ts +962 -0
- package/typechain-types/PendleSJoeSCY.ts +1053 -0
- package/typechain-types/PendleVotingControllerUpg.ts +89 -55
- package/typechain-types/PendleWstEthSCY.ts +13 -0
- package/typechain-types/PendleYieldToken.ts +44 -148
- package/typechain-types/RouterStatic.ts +133 -299
- 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 +23 -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/IWAvax__factory.ts +261 -0
- 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 +1 -1
- 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/PendleVotingControllerUpg__factory.ts +45 -26
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +29 -2
- 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 +38 -38
- 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 +98 -17
- package/typechain-types/index.ts +22 -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-4Ccb97.json +0 -7
- package/deployments/43113-markets/benqi-market-534471.json +0 -7
- package/deployments/80001-markets/benqi-market-109acB.json +0 -7
- 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
|
-
|
|
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(
|
|
30
|
-
address toAddr =
|
|
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
|
|
45
|
+
function _afterAddDestinationContract(address addr, uint256 chainId) internal virtual {}
|
|
37
46
|
|
|
38
|
-
function
|
|
47
|
+
function addDestinationContract(address _address, uint256 _chainId)
|
|
39
48
|
external
|
|
40
49
|
payable
|
|
41
50
|
onlyGovernance
|
|
42
51
|
{
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
destinationContracts.set(_chainId, _address);
|
|
53
|
+
_afterAddDestinationContract(_address, _chainId);
|
|
45
54
|
}
|
|
46
55
|
|
|
47
|
-
function
|
|
56
|
+
function getAllDestinationContracts()
|
|
48
57
|
public
|
|
49
58
|
view
|
|
50
59
|
returns (uint256[] memory chainIds, address[] memory addrs)
|
|
51
60
|
{
|
|
52
|
-
uint256 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]) =
|
|
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
|
-
|
|
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.
|
|
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) {
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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 =
|
|
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()
|
|
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
|
|
@@ -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
|
);
|
|
@@ -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(
|
|
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 "../
|
|
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,
|