@pendle/core-v2 6.4.4-swaphubtest → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/ExcessivelySafeCall.sol/ExcessivelySafeCall.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerUpg.sol/PendleGaugeControllerUpg.dbg.json +4 -0
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerUpg.sol/PendleGaugeControllerUpg.json +401 -0
- package/build/artifacts/contracts/LiquidityMining/PendleMerkleDistributor.sol/PendleMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol/PendleMultiTokenMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol/PendleMultiTokenMerkleDistributor.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/sPendle/StakedPendle.sol/StakedPendle.dbg.json +4 -0
- package/build/artifacts/contracts/LiquidityMining/sPendle/StakedPendle.sol/StakedPendle.json +733 -0
- package/build/artifacts/contracts/StPendle.sol/RoundDataLib.dbg.json +4 -0
- package/build/artifacts/contracts/StPendle.sol/RoundDataLib.json +10 -0
- package/build/artifacts/contracts/StPendle.sol/StPendle.dbg.json +4 -0
- package/build/artifacts/contracts/StPendle.sol/StPendle.json +228 -0
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.json +0 -51
- package/build/artifacts/contracts/core/Market/PendleMarketFactoryV7Upg.sol/PendleMarketFactoryV7Upg.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactoryV7Upg.sol/PendleMarketFactoryV7Upg.json +618 -0
- package/build/artifacts/contracts/core/Market/PendleMarketV7.sol/PendleMarketV7.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarketV7.sol/PendleMarketV7.json +1157 -0
- package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/SYUtils.sol/SYUtils.dbg.json +1 -1
- 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 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactoryUpg.sol/PendleYieldContractFactoryUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactoryUpg.sol/PendleYieldContractFactoryUpg.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 +2 -2
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeableV2.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeableV2.sol/BoringOwnableUpgradeableV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.json +3 -3
- package/build/artifacts/contracts/core/libraries/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/StringLib.sol/StringLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/PMath.sol/PMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/PMath.sol/PMath.json +2 -2
- package/build/artifacts/contracts/cross-chain/FixedPricePTAMM.sol/FixedPricePTAMM.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/FixedPricePTAMM.sol/FixedPricePTAMM.json +2 -2
- package/build/artifacts/contracts/cross-chain/factory/hub/PendlePTOFTAdapterFactory.sol/PendlePTOFTAdapterFactory.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/oftImpl/hub/OFTAdapterImpl.sol/OFTAdapterImpl.dbg.json +1 -1
- package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.json +2 -2
- package/build/artifacts/contracts/interfaces/IAddressProvider.sol/IAddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILPWrapper.sol/ILPWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroEndpoint.sol/ILayerZeroEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILayerZeroReceiver.sol/ILayerZeroReceiver.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IMarketSweed.sol/IMarketSweed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiqV3.sol/IPActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCallbackV3.sol/IPActionCallbackV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCrossChain.sol/IPActionCrossChain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionInfoStatic.sol/IPActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketCoreStatic.sol/IPActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSimple.sol/IPActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageV4.sol/IPActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTV3.sol/IPActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYTV3.sol/IPActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionVePendleStatic.sol/IPActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionAddRemoveLiqV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionMiscV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionStorageEvents.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapPTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapYTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPAllEventsV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBridgedPrincipalToken.sol/IPBridgedPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracle.sol/IPChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleEssential.sol/IPChainlinkOracleEssential.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleFactory.sol/IPChainlinkOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleWithQuote.sol/IPChainlinkOracleWithQuote.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPCommonPoolDeployHelperV2.sol/IPCommonPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPCommonSYFactory.sol/IPCommonSYFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPExchangeRateOracle.sol/IPExchangeRateOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPExchangeRateOracleApp.sol/IPExchangeRateOracleApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributorV2.sol/IPFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMM.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMMSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.json +0 -51
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.json +47 -12
- package/build/artifacts/contracts/interfaces/IPGovernanceProxy.sol/IPGovernanceProxy.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLPWrapperFactory.sol/IPLPWrapperFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitOrderType.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPLimitRouter.sol/IPLimitRouterCallback.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 +0 -19
- 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/IPMerkleDistributor.sol/IPMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMiniDiamond.sol/IPMiniDiamond.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMultiTokenMerkleDistributor.sol/IPMultiTokenMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPOffchainStorage.sol/IPOffchainStorage.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPOracleForSy.sol/IPOracleForSy.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPTOFTAdapterFactory.sol/IPPTOFTAdapterFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPYLpOracle.sol/IPPYLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPausingInterface.sol/IPPausingInterface.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPoolDeployHelperV2.sol/IPPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPriceFeed.sol/IPPriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPReflector.sol/IPReflector.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPStakedPendle.sol/IPStakedPendle.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPStakedPendle.sol/IPStakedPendle.json +351 -0
- package/build/artifacts/contracts/interfaces/IPTokenWithSupplyCap.sol/IPTokenWithSupplyCap.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.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/IPYieldTokenV2.sol/IPYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRedstonePriceFeed.sol/IRedstonePriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- 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/limit/LimitMathCore.sol/LimitMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/limit/LimitMathCore.sol/LimitMathCore.json +2 -2
- package/build/artifacts/contracts/limit/LimitRouterBase.sol/LimitRouterBase.dbg.json +1 -1
- package/build/artifacts/contracts/limit/PendleLimitRouter.sol/PendleLimitRouter.dbg.json +1 -1
- package/build/artifacts/contracts/limit/PendleLimitRouter.sol/PendleLimitRouter.json +2 -2
- package/build/artifacts/contracts/limit/helpers/NonceManager.sol/NonceManager.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/AutomateReady.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/IAutomate.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/IOpsProxyFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AutomateReady.sol/ITaskTreasuryUpgradable.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BalanceReader.sol/BalanceReader.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BalanceReader.sol/BalanceReader.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/BalanceReader.sol/ILegacyMarket.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/BalanceReader.sol/ILegacyMarket.json +30 -0
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BytesLib.sol/BytesLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/EmptyUUPS.sol/EmptyUUPS.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol/ExpiredLpPtRedeemer.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol/ExpiredLpPtRedeemer.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/LegacyNFTHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LegacyNFTHelper.sol/StarNFTV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LimitBackendHelperV2.sol/LimitBackendHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/LimitBackendHelperV2.sol/LimitBackendHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/MarketSweed.sol/MarketSweed.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketSweed.sol/MarketSweed.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleAPIFeeDepositor.sol/PendleAPIFeeDepositor.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleExchangeRateOracle.sol/PendleExchangeRateOracle.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleExchangeRateOracle.sol/PendleExchangeRateOracle.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleFeeSetter.sol/PendleFeeSetter.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleFeeSetter.sol/PendleFeeSetter.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleGovernanceProxy.sol/PendleGovernanceProxy.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapper.sol/PendleLPWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapper.sol/PendleLPWrapper.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapperFactory.sol/PendleLPWrapperFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapperFactory.sol/PendleLPWrapperFactory.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleMerkleDepositor.sol/PendleMerkleDepositor.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMerkleDepositor.sol/PendleMerkleDepositor.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallOwnerV1.sol/PendleMulticallOwnerV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallV1.sol/PendleMulticallV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallV2.sol/PendleMulticallV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleOffchainStorage.sol/PendleOffchainStorage.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleWstETHPriceFeed.sol/PendleWstETHPriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/SimulateHelper.sol/SimulateHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/SimulateHelper.sol/SimulateHelper.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/IPossibleSupplyCapInterface.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/SupplyCapReader.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonSYFactory.sol/PendleCommonSYFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/lib/MarketDeployLib.sol/MarketDeployLib.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/lib/MarketDeployLib.sol/MarketDeployLib.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol/SDKErrorsDirectory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/base/PendleCrossChainOracleBaseApp_Init.sol/PendleCrossChainOracleBaseApp_Init.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/exchangeRate/PendleExchangeRateOracleApp.sol/PendleExchangeRateOracleApp.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/exchangeRate/PendleExchangeRateOracleApp.sol/PendleExchangeRateOracleApp.json +2 -2
- package/build/artifacts/contracts/oracles/CrossChainOracle/exchangeRate/PendleExchangeRateOracleV2.sol/PendleExchangeRateOracleV2.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/libraries/ExchangeRateMsgCodec.sol/ExchangeRateMsgCodec.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/CrossChainOracle/libraries/ExchangeRateMsgCodec.sol/ExchangeRateMsgCodec.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol/PendleLpOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol/PendlePYLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol/PendlePYLpOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol/PendlePYOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol/PendlePYOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol/PendleChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol/PendleChainlinkOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringLpSeller.sol/BoringLpSeller.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/StatelessWrapper/PendleLinearDiscountOracleWrapper.sol/PendleLinearDiscountOracleWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/StatelessWrapper/PendleSparkLinearDiscountOracleFactoryWrapper.sol/PendleSparkLinearDiscountOracleFactoryWrapper.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/StatelessWrapper/PendleSparkLinearDiscountOracleFactoryWrapper.sol/PendleSparkLinearDiscountOracleFactoryWrapper.json +2 -2
- package/build/artifacts/contracts/oracles/internal/PendleBoringOneracle.sol/PendleBoringOneracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleBoringOneracle.sol/PendleBoringOneracle.json +2 -2
- package/build/artifacts/contracts/oracles/internal/PendleBoringSolvBTCOneracle.sol/PendleBoringSolvBTCOneracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleBoringSolvBTCOneracle.sol/PendleBoringSolvBTCOneracle.json +2 -2
- package/build/artifacts/contracts/oracles/internal/PendleLpLinearDiscountOracle.sol/LPExpiry.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleLpLinearDiscountOracle.sol/PendleLpLinearDiscountOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleLpLinearDiscountOracleFactory.sol/PendleLpLinearDiscountOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleRedStoneRateOracleAdapter.sol/PendleRedStoneRateOracleAdapter.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleRedStoneRateOracleAdapter.sol/PendleRedStoneRateOracleAdapter.json +2 -2
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PTExpiry.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PendleSparkLinearDiscountOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracleFactory.sol/PendleSparkLinearDiscountOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracleFactory.sol/PendleSparkLinearDiscountOracleFactory.json +2 -2
- package/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.json +2 -2
- package/build/artifacts/contracts/router/ActionCallbackV3.sol/ActionCallbackV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionCallbackV3.sol/ActionCallbackV3.json +2 -2
- package/build/artifacts/contracts/router/ActionCrossChain.sol/ActionCrossChain.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionCrossChain.sol/ActionCrossChain.json +2 -2
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.json +2 -2
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.json +2 -2
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.json +2 -2
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.json +2 -2
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.dbg.json +1 -1
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.json +2 -2
- package/build/artifacts/contracts/router/RouterStorage.sol/RouterStorage.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.json +2 -2
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxEstimateLib.sol/MarketApproxEstimateLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxEstimateLib.sol/MarketApproxEstimateLib.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/IOKXDexRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/OKXScaleHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/ParaswapScaleHelper.sol/IAugustusV6.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/ParaswapScaleHelper.sol/ParaswapScaleHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IKyberScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerUpg.sol +112 -0
- package/contracts/LiquidityMining/sPendle/StakedPendle.sol +129 -0
- package/contracts/StPendle.sol +121 -0
- package/contracts/core/Market/PendleGauge.sol +1 -76
- package/contracts/core/Market/{PendleMarketFactoryV6Upg.sol → PendleMarketFactoryV7Upg.sol} +3 -6
- package/contracts/core/Market/{PendleMarketV6.sol → PendleMarketV7.sol} +16 -16
- package/contracts/core/libraries/Errors.sol +1 -1
- package/contracts/core/libraries/math/PMath.sol +5 -0
- package/contracts/interfaces/IPGauge.sol +0 -6
- package/contracts/interfaces/IPGaugeController.sol +16 -3
- package/contracts/interfaces/IPMarket.sol +12 -0
- package/contracts/interfaces/IPStakedPendle.sol +69 -0
- package/contracts/offchain-helpers/BalanceReader.sol +11 -1
- package/contracts/offchain-helpers/MarketSweed.sol +46 -54
- package/contracts/offchain-helpers/PendleMerkleDepositor.sol +5 -6
- package/contracts/router/ActionCrossChain.sol +14 -18
- package/contracts/router/Reflector.sol +19 -2
- package/deployments/1-core.json +3 -2
- package/deployments/10-core.json +1 -1
- package/deployments/130-core.json +2 -1
- package/deployments/146-core.json +1 -1
- package/deployments/42161-core.json +1 -1
- package/deployments/5000-core.json +1 -1
- package/deployments/56-core.json +1 -1
- package/deployments/80094-core.json +1 -1
- package/deployments/8453-core.json +1 -1
- package/deployments/9745-core.json +4 -3
- package/deployments/999-core.json +6 -6
- package/package.json +2 -2
- package/typechain-types/ERC20Upgradeable.ts +426 -0
- package/typechain-types/IERC20MetadataUpgradeable.ts +339 -0
- package/typechain-types/IERC20Upgradeable.ts +300 -0
- package/typechain-types/ILegacyMarket.ts +93 -0
- package/typechain-types/IPGauge.ts +7 -81
- package/typechain-types/IPGaugeController.ts +91 -47
- package/typechain-types/IPMarket.ts +0 -19
- package/typechain-types/IPStakedPendle.ts +558 -0
- package/typechain-types/PendleGauge.ts +0 -63
- package/typechain-types/{PendleGaugeControllerBaseUpg.ts → PendleGaugeControllerUpg.ts} +82 -171
- package/typechain-types/{PendleMarketFactoryV6Upg.ts → PendleMarketFactoryV7Upg.ts} +5 -18
- package/typechain-types/{PendleMarketV6.ts → PendleMarketV7.ts} +10 -29
- package/typechain-types/StPendle.ts +362 -0
- package/typechain-types/StakedPendle.ts +1058 -0
- package/typechain-types/factories/ActionAddRemoveLiqV3__factory.ts +1 -1
- package/typechain-types/factories/ActionCallbackV3__factory.ts +1 -1
- package/typechain-types/factories/ActionCrossChain__factory.ts +1 -1
- package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMiscV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSimple__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageV4__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/BalanceReader__factory.ts +1 -1
- package/typechain-types/factories/BoringPYUsdChainlinkAssetOracle__factory.ts +1 -1
- package/typechain-types/factories/BoringPYUsdChainlinkSYOracle__factory.ts +1 -1
- package/typechain-types/factories/ERC20Upgradeable__factory.ts +347 -0
- package/typechain-types/factories/Errors__factory.ts +2 -2
- package/typechain-types/factories/ExchangeRateMsgCodec__factory.ts +1 -1
- package/typechain-types/factories/ExpiredLpPtRedeemer__factory.ts +1 -1
- package/typechain-types/factories/FixedPricePTAMM__factory.ts +1 -1
- package/typechain-types/factories/IERC20MetadataUpgradeable__factory.ts +252 -0
- package/typechain-types/factories/{IPGaugeControllerMainchain__factory.ts → IERC20Upgradeable__factory.ts} +90 -83
- package/typechain-types/factories/ILegacyMarket__factory.ts +42 -0
- package/typechain-types/factories/IPGaugeController__factory.ts +47 -12
- package/typechain-types/factories/IPGauge__factory.ts +0 -51
- package/typechain-types/factories/IPMarket__factory.ts +0 -19
- package/typechain-types/factories/IPStakedPendle__factory.ts +366 -0
- package/typechain-types/factories/LimitBackendHelperV2__factory.ts +1 -1
- package/typechain-types/factories/MarketSweed__factory.ts +1 -1
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleBoringOneracle__factory.ts +1 -1
- package/typechain-types/factories/PendleBoringSolvBTCOneracle__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkOracleFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkOracleWithQuote__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleCommonPoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendleExchangeRateOracleApp__factory.ts +1 -1
- package/typechain-types/factories/PendleExchangeRateOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributorV2__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeSetter__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerUpg__factory.ts +463 -0
- package/typechain-types/factories/PendleGauge__factory.ts +0 -51
- package/typechain-types/factories/PendleLPWrapperFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleLPWrapper__factory.ts +1 -1
- package/typechain-types/factories/PendleLimitRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketFactoryV7Upg__factory.ts +710 -0
- package/typechain-types/factories/PendleMarketV7__factory.ts +1233 -0
- package/typechain-types/factories/PendleMerkleDepositor__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMultiTokenMerkleDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendlePYLpOracle__factory.ts +1 -1
- package/typechain-types/factories/PendlePoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendlePoolDeployHelper__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendleRedStoneRateOracleAdapter__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterV4__factory.ts +1 -1
- package/typechain-types/factories/PendleSparkLinearDiscountOracleFactoryWrapper__factory.ts +1 -1
- package/typechain-types/factories/PendleSparkLinearDiscountOracleFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldContractFactoryUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/Reflector__factory.ts +1 -1
- package/typechain-types/factories/SimulateHelper__factory.ts +1 -1
- package/typechain-types/factories/StPendle__factory.ts +260 -0
- package/typechain-types/factories/StakedPendle__factory.ts +785 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +69 -132
- package/typechain-types/index.ts +20 -32
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +0 -4
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +0 -451
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +0 -557
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +0 -547
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +0 -4
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +0 -1311
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +0 -4
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +0 -764
- package/build/artifacts/contracts/core/Market/PendleMarketFactoryV6Upg.sol/PendleMarketFactoryV6Upg.dbg.json +0 -4
- package/build/artifacts/contracts/core/Market/PendleMarketFactoryV6Upg.sol/PendleMarketFactoryV6Upg.json +0 -636
- package/build/artifacts/contracts/core/Market/PendleMarketV6.sol/PendleMarketV6.dbg.json +0 -4
- package/build/artifacts/contracts/core/Market/PendleMarketV6.sol/PendleMarketV6.json +0 -1181
- package/build/artifacts/contracts/cross-chain/swap-hub/DepositBox.sol/DepositBox.dbg.json +0 -4
- package/build/artifacts/contracts/cross-chain/swap-hub/DepositBox.sol/DepositBox.json +0 -170
- package/build/artifacts/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol/PendleCrossChainSwapHub.dbg.json +0 -4
- package/build/artifacts/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol/PendleCrossChainSwapHub.json +0 -1214
- package/build/artifacts/contracts/cross-chain/swap-hub/SwapHubBase.sol/SwapHubBase.dbg.json +0 -4
- package/build/artifacts/contracts/cross-chain/swap-hub/SwapHubBase.sol/SwapHubBase.json +0 -1176
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +0 -4
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +0 -598
- package/build/artifacts/contracts/interfaces/IPCrossChainSwapHub.sol/IPCrossChainSwapHub.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPCrossChainSwapHub.sol/IPCrossChainSwapHub.json +0 -1026
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPDepositBox.sol/IPDepositBox.json +0 -124
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.json +0 -183
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +0 -380
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.json +0 -262
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +0 -164
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +0 -42
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +0 -36
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +0 -304
- package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +0 -301
- package/contracts/cross-chain/swap-hub/DepositBox.sol +0 -66
- package/contracts/cross-chain/swap-hub/PendleCrossChainSwapHub.sol +0 -178
- package/contracts/cross-chain/swap-hub/SwapHubBase.sol +0 -274
- package/contracts/deprecated/VeDistributor/PendleFeeDistributor.sol +0 -204
- package/contracts/interfaces/IPCrossChainSwapHub.sol +0 -147
- package/contracts/interfaces/IPDepositBox.sol +0 -22
- package/contracts/interfaces/IPGaugeControllerMainchain.sol +0 -8
- package/contracts/interfaces/IPVotingController.sol +0 -43
- package/contracts/offchain-helpers/Broadcaster.sol +0 -48
- package/typechain-types/Broadcaster.ts +0 -455
- package/typechain-types/DepositBox.ts +0 -260
- package/typechain-types/IPCrossChainSwapHub.ts +0 -882
- package/typechain-types/IPDepositBox.ts +0 -213
- package/typechain-types/IPGaugeControllerMainchain.ts +0 -319
- package/typechain-types/IPVotingController.ts +0 -534
- package/typechain-types/PendleCrossChainSwapHub.ts +0 -1119
- package/typechain-types/PendleFeeDistributor.ts +0 -746
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +0 -778
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +0 -770
- package/typechain-types/PendleVotingControllerUpg.ts +0 -1731
- package/typechain-types/SwapHubBase.ts +0 -1094
- package/typechain-types/VotingControllerStorageUpg.ts +0 -984
- package/typechain-types/factories/Broadcaster__factory.ts +0 -317
- package/typechain-types/factories/DepositBox__factory.ts +0 -222
- package/typechain-types/factories/IPCrossChainSwapHub__factory.ts +0 -1041
- package/typechain-types/factories/IPDepositBox__factory.ts +0 -136
- package/typechain-types/factories/IPVotingController__factory.ts +0 -395
- package/typechain-types/factories/PendleCrossChainSwapHub__factory.ts +0 -1287
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +0 -671
- package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +0 -470
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +0 -648
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +0 -638
- package/typechain-types/factories/PendleMarketFactoryV6Upg__factory.ts +0 -732
- package/typechain-types/factories/PendleMarketV6__factory.ts +0 -1261
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +0 -1391
- package/typechain-types/factories/SwapHubBase__factory.ts +0 -1188
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +0 -783
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity ^0.8.17;
|
|
3
|
-
|
|
4
|
-
import "../../core/libraries/math/PMath.sol";
|
|
5
|
-
import "../../interfaces/IPGaugeControllerMainchain.sol";
|
|
6
|
-
import "../../interfaces/IPVotingController.sol";
|
|
7
|
-
import "../CrossChainMsg/PendleMsgSenderAppUpg.sol";
|
|
8
|
-
import "../libraries/VeBalanceLib.sol";
|
|
9
|
-
import "./VotingControllerStorageUpg.sol";
|
|
10
|
-
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
Voting accounting:
|
|
14
|
-
- For gauge controller, it will consider each message from voting controller
|
|
15
|
-
as a pack of money to incentivize it during the very next WEEK (block.timestamp -> block.timestamp + WEEK)
|
|
16
|
-
- If the reward duration for the last pack of money has not ended, it will combine
|
|
17
|
-
the leftover reward with the current reward to distribute.
|
|
18
|
-
|
|
19
|
-
- In the very extreme case where no one broadcast the result of week x, and at week x+1,
|
|
20
|
-
the results for both are now broadcasted, then the WEEK of (block.timestamp -> WEEK)
|
|
21
|
-
will receive both of the reward pack
|
|
22
|
-
- Each pack of money will has it own id as timestamp, a gauge controller does not
|
|
23
|
-
receive a pack of money with the same id twice, this allow governance to rebroadcast
|
|
24
|
-
in case the last message was corrupted by LayerZero
|
|
25
|
-
|
|
26
|
-
Pros:
|
|
27
|
-
- If governance does not forget broadcasting the reward on the early of the week,
|
|
28
|
-
the mechanism works just the same as the epoch-based one
|
|
29
|
-
- If governance forget to broadcast the reward, the whole system still works normally,
|
|
30
|
-
the reward is still incentivized, but only approximately fair
|
|
31
|
-
Cons:
|
|
32
|
-
- Does not guarantee the reward will be distributed on epoch start and end
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
contract PendleVotingControllerUpg is PendleMsgSenderAppUpg, VotingControllerStorageUpg, UUPSUpgradeable {
|
|
36
|
-
using VeBalanceLib for VeBalance;
|
|
37
|
-
using PMath for uint256;
|
|
38
|
-
using PMath for int256;
|
|
39
|
-
using EnumerableMap for EnumerableMap.UintToAddressMap;
|
|
40
|
-
using EnumerableSet for EnumerableSet.AddressSet;
|
|
41
|
-
|
|
42
|
-
constructor(address _vePendle, address _pendleMsgSendEndpoint, uint256 initialApproxDestinationGas)
|
|
43
|
-
VotingControllerStorageUpg(_vePendle)
|
|
44
|
-
PendleMsgSenderAppUpg(_pendleMsgSendEndpoint, initialApproxDestinationGas) // constructor only set immutable
|
|
45
|
-
// variables
|
|
46
|
-
initializer
|
|
47
|
-
//solhint-disable-next-line
|
|
48
|
-
|
|
49
|
-
{}
|
|
50
|
-
|
|
51
|
-
function initialize(address _owner) external initializer {
|
|
52
|
-
__BoringOwnableV2_init(_owner);
|
|
53
|
-
deployedWTime = WeekMath.getCurrentWeekStart();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/*///////////////////////////////////////////////////////////////
|
|
57
|
-
FUNCTIONS CAN BE CALLED BY ANYONE
|
|
58
|
-
//////////////////////////////////////////////////////////////*/
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @notice updates a user's vote weights, also allowing user to divide their voting power
|
|
62
|
-
* across different pools
|
|
63
|
-
* @param pools pools to change vote weights, if not listed then existing weight won't change
|
|
64
|
-
* @param weights voting weight on each pool in `pools`, must be same length as `pools`
|
|
65
|
-
* @dev A user's max voting weights is equal to `USER_VOTE_MAX_WEIGHT` (1e18). If their total
|
|
66
|
-
* voted weights is less than such, then the excess weight is not counted. For such reason, a
|
|
67
|
-
* user's voting power will only be fully utilized if their total voted weight is exactly 1e18.
|
|
68
|
-
* @dev Reverts if, after all vote changes, the total voted weight is more than 1e18.
|
|
69
|
-
* @dev A removed pool can be included, but the new weight must be 0, otherwise will revert.
|
|
70
|
-
* @dev See {`VotingControllerStorageUpg - getUserData()`} for current user data.
|
|
71
|
-
*/
|
|
72
|
-
function vote(address[] calldata pools, uint64[] calldata weights) external {
|
|
73
|
-
address user = msg.sender;
|
|
74
|
-
|
|
75
|
-
if (pools.length != weights.length) revert Errors.ArrayLengthMismatch();
|
|
76
|
-
if (user != owner && vePendle.balanceOf(user) == 0) revert Errors.VCZeroVePendle(user);
|
|
77
|
-
|
|
78
|
-
LockedPosition memory userPosition = _getUserVePendlePosition(user);
|
|
79
|
-
|
|
80
|
-
for (uint256 i = 0; i < pools.length; ++i) {
|
|
81
|
-
if (_isPoolActive(pools[i])) applyPoolSlopeChanges(pools[i]);
|
|
82
|
-
VeBalance memory newVote = _modifyVoteWeight(user, pools[i], userPosition, weights[i]);
|
|
83
|
-
emit Vote(user, pools[i], weights[i], newVote);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
uint256 totalVotedWeight = userData[user].totalVotedWeight;
|
|
87
|
-
if (totalVotedWeight > VeBalanceLib.USER_VOTE_MAX_WEIGHT) {
|
|
88
|
-
revert Errors.VCExceededMaxWeight(totalVotedWeight, VeBalanceLib.USER_VOTE_MAX_WEIGHT);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @notice Process all the slopeChanges that haven't been processed & update these data into
|
|
94
|
-
* poolData
|
|
95
|
-
* @dev reverts if pool is not active
|
|
96
|
-
* @dev if pool is already up-to-date, the function will succeed without any state updates
|
|
97
|
-
*/
|
|
98
|
-
function applyPoolSlopeChanges(address pool) public {
|
|
99
|
-
if (!_isPoolActive(pool)) revert Errors.VCInactivePool(pool);
|
|
100
|
-
|
|
101
|
-
uint128 wTime = poolData[pool].lastSlopeChangeAppliedAt;
|
|
102
|
-
uint128 currentWeekStart = WeekMath.getCurrentWeekStart();
|
|
103
|
-
|
|
104
|
-
// no state changes are expected
|
|
105
|
-
if (wTime >= currentWeekStart) return;
|
|
106
|
-
|
|
107
|
-
VeBalance memory currentVote = poolData[pool].totalVote;
|
|
108
|
-
while (wTime < currentWeekStart) {
|
|
109
|
-
wTime += WEEK;
|
|
110
|
-
currentVote = currentVote.sub(poolData[pool].slopeChanges[wTime], wTime);
|
|
111
|
-
_setFinalPoolVoteForWeek(pool, wTime, currentVote.getValueAt(wTime));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
_setNewVotePoolData(pool, currentVote, wTime);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* @notice finalize the voting results of all pools, up to the current epoch
|
|
119
|
-
* @dev See `applyPoolSlopeChanges()` for more details
|
|
120
|
-
* @dev This function might be gas-costly if there are a lot of active pools, but this can be
|
|
121
|
-
* mitigated by calling `applyPoolSlopeChanges()` for each pool separately, spreading the gas
|
|
122
|
-
* cost across multiple txs (although the total gas cost will be higher).
|
|
123
|
-
* This is because `applyPoolSlopeChanges()` will not update anything if already up-to-date.
|
|
124
|
-
*/
|
|
125
|
-
function finalizeEpoch() public {
|
|
126
|
-
uint256 length = allActivePools.length();
|
|
127
|
-
for (uint256 i = 0; i < length; ++i) {
|
|
128
|
-
applyPoolSlopeChanges(allActivePools.at(i));
|
|
129
|
-
}
|
|
130
|
-
_setAllPastEpochsAsFinalized();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @notice broadcast the voting results of the current week to the chain with chainId. Can be
|
|
135
|
-
* called by anyone.
|
|
136
|
-
* @dev It's intentional to allow the same results to be broadcasted multiple
|
|
137
|
-
* times. The receiver should be able to filter these duplicated messages
|
|
138
|
-
* @dev The epoch must have already been finalized by `finalizeEpoch()`, otherwise will revert.
|
|
139
|
-
*/
|
|
140
|
-
function broadcastResults(uint64 chainId) external payable refundUnusedEth {
|
|
141
|
-
uint128 wTime = WeekMath.getCurrentWeekStart();
|
|
142
|
-
if (!weekData[wTime].isEpochFinalized) revert Errors.VCEpochNotFinalized(wTime);
|
|
143
|
-
_broadcastResults(chainId, wTime, pendlePerSec, globalCap);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/*///////////////////////////////////////////////////////////////
|
|
147
|
-
GOVERNANCE-ONLY FUNCTIONS
|
|
148
|
-
//////////////////////////////////////////////////////////////*/
|
|
149
|
-
|
|
150
|
-
modifier onlyAddPoolHelperAndOwner() {
|
|
151
|
-
require(msg.sender == addPoolHelper || msg.sender == owner, "add pool not allowed");
|
|
152
|
-
_;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
modifier onlyRemovePoolHelperAndOwner() {
|
|
156
|
-
require(msg.sender == removePoolHelper || msg.sender == owner, "remove pool not allowed");
|
|
157
|
-
_;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @notice add a pool to allow users to vote. Can only be done by [governance/owner helper]
|
|
162
|
-
* @custom:gov NOTE TO GOV:
|
|
163
|
-
* - Previous week's results should have been broadcasted prior to calling this function.
|
|
164
|
-
* - `pool` must not have been added before (even if has been removed).
|
|
165
|
-
* - `chainId` must be valid.
|
|
166
|
-
*/
|
|
167
|
-
function addMultiPools(uint64[] memory chainIds, address[] memory pools) external onlyAddPoolHelperAndOwner {
|
|
168
|
-
if (chainIds.length != pools.length) revert Errors.ArrayLengthMismatch();
|
|
169
|
-
for (uint256 i = 0; i < chainIds.length; ++i) {
|
|
170
|
-
(uint64 chainId, address pool) = (chainIds[i], pools[i]);
|
|
171
|
-
if (_isPoolActive(pool)) revert Errors.VCPoolAlreadyActive(pool);
|
|
172
|
-
if (allRemovedPools.contains(pool)) revert Errors.VCPoolAlreadyAddAndRemoved(pool);
|
|
173
|
-
|
|
174
|
-
_addPool(chainId, pool);
|
|
175
|
-
emit AddPool(chainId, pool);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* @notice remove a pool from voting. Can only be done by governance
|
|
181
|
-
* @custom:gov NOTE TO GOV:
|
|
182
|
-
* - Previous week's results should have been broadcasted prior to calling this function.
|
|
183
|
-
* - `pool` must be currently active.
|
|
184
|
-
*/
|
|
185
|
-
|
|
186
|
-
function removeMultiPools(address[] calldata pools) external onlyRemovePoolHelperAndOwner {
|
|
187
|
-
for (uint256 i = 0; i < pools.length; ++i) {
|
|
188
|
-
address pool = pools[i];
|
|
189
|
-
if (!_isPoolActive(pool)) revert Errors.VCInactivePool(pool);
|
|
190
|
-
|
|
191
|
-
uint64 chainId = poolData[pool].chainId;
|
|
192
|
-
|
|
193
|
-
applyPoolSlopeChanges(pool);
|
|
194
|
-
_removePool(pool);
|
|
195
|
-
|
|
196
|
-
emit RemovePool(chainId, pool);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @notice set the cap for a pool, or remove cap (using global cap) if `cap` is 0
|
|
202
|
-
*/
|
|
203
|
-
function setPoolCaps(address[] calldata pools, uint256[] calldata caps) external onlyAddPoolHelperAndOwner {
|
|
204
|
-
if (pools.length != caps.length) revert Errors.ArrayLengthMismatch();
|
|
205
|
-
for (uint256 i = 0; i < pools.length; ++i) {
|
|
206
|
-
_setPoolCap(pools[i], caps[i]);
|
|
207
|
-
}
|
|
208
|
-
emit SetPoolCaps(pools, caps);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function setGlobalCap(uint256 cap) external onlyOwner {
|
|
212
|
-
_setGlobalCap(cap);
|
|
213
|
-
emit SetGlobalCap(cap);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @notice use the gov-privilege to force broadcast a message in case there are issues with LayerZero
|
|
218
|
-
* @custom:gov NOTE TO GOV: gov should always call finalizeEpoch beforehand
|
|
219
|
-
*/
|
|
220
|
-
function forceBroadcastResults(uint64 chainId, uint128 wTime, uint128 forcedPendlePerSec)
|
|
221
|
-
external
|
|
222
|
-
payable
|
|
223
|
-
onlyOwner
|
|
224
|
-
refundUnusedEth
|
|
225
|
-
{
|
|
226
|
-
_broadcastResults(chainId, wTime, forcedPendlePerSec, globalCap);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* @notice sets new pendlePerSec
|
|
231
|
-
* @dev no zero checks because gov may want to stop liquidity mining
|
|
232
|
-
* @custom:gov NOTE TO GOV: Should be done mid-week, well before the next broadcast to avoid
|
|
233
|
-
* race condition
|
|
234
|
-
*/
|
|
235
|
-
function setPendlePerSec(uint128 newPendlePerSec) external onlyOwner {
|
|
236
|
-
pendlePerSec = newPendlePerSec;
|
|
237
|
-
emit SetPendlePerSec(newPendlePerSec);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function getBroadcastResultFee(uint64 chainId) external view returns (uint256) {
|
|
241
|
-
if (chainId == block.chainid) return 0; // Mainchain broadcast
|
|
242
|
-
|
|
243
|
-
uint256 length = activeChainPools[chainId].length();
|
|
244
|
-
if (length == 0) return 0;
|
|
245
|
-
|
|
246
|
-
address[] memory pools = new address[](length);
|
|
247
|
-
uint256[] memory totalPendleAmounts = new uint256[](length);
|
|
248
|
-
|
|
249
|
-
return _getSendMessageFee(chainId, abi.encode(uint128(0), pools, totalPendleAmounts));
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/*///////////////////////////////////////////////////////////////
|
|
253
|
-
INTERNAL FUNCTIONS
|
|
254
|
-
//////////////////////////////////////////////////////////////*/
|
|
255
|
-
|
|
256
|
-
/// @notice broadcast voting results of the timestamp to chainId
|
|
257
|
-
function _broadcastResults(uint64 chainId, uint128 wTime, uint128 totalPendlePerSec, uint256 currentGlobalCap)
|
|
258
|
-
internal
|
|
259
|
-
{
|
|
260
|
-
uint256 totalVotes = weekData[wTime].totalVotes;
|
|
261
|
-
if (totalVotes == 0) return;
|
|
262
|
-
|
|
263
|
-
uint256 length = activeChainPools[chainId].length();
|
|
264
|
-
if (length == 0) return;
|
|
265
|
-
|
|
266
|
-
address[] memory pools = activeChainPools[chainId].values();
|
|
267
|
-
uint256[] memory totalPendleAmounts = new uint256[](length);
|
|
268
|
-
|
|
269
|
-
for (uint256 i = 0; i < length; ++i) {
|
|
270
|
-
uint256 poolVotes = weekData[wTime].poolVotes[pools[i]];
|
|
271
|
-
uint256 cappedRate = PMath.min(_getPoolCapOpt(pools[i], currentGlobalCap), poolVotes.divDown(totalVotes));
|
|
272
|
-
totalPendleAmounts[i] = (uint256(totalPendlePerSec) * WEEK).mulDown(cappedRate);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
if (chainId == block.chainid) {
|
|
276
|
-
address gaugeController = destinationContracts.get(chainId);
|
|
277
|
-
IPGaugeControllerMainchain(gaugeController).updateVotingResults(wTime, pools, totalPendleAmounts);
|
|
278
|
-
} else {
|
|
279
|
-
_sendMessage(chainId, abi.encode(wTime, pools, totalPendleAmounts));
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
emit BroadcastResults(chainId, wTime, totalPendlePerSec);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function _getUserVePendlePosition(address user) internal view returns (LockedPosition memory userPosition) {
|
|
286
|
-
if (user == owner) {
|
|
287
|
-
(userPosition.amount, userPosition.expiry) =
|
|
288
|
-
(GOVERNANCE_PENDLE_VOTE, WeekMath.getWeekStartTimestamp(uint128(block.timestamp) + MAX_LOCK_TIME));
|
|
289
|
-
} else {
|
|
290
|
-
(userPosition.amount, userPosition.expiry) = vePendle.positionData(user);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function setAddPoolHelper(address _helper) public onlyOwner {
|
|
295
|
-
addPoolHelper = _helper;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function setRemovePoolHelper(address _helper) public onlyOwner {
|
|
299
|
-
removePoolHelper = _helper;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
//solhint-disable-next-line
|
|
303
|
-
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
304
|
-
}
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity ^0.8.17;
|
|
3
|
-
|
|
4
|
-
import "../../interfaces/IPVeToken.sol";
|
|
5
|
-
import "../../interfaces/IPVotingController.sol";
|
|
6
|
-
|
|
7
|
-
import "../libraries/VeBalanceLib.sol";
|
|
8
|
-
import "../libraries/VeHistoryLib.sol";
|
|
9
|
-
import "../libraries/WeekMath.sol";
|
|
10
|
-
|
|
11
|
-
import "../../core/libraries/Errors.sol";
|
|
12
|
-
import "../../core/libraries/MiniHelpers.sol";
|
|
13
|
-
|
|
14
|
-
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
15
|
-
|
|
16
|
-
abstract contract VotingControllerStorageUpg is IPVotingController {
|
|
17
|
-
using VeBalanceLib for VeBalance;
|
|
18
|
-
using VeBalanceLib for LockedPosition;
|
|
19
|
-
using EnumerableSet for EnumerableSet.AddressSet;
|
|
20
|
-
using Checkpoints for Checkpoints.History;
|
|
21
|
-
using WeekMath for uint128;
|
|
22
|
-
|
|
23
|
-
struct PoolData {
|
|
24
|
-
uint64 chainId;
|
|
25
|
-
uint128 lastSlopeChangeAppliedAt;
|
|
26
|
-
VeBalance totalVote;
|
|
27
|
-
// wTime => slopeChange value
|
|
28
|
-
mapping(uint128 => uint128) slopeChanges;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
struct UserPoolData {
|
|
32
|
-
uint64 weight;
|
|
33
|
-
VeBalance vote;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
struct UserData {
|
|
37
|
-
uint64 totalVotedWeight;
|
|
38
|
-
mapping(address => UserPoolData) voteForPools;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
struct WeekData {
|
|
42
|
-
bool isEpochFinalized;
|
|
43
|
-
uint128 totalVotes;
|
|
44
|
-
mapping(address => uint128) poolVotes;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
uint128 public constant MAX_LOCK_TIME = 104 weeks;
|
|
48
|
-
uint128 public constant WEEK = 1 weeks;
|
|
49
|
-
uint128 public constant GOVERNANCE_PENDLE_VOTE = 10 * (10 ** 6) * (10 ** 18); // 10 mils of PENDLE
|
|
50
|
-
|
|
51
|
-
IPVeToken public immutable vePendle;
|
|
52
|
-
|
|
53
|
-
uint128 public deployedWTime;
|
|
54
|
-
|
|
55
|
-
uint128 public pendlePerSec;
|
|
56
|
-
|
|
57
|
-
EnumerableSet.AddressSet internal allActivePools;
|
|
58
|
-
|
|
59
|
-
EnumerableSet.AddressSet internal allRemovedPools;
|
|
60
|
-
|
|
61
|
-
// [chainId] => [pool]
|
|
62
|
-
mapping(uint64 => EnumerableSet.AddressSet) internal activeChainPools;
|
|
63
|
-
|
|
64
|
-
// [poolAddress] -> PoolData
|
|
65
|
-
mapping(address => PoolData) internal poolData;
|
|
66
|
-
|
|
67
|
-
// [wTime] => WeekData
|
|
68
|
-
mapping(uint128 => WeekData) internal weekData;
|
|
69
|
-
|
|
70
|
-
// user voting data
|
|
71
|
-
mapping(address => UserData) internal userData;
|
|
72
|
-
|
|
73
|
-
// [user][pool] => checkpoint
|
|
74
|
-
mapping(address => mapping(address => Checkpoints.History)) internal __dep_userPoolHistory;
|
|
75
|
-
|
|
76
|
-
address public addPoolHelper;
|
|
77
|
-
address public removePoolHelper;
|
|
78
|
-
|
|
79
|
-
// [pool] => cap
|
|
80
|
-
mapping(address => uint256) public poolCaps;
|
|
81
|
-
|
|
82
|
-
uint256 public globalCap;
|
|
83
|
-
|
|
84
|
-
uint256[96] private __gap;
|
|
85
|
-
|
|
86
|
-
constructor(address _vePendle) {
|
|
87
|
-
vePendle = IPVeToken(_vePendle);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/*///////////////////////////////////////////////////////////////
|
|
91
|
-
VIEW FUNCTIONS
|
|
92
|
-
//////////////////////////////////////////////////////////////*/
|
|
93
|
-
|
|
94
|
-
function getPoolCap(address pool) public view returns (uint256) {
|
|
95
|
-
uint256 cap = poolCaps[pool];
|
|
96
|
-
return (cap != 0) ? cap : globalCap;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function getPoolTotalVoteAt(address pool, uint128 wTime) public view returns (uint128) {
|
|
100
|
-
return weekData[wTime].poolVotes[pool];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/// @notice deprecated, only kept for compatibility reasons
|
|
104
|
-
function getUserPoolHistoryLength(address user, address pool) external view returns (uint256) {
|
|
105
|
-
return __dep_userPoolHistory[user][pool].length();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/// @notice deprecated, only kept for compatibility reasons
|
|
109
|
-
function getUserPoolHistoryAt(address user, address pool, uint256 index) external view returns (Checkpoint memory) {
|
|
110
|
-
return __dep_userPoolHistory[user][pool].get(index);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function getPoolData(address pool, uint128[] calldata wTimes)
|
|
114
|
-
public
|
|
115
|
-
view
|
|
116
|
-
returns (
|
|
117
|
-
uint64 chainId,
|
|
118
|
-
uint128 lastSlopeChangeAppliedAt,
|
|
119
|
-
VeBalance memory totalVote,
|
|
120
|
-
uint128[] memory slopeChanges
|
|
121
|
-
)
|
|
122
|
-
{
|
|
123
|
-
PoolData storage data = poolData[pool];
|
|
124
|
-
(chainId, lastSlopeChangeAppliedAt, totalVote) = (data.chainId, data.lastSlopeChangeAppliedAt, data.totalVote);
|
|
125
|
-
|
|
126
|
-
slopeChanges = new uint128[](wTimes.length);
|
|
127
|
-
for (uint256 i = 0; i < wTimes.length; ++i) {
|
|
128
|
-
if (!wTimes[i].isValidWTime()) revert Errors.InvalidWTime(wTimes[i]);
|
|
129
|
-
slopeChanges[i] = data.slopeChanges[wTimes[i]];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function getUserData(address user, address[] calldata pools)
|
|
134
|
-
public
|
|
135
|
-
view
|
|
136
|
-
returns (uint64 totalVotedWeight, UserPoolData[] memory voteForPools)
|
|
137
|
-
{
|
|
138
|
-
UserData storage data = userData[user];
|
|
139
|
-
|
|
140
|
-
totalVotedWeight = data.totalVotedWeight;
|
|
141
|
-
|
|
142
|
-
voteForPools = new UserPoolData[](pools.length);
|
|
143
|
-
for (uint256 i = 0; i < pools.length; ++i) {
|
|
144
|
-
voteForPools[i] = data.voteForPools[pools[i]];
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function getWeekData(uint128 wTime, address[] calldata pools)
|
|
149
|
-
public
|
|
150
|
-
view
|
|
151
|
-
returns (bool isEpochFinalized, uint128 totalVotes, uint128[] memory poolVotes)
|
|
152
|
-
{
|
|
153
|
-
if (!wTime.isValidWTime()) revert Errors.InvalidWTime(wTime);
|
|
154
|
-
|
|
155
|
-
WeekData storage data = weekData[wTime];
|
|
156
|
-
|
|
157
|
-
(isEpochFinalized, totalVotes) = (data.isEpochFinalized, data.totalVotes);
|
|
158
|
-
|
|
159
|
-
poolVotes = new uint128[](pools.length);
|
|
160
|
-
for (uint256 i = 0; i < pools.length; ++i) {
|
|
161
|
-
poolVotes[i] = data.poolVotes[pools[i]];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function getAllActivePools() external view returns (address[] memory) {
|
|
166
|
-
return allActivePools.values();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function getAllRemovedPools(uint256 start, uint256 end)
|
|
170
|
-
external
|
|
171
|
-
view
|
|
172
|
-
returns (uint256 lengthOfRemovedPools, address[] memory arr)
|
|
173
|
-
{
|
|
174
|
-
lengthOfRemovedPools = allRemovedPools.length();
|
|
175
|
-
|
|
176
|
-
if (end >= lengthOfRemovedPools) revert Errors.ArrayOutOfBounds();
|
|
177
|
-
|
|
178
|
-
arr = new address[](end - start + 1);
|
|
179
|
-
for (uint256 i = start; i <= end; ++i) {
|
|
180
|
-
arr[i - start] = allRemovedPools.at(i);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function getActiveChainPools(uint64 chainId) external view returns (address[] memory) {
|
|
185
|
-
return activeChainPools[chainId].values();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function getUserPoolVote(address user, address pool) external view returns (UserPoolData memory) {
|
|
189
|
-
return userData[user].voteForPools[pool];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/*///////////////////////////////////////////////////////////////
|
|
193
|
-
INTERNAL DATA MANIPULATION FUNCTIONS
|
|
194
|
-
//////////////////////////////////////////////////////////////*/
|
|
195
|
-
|
|
196
|
-
function _addPool(uint64 chainId, address pool) internal {
|
|
197
|
-
if (!activeChainPools[chainId].add(pool)) assert(false);
|
|
198
|
-
if (!allActivePools.add(pool)) assert(false);
|
|
199
|
-
|
|
200
|
-
poolData[pool].chainId = chainId;
|
|
201
|
-
poolData[pool].lastSlopeChangeAppliedAt = WeekMath.getCurrentWeekStart();
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function _removePool(address pool) internal {
|
|
205
|
-
uint64 chainId = poolData[pool].chainId;
|
|
206
|
-
if (!activeChainPools[chainId].remove(pool)) assert(false);
|
|
207
|
-
if (!allActivePools.remove(pool)) assert(false);
|
|
208
|
-
if (!allRemovedPools.add(pool)) assert(false);
|
|
209
|
-
|
|
210
|
-
delete poolData[pool];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function _setFinalPoolVoteForWeek(address pool, uint128 wTime, uint128 vote) internal {
|
|
214
|
-
weekData[wTime].totalVotes += vote;
|
|
215
|
-
weekData[wTime].poolVotes[pool] = vote;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function _setNewVotePoolData(address pool, VeBalance memory vote, uint128 wTime) internal {
|
|
219
|
-
poolData[pool].totalVote = vote;
|
|
220
|
-
poolData[pool].lastSlopeChangeAppliedAt = wTime;
|
|
221
|
-
emit PoolVoteChange(pool, vote);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @notice modifies `user`'s vote weight on `pool`
|
|
226
|
-
* @dev works by simply removing the old vote position, then adds in a fresh vote
|
|
227
|
-
*/
|
|
228
|
-
function _modifyVoteWeight(address user, address pool, LockedPosition memory userPosition, uint64 weight)
|
|
229
|
-
internal
|
|
230
|
-
returns (VeBalance memory newVote)
|
|
231
|
-
{
|
|
232
|
-
UserData storage uData = userData[user];
|
|
233
|
-
PoolData storage pData = poolData[pool];
|
|
234
|
-
|
|
235
|
-
VeBalance memory oldVote = uData.voteForPools[pool].vote;
|
|
236
|
-
|
|
237
|
-
// REMOVE OLD VOTE
|
|
238
|
-
if (oldVote.bias != 0) {
|
|
239
|
-
if (_isPoolActive(pool) && _isVoteActive(oldVote)) {
|
|
240
|
-
pData.totalVote = pData.totalVote.sub(oldVote);
|
|
241
|
-
pData.slopeChanges[oldVote.getExpiry()] -= oldVote.slope;
|
|
242
|
-
}
|
|
243
|
-
uData.totalVotedWeight -= uData.voteForPools[pool].weight;
|
|
244
|
-
delete uData.voteForPools[pool];
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// ADD NEW VOTE
|
|
248
|
-
if (weight != 0) {
|
|
249
|
-
if (!_isPoolActive(pool)) revert Errors.VCInactivePool(pool);
|
|
250
|
-
|
|
251
|
-
newVote = userPosition.convertToVeBalance(weight);
|
|
252
|
-
|
|
253
|
-
pData.totalVote = pData.totalVote.add(newVote);
|
|
254
|
-
pData.slopeChanges[newVote.getExpiry()] += newVote.slope;
|
|
255
|
-
|
|
256
|
-
uData.voteForPools[pool] = UserPoolData(weight, newVote);
|
|
257
|
-
uData.totalVotedWeight += weight;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
emit PoolVoteChange(pool, pData.totalVote);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function _setAllPastEpochsAsFinalized() internal {
|
|
264
|
-
uint128 wTime = WeekMath.getCurrentWeekStart();
|
|
265
|
-
while (wTime > deployedWTime && weekData[wTime].isEpochFinalized == false) {
|
|
266
|
-
weekData[wTime].isEpochFinalized = true;
|
|
267
|
-
wTime -= WEEK;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function _isPoolActive(address pool) internal view returns (bool) {
|
|
272
|
-
return allActivePools.contains(pool);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/// @notice check if a vote still counts by checking if the vote is not (x,0) (in case the
|
|
276
|
-
/// weight of the vote is too small) & the expiry is after the current time
|
|
277
|
-
function _isVoteActive(VeBalance memory vote) internal view returns (bool) {
|
|
278
|
-
return vote.slope != 0 && !MiniHelpers.isCurrentlyExpired(vote.getExpiry());
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function _setPoolCap(address pool, uint256 cap) internal {
|
|
282
|
-
_validateCap(cap);
|
|
283
|
-
poolCaps[pool] = cap;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function _setGlobalCap(uint256 cap) internal {
|
|
287
|
-
_validateCap(cap);
|
|
288
|
-
globalCap = cap;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function _getPoolCapOpt(address _pool, uint256 _globalCap) internal view returns (uint256) {
|
|
292
|
-
uint256 cap = poolCaps[_pool];
|
|
293
|
-
return (cap != 0) ? cap : _globalCap;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function _validateCap(uint256 cap) internal pure {
|
|
297
|
-
if (cap > PMath.ONE) {
|
|
298
|
-
revert Errors.VCInvalidCap(cap);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity ^0.8.30;
|
|
3
|
-
|
|
4
|
-
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
5
|
-
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
6
|
-
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
7
|
-
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
8
|
-
import {TokenHelper} from "../../core/libraries/TokenHelper.sol";
|
|
9
|
-
import {ApprovedCall, IPDepositBox} from "../../interfaces/IPDepositBox.sol";
|
|
10
|
-
|
|
11
|
-
contract DepositBox is IPDepositBox, TokenHelper, Initializable {
|
|
12
|
-
using Address for address;
|
|
13
|
-
using SafeERC20 for IERC20;
|
|
14
|
-
|
|
15
|
-
address public immutable MANAGER;
|
|
16
|
-
address public OWNER;
|
|
17
|
-
uint32 public BOX_ID;
|
|
18
|
-
|
|
19
|
-
constructor(address manager_) {
|
|
20
|
-
_disableInitializers();
|
|
21
|
-
MANAGER = manager_;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
modifier onlyManager() {
|
|
25
|
-
require(msg.sender == MANAGER, "DepositBox: caller is not manager");
|
|
26
|
-
_;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function initialize(address owner_, uint32 boxId_) external initializer {
|
|
30
|
-
OWNER = owner_;
|
|
31
|
-
BOX_ID = boxId_;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function withdrawTo(address to, address token, uint256 amount) external onlyManager {
|
|
35
|
-
_transferOut(token, to, amount);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function approveAndCall(ApprovedCall memory call, address nativeRefund)
|
|
39
|
-
external
|
|
40
|
-
payable
|
|
41
|
-
onlyManager
|
|
42
|
-
returns (bytes memory result)
|
|
43
|
-
{
|
|
44
|
-
uint256 nativeAmount = call.token == NATIVE ? call.amount : 0;
|
|
45
|
-
uint256 nativeFee = msg.value;
|
|
46
|
-
|
|
47
|
-
uint256 initialNativeBalance = _selfBalance(NATIVE) - nativeAmount - nativeFee;
|
|
48
|
-
|
|
49
|
-
_approveForExtRouter(call.token, call.approveTo, call.amount);
|
|
50
|
-
result = call.callTo.functionCallWithValue(call.data, nativeAmount + nativeFee);
|
|
51
|
-
_approveForExtRouter(call.token, call.approveTo, 0);
|
|
52
|
-
|
|
53
|
-
uint256 finalNativeBalance = _selfBalance(NATIVE);
|
|
54
|
-
|
|
55
|
-
if (finalNativeBalance > initialNativeBalance) {
|
|
56
|
-
_transferOut(NATIVE, nativeRefund, finalNativeBalance - initialNativeBalance);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _approveForExtRouter(address token, address extRouter, uint256 amount) internal {
|
|
61
|
-
if (token == NATIVE) return;
|
|
62
|
-
IERC20(token).forceApprove(extRouter, amount);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
receive() external payable {}
|
|
66
|
-
}
|