@pendle/core-v2 0.7.1-beta-2 → 0.8.0-beta
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 +33 -17
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- 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 +33 -17
- 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 +33 -17
- 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 +33 -17
- 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 +33 -17
- 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 +31 -15
- 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 +31 -15
- 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/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.json +0 -26
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +125 -111
- 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/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.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 +77 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +51 -20
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +72 -93
- 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 +3 -3
- 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/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/IPActionCore.sol/IPActionCore.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/IPAllAction.sol/IPAllAction.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/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +48 -83
- 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/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- 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/IPYieldContractFactory.sol/IPYieldContractFactory.json +30 -4
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +8 -92
- 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/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +31 -2
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.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/SCYIndex.sol/SCYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.json +2 -2
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.json +2 -2
- 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/ExpiryUtilsLib.sol/ExpiryUtils.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.json +2 -2
- 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/math/WeekMath.sol/WeekMath.json +2 -2
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.json +2 -2
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.json +2 -2
- 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 +2 -2
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.json +2 -2
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +16 -12
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +3 -3
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +29 -2
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +63 -41
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +0 -7
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +1 -1
- package/contracts/core/LiquidityMining/PendleGauge.sol +24 -8
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +47 -96
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +86 -73
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +17 -16
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +1 -1
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +3 -4
- package/contracts/core/Market/PendleMarket.sol +32 -62
- package/contracts/core/PendleRouter.sol +1 -1
- package/contracts/core/YieldContracts/InterestManagerYT.sol +11 -8
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +18 -12
- package/contracts/core/YieldContracts/PendleYieldToken.sol +167 -140
- package/contracts/core/actions/ActionCallback.sol +11 -10
- package/contracts/core/actions/ActionCore.sol +84 -22
- package/contracts/core/actions/ActionYT.sol +33 -15
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +4 -15
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +20 -50
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +2 -12
- package/contracts/interfaces/IPActionCore.sol +72 -1
- package/contracts/interfaces/IPActionYT.sol +15 -0
- package/contracts/interfaces/IPMarket.sol +7 -26
- package/contracts/interfaces/IPVeToken.sol +0 -2
- package/contracts/interfaces/IPVotingEscrow.sol +1 -1
- package/contracts/interfaces/IPYieldContractFactory.sol +6 -2
- package/contracts/interfaces/IPYieldToken.sol +21 -11
- package/contracts/interfaces/ISuperComposableYield.sol +22 -28
- package/contracts/interfaces/IYearnVault.sol +8 -0
- package/contracts/libraries/RewardManager.sol +9 -6
- package/contracts/libraries/RewardManagerAbstract.sol +6 -8
- package/contracts/libraries/SCY/SCYIndex.sol +10 -0
- package/contracts/libraries/VeBalanceLib.sol +0 -1
- package/contracts/libraries/helpers/ArrayLib.sol +11 -0
- package/contracts/libraries/helpers/TokenHelper.sol +6 -5
- package/contracts/libraries/math/MarketApproxLib.sol +91 -36
- package/contracts/libraries/math/Math.sol +2 -4
- package/contracts/offchain-helpers/RouterStatic.sol +2 -2
- package/deployments/43113-core.json +11 -11
- package/deployments/43113-markets/benqi-market-0xF3150c14F776c50C9D397054d38979c7B77FC41D.json +7 -0
- package/deployments/80001-core.json +10 -10
- package/deployments/80001-markets/benqi-market-0x150b6eb90Bf636eC0c4328d13d1e1d4adDBAF904.json +7 -0
- package/package.json +2 -2
- package/typechain-types/ActionCore.ts +8 -8
- package/typechain-types/CelerReceiver.ts +267 -0
- package/typechain-types/CelerSender.ts +164 -0
- package/typechain-types/IPActionCore.ts +8 -8
- package/typechain-types/IPAllAction.ts +8 -8
- package/typechain-types/IPMarket.ts +66 -109
- package/typechain-types/IPVotingEscrowController.ts +154 -0
- package/typechain-types/IPYieldContractFactory.ts +34 -0
- package/typechain-types/IPYieldToken.ts +12 -112
- package/typechain-types/ISuperComposableYield.ts +54 -10
- package/typechain-types/PendleAaveV3SCY.ts +54 -29
- package/typechain-types/PendleBtrflyScy.ts +56 -58
- package/typechain-types/PendleERC4626SCY.ts +54 -29
- package/typechain-types/PendleGauge.ts +0 -32
- package/typechain-types/PendleGaugeController.ts +282 -0
- package/typechain-types/PendleGaugeControllerMainchain.ts +346 -0
- package/typechain-types/PendleGaugeControllerSidechain.ts +460 -0
- package/typechain-types/PendleJoeLpSCY.ts +56 -58
- package/typechain-types/PendleMarket.ts +169 -140
- package/typechain-types/PendlePrincipalToken.ts +104 -0
- package/typechain-types/PendleQiTokenSCY.ts +54 -29
- package/typechain-types/PendleVotingController.ts +865 -0
- package/typechain-types/PendleWstEthSCY.ts +54 -29
- package/typechain-types/PendleYearnVaultSCY.ts +54 -29
- package/typechain-types/PendleYieldContractFactory.ts +66 -19
- package/typechain-types/PendleYieldToken.ts +122 -158
- package/typechain-types/SCYBase.ts +54 -29
- package/typechain-types/SCYBaseWithRewards.ts +54 -29
- package/typechain-types/VotingControllerStorage.ts +410 -0
- package/typechain-types/VotingEscrowController.ts +154 -0
- package/typechain-types/VotingEscrowToken.ts +335 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +2 -2
- package/typechain-types/factories/ActionYT__factory.ts +1 -1
- package/typechain-types/factories/CelerReceiver__factory.ts +140 -0
- package/typechain-types/factories/CelerSender__factory.ts +67 -0
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IPActionCore__factory.ts +1 -1
- package/typechain-types/factories/IPAllAction__factory.ts +1 -1
- package/typechain-types/factories/IPMarket__factory.ts +48 -83
- package/typechain-types/factories/IPVotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +30 -4
- package/typechain-types/factories/IPYieldToken__factory.ts +6 -90
- package/typechain-types/factories/ISuperComposableYield__factory.ts +31 -2
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +32 -16
- package/typechain-types/factories/PendleBtrflyScy__factory.ts +52 -28
- 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 +32 -16
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerMainchain__factory.ts +269 -0
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechain__factory.ts +328 -0
- package/typechain-types/factories/PendleGaugeController__factory.ts +149 -0
- package/typechain-types/factories/PendleGauge__factory.ts +0 -26
- package/typechain-types/factories/PendleGovernanceManager__factory.ts +1 -1
- package/typechain-types/factories/PendleJoeLpSCY__factory.ts +34 -28
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +124 -110
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +76 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingController__factory.ts +584 -0
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleYearnVaultSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +54 -19
- package/typechain-types/factories/PendleYieldToken__factory.ts +70 -91
- package/typechain-types/factories/RouterStatic__factory.ts +1 -1
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +31 -15
- package/typechain-types/factories/SCYBase__factory.ts +31 -15
- package/typechain-types/factories/VotingControllerStorage__factory.ts +298 -0
- package/typechain-types/factories/VotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowToken__factory.ts +225 -0
- package/typechain-types/hardhat.d.ts +0 -27
- package/typechain-types/index.ts +0 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.json +0 -635
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.json +0 -653
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.json +0 -67
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.json +0 -10
- package/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol +0 -123
- package/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol +0 -245
- package/contracts/interfaces/IPMarketAddRemoveCallback.sol +0 -18
- package/contracts/libraries/solmate/Bytes32AddressLib.sol +0 -14
- package/deployments/43113-markets/benqi-market.json +0 -7
- package/deployments/80001-markets/benqi-market.json +0 -7
|
@@ -7,6 +7,7 @@ import "../../interfaces/IYearnVault.sol";
|
|
|
7
7
|
contract PendleYearnVaultSCY is SCYBase {
|
|
8
8
|
address public immutable underlying;
|
|
9
9
|
address public immutable yvToken;
|
|
10
|
+
uint256 internal immutable yvTokenDecimals;
|
|
10
11
|
|
|
11
12
|
constructor(
|
|
12
13
|
string memory _name,
|
|
@@ -16,6 +17,7 @@ contract PendleYearnVaultSCY is SCYBase {
|
|
|
16
17
|
require(_yvToken != address(0), "zero address");
|
|
17
18
|
yvToken = _yvToken;
|
|
18
19
|
underlying = IYearnVault(yvToken).token();
|
|
20
|
+
yvTokenDecimals = IYearnVault(yvToken).decimals();
|
|
19
21
|
_safeApprove(underlying, yvToken, type(uint256).max);
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -66,7 +68,7 @@ contract PendleYearnVaultSCY is SCYBase {
|
|
|
66
68
|
uint256 sharesRedeemed = IYearnVault(yvToken).withdraw(amountSharesToRedeem);
|
|
67
69
|
|
|
68
70
|
require(
|
|
69
|
-
sharesRedeemed
|
|
71
|
+
sharesRedeemed == amountSharesToRedeem,
|
|
70
72
|
"Yearn Vault SCY: Not allowed to redeem all shares"
|
|
71
73
|
);
|
|
72
74
|
|
|
@@ -83,13 +85,38 @@ contract PendleYearnVaultSCY is SCYBase {
|
|
|
83
85
|
* @dev It is the price per share of the yvToken
|
|
84
86
|
*/
|
|
85
87
|
function exchangeRate() public view override returns (uint256) {
|
|
86
|
-
|
|
88
|
+
uint256 price = IYearnVault(yvToken).pricePerShare();
|
|
89
|
+
if (yvTokenDecimals <= 18) {
|
|
90
|
+
return price * (10**(18 - yvTokenDecimals));
|
|
91
|
+
} else {
|
|
92
|
+
return price / (10**(yvTokenDecimals - 18));
|
|
93
|
+
}
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
/*///////////////////////////////////////////////////////////////
|
|
90
97
|
MISC FUNCTIONS FOR METADATA
|
|
91
98
|
//////////////////////////////////////////////////////////////*/
|
|
92
99
|
|
|
100
|
+
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
101
|
+
internal
|
|
102
|
+
view
|
|
103
|
+
override
|
|
104
|
+
returns (uint256 amountSharesOut)
|
|
105
|
+
{
|
|
106
|
+
if (tokenIn == yvToken) amountSharesOut = amountTokenToDeposit;
|
|
107
|
+
else amountSharesOut = (amountTokenToDeposit * 1e18) / exchangeRate();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
111
|
+
internal
|
|
112
|
+
view
|
|
113
|
+
override
|
|
114
|
+
returns (uint256 amountTokenOut)
|
|
115
|
+
{
|
|
116
|
+
if (tokenOut == yvToken) amountTokenOut = amountSharesToRedeem;
|
|
117
|
+
else amountTokenOut = (amountSharesToRedeem * exchangeRate()) / 1e18;
|
|
118
|
+
}
|
|
119
|
+
|
|
93
120
|
/**
|
|
94
121
|
* @dev See {ISuperComposableYield-getBaseTokens}
|
|
95
122
|
*/
|
|
@@ -14,13 +14,6 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
14
14
|
|
|
15
15
|
address public immutable yieldToken;
|
|
16
16
|
|
|
17
|
-
uint256 public yieldTokenReserve;
|
|
18
|
-
|
|
19
|
-
modifier updateYieldReserve() {
|
|
20
|
-
_;
|
|
21
|
-
_updateYieldReserve();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
17
|
constructor(
|
|
25
18
|
string memory _name,
|
|
26
19
|
string memory _symbol,
|
|
@@ -42,21 +35,20 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
42
35
|
function deposit(
|
|
43
36
|
address receiver,
|
|
44
37
|
address tokenIn,
|
|
45
|
-
uint256
|
|
38
|
+
uint256 amountTokenToDeposit,
|
|
46
39
|
uint256 minSharesOut
|
|
47
|
-
) external payable nonReentrant
|
|
40
|
+
) external payable nonReentrant returns (uint256 amountSharesOut) {
|
|
48
41
|
require(isValidBaseToken(tokenIn), "SCY: Invalid tokenIn");
|
|
42
|
+
require(amountTokenToDeposit != 0, "SCY: amountTokenToDeposit cannot be 0");
|
|
49
43
|
|
|
50
|
-
if (tokenIn == NATIVE) require(
|
|
51
|
-
else
|
|
44
|
+
if (tokenIn == NATIVE) require(msg.value == amountTokenToDeposit, "SCY: eth mismatch");
|
|
45
|
+
else _transferIn(tokenIn, msg.sender, amountTokenToDeposit);
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
amountSharesOut = _deposit(tokenIn, amountDeposited);
|
|
56
|
-
require(amountSharesOut >= minSharesOut, "insufficient out");
|
|
47
|
+
amountSharesOut = _deposit(tokenIn, amountTokenToDeposit);
|
|
48
|
+
require(amountSharesOut >= minSharesOut, "SCY: insufficient out");
|
|
57
49
|
|
|
58
50
|
_mint(receiver, amountSharesOut);
|
|
59
|
-
emit Deposit(msg.sender, receiver, tokenIn,
|
|
51
|
+
emit Deposit(msg.sender, receiver, tokenIn, amountTokenToDeposit, amountSharesOut);
|
|
60
52
|
}
|
|
61
53
|
|
|
62
54
|
/**
|
|
@@ -64,22 +56,36 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
64
56
|
*/
|
|
65
57
|
function redeem(
|
|
66
58
|
address receiver,
|
|
67
|
-
uint256
|
|
59
|
+
uint256 amountSharesToRedeem,
|
|
68
60
|
address tokenOut,
|
|
69
61
|
uint256 minTokenOut
|
|
70
|
-
) external nonReentrant
|
|
71
|
-
|
|
62
|
+
) external nonReentrant returns (uint256 amountTokenOut) {
|
|
63
|
+
_burn(msg.sender, amountSharesToRedeem);
|
|
64
|
+
amountTokenOut = _redeem(receiver, amountSharesToRedeem, tokenOut, minTokenOut);
|
|
65
|
+
}
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
function redeemAfterTransfer(
|
|
68
|
+
address receiver,
|
|
69
|
+
address tokenOut,
|
|
70
|
+
uint256 minTokenOut
|
|
71
|
+
) external nonReentrant returns (uint256 amountTokenOut) {
|
|
72
|
+
uint256 amountSharesToRedeem = balanceOf(address(this));
|
|
73
|
+
_burn(address(this), amountSharesToRedeem);
|
|
74
|
+
amountTokenOut = _redeem(receiver, amountSharesToRedeem, tokenOut, minTokenOut);
|
|
75
|
+
}
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
function _redeem(
|
|
78
|
+
address receiver,
|
|
79
|
+
uint256 amountSharesToRedeem,
|
|
80
|
+
address tokenOut,
|
|
81
|
+
uint256 minTokenOut
|
|
82
|
+
) internal returns (uint256 amountTokenOut) {
|
|
83
|
+
require(isValidBaseToken(tokenOut), "SCY: invalid tokenOut");
|
|
84
|
+
require(amountSharesToRedeem != 0, "SCY: amountSharesToRedeem cannot be 0");
|
|
78
85
|
|
|
79
86
|
amountTokenOut = _redeem(tokenOut, amountSharesToRedeem);
|
|
80
|
-
require(amountTokenOut >= minTokenOut, "insufficient out");
|
|
87
|
+
require(amountTokenOut >= minTokenOut, "SCY: insufficient out");
|
|
81
88
|
|
|
82
|
-
_burn(address(this), amountSharesToRedeem);
|
|
83
89
|
_transferOut(tokenOut, receiver, amountTokenOut);
|
|
84
90
|
|
|
85
91
|
emit Redeem(msg.sender, receiver, tokenOut, amountSharesToRedeem, amountTokenOut);
|
|
@@ -107,22 +113,6 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
107
113
|
virtual
|
|
108
114
|
returns (uint256 amountTokenOut);
|
|
109
115
|
|
|
110
|
-
/**
|
|
111
|
-
* @notice updates the amount of yield token reserves in this contract
|
|
112
|
-
*/
|
|
113
|
-
function _updateYieldReserve() internal virtual {
|
|
114
|
-
yieldTokenReserve = _selfBalance(yieldToken);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* @notice returns the amount of unprocessed tokens owned by this contract
|
|
119
|
-
* @param token address of the token to be queried
|
|
120
|
-
*/
|
|
121
|
-
function _getFloatingAmount(address token) internal view virtual returns (uint256) {
|
|
122
|
-
if (token != yieldToken) return _selfBalance(token);
|
|
123
|
-
return _selfBalance(token) - yieldTokenReserve;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
116
|
/*///////////////////////////////////////////////////////////////
|
|
127
117
|
EXCHANGE-RATE
|
|
128
118
|
//////////////////////////////////////////////////////////////*/
|
|
@@ -185,6 +175,38 @@ abstract contract SCYBase is ISuperComposableYield, PendleERC20, TokenHelper {
|
|
|
185
175
|
MISC METADATA FUNCTIONS
|
|
186
176
|
//////////////////////////////////////////////////////////////*/
|
|
187
177
|
|
|
178
|
+
function previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
179
|
+
external
|
|
180
|
+
view
|
|
181
|
+
virtual
|
|
182
|
+
returns (uint256 amountSharesOut)
|
|
183
|
+
{
|
|
184
|
+
require(isValidBaseToken(tokenIn), "SCY: Invalid tokenIn");
|
|
185
|
+
return _previewDeposit(tokenIn, amountTokenToDeposit);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
189
|
+
external
|
|
190
|
+
view
|
|
191
|
+
virtual
|
|
192
|
+
returns (uint256 amountTokenOut)
|
|
193
|
+
{
|
|
194
|
+
require(isValidBaseToken(tokenOut), "SCY: Invalid tokenOut");
|
|
195
|
+
return _previewRedeem(tokenOut, amountSharesToRedeem);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
199
|
+
internal
|
|
200
|
+
view
|
|
201
|
+
virtual
|
|
202
|
+
returns (uint256 amountSharesOut);
|
|
203
|
+
|
|
204
|
+
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
205
|
+
internal
|
|
206
|
+
view
|
|
207
|
+
virtual
|
|
208
|
+
returns (uint256 amountTokenOut);
|
|
209
|
+
|
|
188
210
|
/**
|
|
189
211
|
* @notice See {ISuperComposableYield-getBaseTokens}
|
|
190
212
|
*/
|
|
@@ -20,13 +20,6 @@ abstract contract SCYBaseWithRewards is SCYBase, RewardManager {
|
|
|
20
20
|
SCYBase(_name, _symbol, _yieldToken) // solhint-disable-next-line no-empty-blocks
|
|
21
21
|
{}
|
|
22
22
|
|
|
23
|
-
function _getFloatingAmount(address token) internal view virtual override returns (uint256) {
|
|
24
|
-
// there are only 2 type of tokens stored in the contract: yieldToken & rewardToken. Since
|
|
25
|
-
// this is not yield, it must be reward
|
|
26
|
-
if (token != yieldToken) return _selfBalance(token) - rewardState[token].lastBalance;
|
|
27
|
-
return _selfBalance(token) - yieldTokenReserve;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
23
|
/*///////////////////////////////////////////////////////////////
|
|
31
24
|
REWARDS-RELATED
|
|
32
25
|
//////////////////////////////////////////////////////////////*/
|
|
@@ -35,7 +35,7 @@ abstract contract PendleGaugeControllerBaseUpg is IPGaugeController, Permissions
|
|
|
35
35
|
uint128 incentiveEndsAt;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
uint128
|
|
38
|
+
uint128 internal constant WEEK = 1 weeks;
|
|
39
39
|
|
|
40
40
|
address public immutable pendle;
|
|
41
41
|
IPMarketFactory public immutable marketFactory;
|
|
@@ -9,6 +9,10 @@ import "../../libraries/math/Math.sol";
|
|
|
9
9
|
import "../../libraries/helpers/ArrayLib.sol";
|
|
10
10
|
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
Invariants to maintain:
|
|
14
|
+
- before any changes to active balance, updateAndDistributeRewards() must be called
|
|
15
|
+
*/
|
|
12
16
|
abstract contract PendleGauge is RewardManager {
|
|
13
17
|
using Math for uint256;
|
|
14
18
|
using SafeERC20 for IERC20;
|
|
@@ -17,10 +21,10 @@ abstract contract PendleGauge is RewardManager {
|
|
|
17
21
|
address private immutable SCY;
|
|
18
22
|
|
|
19
23
|
uint256 internal constant TOKENLESS_PRODUCTION = 40;
|
|
20
|
-
address internal immutable PENDLE;
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
address internal immutable PENDLE;
|
|
26
|
+
IPVeToken internal immutable vePENDLE;
|
|
27
|
+
address internal immutable gaugeController;
|
|
24
28
|
|
|
25
29
|
uint256 public totalActiveSupply;
|
|
26
30
|
mapping(address => uint256) public activeBalance;
|
|
@@ -37,7 +41,9 @@ abstract contract PendleGauge is RewardManager {
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
/**
|
|
40
|
-
* @dev
|
|
44
|
+
* @dev Since rewardShares is based on activeBalance, user's activeBalance must be updated AFTER
|
|
45
|
+
rewards is updated
|
|
46
|
+
* @dev It's intended to have user's activeBalance updated when rewards is redeemed
|
|
41
47
|
*/
|
|
42
48
|
function _redeemRewards(address user) internal virtual returns (uint256[] memory) {
|
|
43
49
|
_updateAndDistributeRewards(user);
|
|
@@ -45,10 +51,21 @@ abstract contract PendleGauge is RewardManager {
|
|
|
45
51
|
return _doTransferOutRewards(user, user);
|
|
46
52
|
}
|
|
47
53
|
|
|
54
|
+
function _updateUserActiveBalance(address user) internal virtual {
|
|
55
|
+
_updateUserActiveBalanceForTwo(user, address(0));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _updateUserActiveBalanceForTwo(address user1, address user2) internal virtual {
|
|
59
|
+
if (user1 != address(0) && user1 != address(this)) _updateUserActiveBalancePrivate(user1);
|
|
60
|
+
if (user2 != address(0) && user2 != address(this)) _updateUserActiveBalancePrivate(user2);
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
/**
|
|
49
|
-
* @dev
|
|
64
|
+
* @dev should only be callable from `_updateUserActiveBalanceForTwo` to guarantee user != address(0) && user != address(this)
|
|
50
65
|
*/
|
|
51
|
-
function
|
|
66
|
+
function _updateUserActiveBalancePrivate(address user) private {
|
|
67
|
+
assert(user != address(0) && user != address(this));
|
|
68
|
+
|
|
52
69
|
uint256 lpBalance = _stakedBalance(user);
|
|
53
70
|
uint256 veBoostedLpBalance = _calcVeBoostedLpBalance(user, lpBalance);
|
|
54
71
|
|
|
@@ -112,7 +129,6 @@ abstract contract PendleGauge is RewardManager {
|
|
|
112
129
|
address to,
|
|
113
130
|
uint256
|
|
114
131
|
) internal virtual {
|
|
115
|
-
|
|
116
|
-
if (to != address(0) && to != address(this)) _updateUserActiveBalance(to);
|
|
132
|
+
_updateUserActiveBalanceForTwo(from, to);
|
|
117
133
|
}
|
|
118
134
|
}
|
|
@@ -59,98 +59,90 @@ contract PendleVotingControllerUpg is
|
|
|
59
59
|
//////////////////////////////////////////////////////////////*/
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* @notice set a new voting weight for the target pool
|
|
63
|
-
* @dev pre-condition:
|
|
64
|
-
- pool must have been added before
|
|
65
|
-
- the vePENDLE position must still be active
|
|
66
62
|
* @dev state changes expected:
|
|
67
63
|
- update weekData (if any)
|
|
68
|
-
- update
|
|
69
|
-
- add 1 check point for
|
|
64
|
+
- update poolData, userData to reflect the new vote
|
|
65
|
+
- add 1 check point for each of pools
|
|
70
66
|
* @dev vePENDLE position not expired is a must, else bias - t*slope < 0 & it will be
|
|
71
67
|
negative weight
|
|
72
68
|
*/
|
|
73
|
-
function vote(address
|
|
69
|
+
function vote(address[] calldata pools, uint64[] calldata weights) external {
|
|
74
70
|
address user = msg.sender;
|
|
75
71
|
|
|
76
|
-
require(
|
|
77
|
-
require(
|
|
78
|
-
require(!vePendle.isPositionExpired(user), "user position expired");
|
|
72
|
+
require(weights.length == pools.length, "invaid array length");
|
|
73
|
+
require(vePendle.balanceOf(user) > 0, "zero vependle balance");
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
_unvote(user, pool, false);
|
|
82
|
-
_vote(user, pool, weight);
|
|
83
|
-
}
|
|
75
|
+
UserData storage uData = userData[user];
|
|
84
76
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
for (uint256 i = 0; i < pools.length; ++i) {
|
|
78
|
+
if (_isPoolActive(pools[i])) applyPoolSlopeChanges(pools[i]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
for (uint256 i = 0; i < pools.length; ++i) {
|
|
82
|
+
if (uData.voteForPools[pools[i]].weight <= weights[i])
|
|
83
|
+
_modifyVoteWeight(user, pools[i], weights[i]);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (uint256 i = 0; i < pools.length; ++i) {
|
|
87
|
+
if (uData.voteForPools[pools[i]].weight > weights[i])
|
|
88
|
+
_modifyVoteWeight(user, pools[i], weights[i]);
|
|
97
89
|
}
|
|
98
|
-
_unvote(msg.sender, pool, true);
|
|
99
90
|
}
|
|
100
91
|
|
|
101
92
|
/**
|
|
102
93
|
* @notice Process all the slopeChanges that haven't been processed & update these data into
|
|
103
|
-
|
|
104
|
-
* @dev pre-condition: the pool must be
|
|
94
|
+
poolData
|
|
95
|
+
* @dev pre-condition: the pool must be active
|
|
105
96
|
* @dev state changes expected:
|
|
106
97
|
- update weekData
|
|
107
|
-
- update
|
|
98
|
+
- update poolData
|
|
108
99
|
*/
|
|
109
|
-
function
|
|
110
|
-
require(
|
|
100
|
+
function applyPoolSlopeChanges(address pool) public {
|
|
101
|
+
require(_isPoolActive(pool), "invalid pool");
|
|
111
102
|
|
|
112
|
-
uint128 wTime =
|
|
103
|
+
uint128 wTime = poolData[pool].lastSlopeChangeAppliedAt;
|
|
113
104
|
uint128 currentWeekStart = WeekMath.getCurrentWeekStart();
|
|
114
105
|
|
|
115
106
|
// no state changes are expected
|
|
116
107
|
if (wTime >= currentWeekStart) return;
|
|
117
108
|
|
|
118
|
-
VeBalance memory currentVote =
|
|
109
|
+
VeBalance memory currentVote = poolData[pool].totalVote;
|
|
119
110
|
while (wTime < currentWeekStart) {
|
|
120
111
|
wTime += WEEK;
|
|
121
|
-
currentVote = currentVote.sub(
|
|
112
|
+
currentVote = currentVote.sub(poolData[pool].slopeChanges[wTime], wTime);
|
|
122
113
|
_setFinalPoolVoteForWeek(pool, wTime, currentVote.getValueAt(wTime));
|
|
123
114
|
}
|
|
124
115
|
|
|
125
|
-
|
|
116
|
+
_setNewVotePoolData(pool, currentVote, wTime);
|
|
126
117
|
}
|
|
127
118
|
|
|
128
119
|
/**
|
|
129
120
|
* @notice finalize the voting results of all pools, up to the current epoch
|
|
130
121
|
* @dev state changes expected:
|
|
131
|
-
- weekData,
|
|
122
|
+
- weekData, poolData is updated for all pools in allActivePools
|
|
132
123
|
- isEpochFinalized is set to true for all epochs since the last time until now
|
|
133
|
-
* @dev this function might take a lot of gas, but can be mitigated by calling
|
|
124
|
+
* @dev this function might take a lot of gas, but can be mitigated by calling applyPoolSlopeChanges
|
|
134
125
|
separately, hence reduce the number of states to be updated
|
|
135
126
|
*/
|
|
136
127
|
function finalizeEpoch() public {
|
|
137
|
-
uint256 length =
|
|
128
|
+
uint256 length = allActivePools.length();
|
|
138
129
|
for (uint256 i = 0; i < length; ++i) {
|
|
139
|
-
|
|
130
|
+
applyPoolSlopeChanges(allActivePools.at(i));
|
|
140
131
|
}
|
|
141
132
|
_setAllPastEpochsAsFinalized();
|
|
142
133
|
}
|
|
143
134
|
|
|
144
135
|
/**
|
|
145
136
|
* @notice broadcast the voting results of the current week to the chain with chainId. Can be
|
|
146
|
-
called by anyone
|
|
137
|
+
called by anyone. It's intentional to allow the same results to be broadcasted multiple
|
|
138
|
+
times. The receiver should be able to filter these duplicated messages
|
|
147
139
|
* @dev pre-condition: the epoch must have already been finalized by finalizeEpoch
|
|
148
140
|
* @dev state changes expected:
|
|
149
141
|
- the gaugeController receives the new pendle allocation
|
|
150
142
|
*/
|
|
151
143
|
function broadcastResults(uint64 chainId) external payable {
|
|
152
144
|
uint128 wTime = WeekMath.getCurrentWeekStart();
|
|
153
|
-
require(
|
|
145
|
+
require(weekData[wTime].isEpochFinalized, "epoch not finalized");
|
|
154
146
|
_broadcastResults(chainId, wTime, pendlePerSec);
|
|
155
147
|
}
|
|
156
148
|
|
|
@@ -163,11 +155,13 @@ contract PendleVotingControllerUpg is
|
|
|
163
155
|
* @dev pre-condition: pool must not have been added before
|
|
164
156
|
* @dev assumption: chainId is valid, pool does exist on the chain (guaranteed by gov)
|
|
165
157
|
* @dev state changes expected:
|
|
166
|
-
- add to
|
|
167
|
-
- set params in
|
|
158
|
+
- add to allActivePools & chainPools
|
|
159
|
+
- set params in poolData
|
|
168
160
|
*/
|
|
169
161
|
function addPool(uint64 chainId, address pool) external onlyGovernance {
|
|
170
|
-
require(!
|
|
162
|
+
require(!_isPoolActive(pool), "pool already added");
|
|
163
|
+
require(!allRemovedPools.contains(pool), "not allowed to add a removed pool");
|
|
164
|
+
|
|
171
165
|
_addPool(chainId, pool);
|
|
172
166
|
emit AddPool(chainId, pool);
|
|
173
167
|
}
|
|
@@ -177,14 +171,15 @@ contract PendleVotingControllerUpg is
|
|
|
177
171
|
* @dev pre-condition: pool must have been added before
|
|
178
172
|
* @dev state changes expected:
|
|
179
173
|
- update weekData (if any)
|
|
180
|
-
- remove from
|
|
181
|
-
- clear
|
|
174
|
+
- remove from allActivePools & chainPools
|
|
175
|
+
- clear data in poolData
|
|
182
176
|
*/
|
|
183
177
|
function removePool(address pool) external onlyGovernance {
|
|
184
|
-
require(
|
|
185
|
-
|
|
178
|
+
require(_isPoolActive(pool), "invalid pool");
|
|
179
|
+
|
|
180
|
+
uint64 chainId = poolData[pool].chainId;
|
|
186
181
|
|
|
187
|
-
|
|
182
|
+
applyPoolSlopeChanges(pool);
|
|
188
183
|
_removePool(pool);
|
|
189
184
|
|
|
190
185
|
emit RemovePool(chainId, pool);
|
|
@@ -222,7 +217,7 @@ contract PendleVotingControllerUpg is
|
|
|
222
217
|
|
|
223
218
|
/**
|
|
224
219
|
* @notice broadcast voting results of the timestamp to chainId
|
|
225
|
-
* @dev assumption: the epoch is already finalized,
|
|
220
|
+
* @dev assumption: the epoch is already finalized, lastSlopeChangeAppliedAt of all pools >= currentWeekTimestamp
|
|
226
221
|
* @dev state changes expected:
|
|
227
222
|
- the gaugeController receives the new pendle allocation
|
|
228
223
|
*/
|
|
@@ -260,51 +255,6 @@ contract PendleVotingControllerUpg is
|
|
|
260
255
|
emit BroadcastResults(chainId, wTime, totalPendlePerSec);
|
|
261
256
|
}
|
|
262
257
|
|
|
263
|
-
/**
|
|
264
|
-
* @notice remove the vote from the current pool
|
|
265
|
-
* @dev state changes expected:
|
|
266
|
-
- vote in poolInfo is cleared if the vote is still valid
|
|
267
|
-
- update UserData to remove the vote weight
|
|
268
|
-
- add a check-point if required
|
|
269
|
-
*/
|
|
270
|
-
function _unvote(
|
|
271
|
-
address user,
|
|
272
|
-
address pool,
|
|
273
|
-
bool doCreateCheckpoint
|
|
274
|
-
) internal {
|
|
275
|
-
VeBalance memory oldUVote = userData[user].voteForPools[pool].vote;
|
|
276
|
-
if (_isPoolVotable(pool) && _isVoteActive(oldUVote)) {
|
|
277
|
-
_subtractVotePoolInfo(pool, oldUVote);
|
|
278
|
-
}
|
|
279
|
-
_unsetVoteUserData(user, pool);
|
|
280
|
-
|
|
281
|
-
if (doCreateCheckpoint) {
|
|
282
|
-
_addUserPoolCheckpoint(user, pool, VeBalance(0, 0));
|
|
283
|
-
}
|
|
284
|
-
emit Unvote(user, pool, oldUVote);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* @notice remove the vote from the current pool
|
|
289
|
-
* @dev there must not be any current vote on this pool by the user
|
|
290
|
-
* @dev state changes expected:
|
|
291
|
-
- vote in poolInfo is added
|
|
292
|
-
- update UserData to set the new vote weight
|
|
293
|
-
- add a check-point
|
|
294
|
-
*/
|
|
295
|
-
function _vote(
|
|
296
|
-
address user,
|
|
297
|
-
address pool,
|
|
298
|
-
uint64 weight
|
|
299
|
-
) internal {
|
|
300
|
-
VeBalance memory votingPower = _getVotingPowerByWeight(user, weight);
|
|
301
|
-
_addVotePoolInfo(pool, votingPower);
|
|
302
|
-
_setVoteUserData(user, pool, weight, votingPower);
|
|
303
|
-
_addUserPoolCheckpoint(user, pool, votingPower);
|
|
304
|
-
|
|
305
|
-
emit Vote(user, pool, weight, votingPower);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
258
|
/**
|
|
309
259
|
* @notice return the corresponding voting power of an user given the weight. Basically his voting power
|
|
310
260
|
will be vePendle * weight / USER_VOTE_MAX_WEIGHT
|
|
@@ -314,6 +264,7 @@ contract PendleVotingControllerUpg is
|
|
|
314
264
|
internal
|
|
315
265
|
view
|
|
316
266
|
virtual
|
|
267
|
+
override
|
|
317
268
|
returns (VeBalance memory res)
|
|
318
269
|
{
|
|
319
270
|
uint128 amount;
|