@pendle/core-v2 2.15.2 → 2.17.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/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/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/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- 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/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- 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/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYUtils.sol/SYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol/PendleAuraBbAWethSwethSY.json +1189 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol/ComposableStableMath.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol/ComposableStablePreview.json +322 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAPoolHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAPoolHelper.json +24 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAWethHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol/BbAWethHelper.json +24 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol/LinearMath.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol/LinearMath.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol/LinearPreview.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol/LinearPreview.json +234 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol/PendleAuraBalancerStableLPSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/GLPPreviewHelper.sol/GLPPreviewHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.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/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/erc20/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/erc20/PendleERC20Permit.sol/PendleERC20Permit.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/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/Errors.sol/Errors.dbg.json +1 -1
- 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/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IERC4626LinearPool.sol/IERC4626LinearPool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IERC4626LinearPool.sol/IERC4626LinearPool.json +1172 -0
- package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IRateProvider.sol/IRateProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotFactory.sol/ICamelotFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTFactory.sol/ICamelotNFTFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTHandler.sol/ICamelotNFTHandler.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPoolFactory.sol/ICamelotNitroPoolFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotRouter.sol/ICamelotRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotYieldBooster.sol/ICamelotYieldBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/IXGrail.sol/IXGrail.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Curve/ITriCrvPool.sol/ITriCrvPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Frax/IFrxEthMinter.sol/IFrxEthMinter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IGMXVault.sol/IGMXVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IGlpManager.sol/IGlpManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IRewardRouterV2.sol/IRewardRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/GMX/IVaultPriceFeed.sol/IVaultPriceFeed.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAddressProvider.sol/IAddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IApeStaking.sol/IApeStaking.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/IDiamondCut.sol/IDiamondCut.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IDiamondLoupe.sol/IDiamondLoupe.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.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/ILooksFeeSharing.sol/ILooksFeeSharing.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ILooksStaking.sol/ILooksStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.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/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeemStatic.sol/IPActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionVePendleStatic.sol/IPActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerFactory.sol/IPBulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSellerSYCallback.sol/IPBulkSellerCallback.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/IPGauge.sol/IPGauge.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/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/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPtOracle.sol/IPPtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.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/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/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStETH.sol/IStETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStandardizedYield.sol/IStandardizedYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLP.sol/IStargateLP.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateStaking.sol/IStargateStaking.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/offchain-helpers/AddressProvider.sol/AddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/EmptyUUPS.sol/EmptyUUPS.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/MarketExchangeRateLib.sol/MarketExchangeRateLib.json +10 -0
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallV1.sol/PendleMulticallV1.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/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- 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/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- 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/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- 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/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.json +60 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/{arbitrum/IAggregationExecutor.sol → IAggregationExecutor.sol}/IAggregationExecutor.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IExecutorHelper.sol/IExecutorHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/{arbitrum/IExecutorHelper1.sol/IExecutorHelper1.json → IExecutorHelper.sol/IExecutorHelper.json} +147 -2
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IHashflow.sol/IHashflow.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/{ethereum/IHashflow.sol → IHashflow.sol}/IHashflow.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/{arbitrum/IMetaAggregationRouterV2.sol → IMetaAggregationRouterV2.sol}/IMetaAggregationRouterV2.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberInputScalingHelper.sol/KyberInputScalingHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/{arbitrum/KyberHelperArbitrum.sol/KyberHelperArbitrum.json → KyberInputScalingHelper.sol/KyberInputScalingHelper.json} +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScalingDataLib.sol/ScalingDataLib.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScalingDataLib.sol/ScalingDataLib.json +10 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraBbAWethSwethSY.sol +153 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStableMath.sol +289 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/ComposableStable/ComposableStablePreview.sol +629 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/BbAPoolHelper.sol +113 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearMath.sol +381 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/Linear/LinearPreview.sol +206 -0
- package/contracts/interfaces/Balancer/IERC4626LinearPool.sol +181 -0
- package/contracts/interfaces/Balancer/IVault.sol +13 -0
- package/deployments/1-markets/BALANCER-LP-AURA-BBAWETHSWETH-SEP-26-2024.json +10 -0
- package/deployments/1-markets/STETH-DEC2027.json +10 -0
- package/deployments/merkle-distribution/2023-05-25.json +3749 -0
- package/package.json +1 -1
- package/typechain-types/BbAPoolHelper.ts +89 -0
- package/typechain-types/BbAWethHelper.ts +89 -0
- package/typechain-types/ComposableStablePreview.ts +501 -0
- package/typechain-types/IERC4626LinearPool.ts +1649 -0
- package/typechain-types/IExecutorHelper.ts +863 -0
- package/typechain-types/{CamelotV1PreviewHelper.ts → LinearPreview.ts} +49 -118
- package/typechain-types/{PendleCamelotV1SY.ts → PendleAuraBbAWethSwethSY.ts} +199 -383
- package/typechain-types/PendleSwap.ts +126 -0
- package/typechain-types/factories/BbAPoolHelper__factory.ts +36 -0
- package/typechain-types/factories/BbAWethHelper__factory.ts +36 -0
- package/typechain-types/factories/ComposableStablePreview__factory.ts +379 -0
- package/typechain-types/factories/IERC4626LinearPool__factory.ts +1187 -0
- package/typechain-types/factories/IExecutorHelper__factory.ts +548 -0
- package/typechain-types/factories/LinearPreview__factory.ts +284 -0
- package/typechain-types/factories/MetaStablePreview__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraBbAWethSwethSY__factory.ts +1266 -0
- package/typechain-types/factories/PendleAuraWethAnkrethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethRocketEthSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethStafiEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleAuraWethWstethSYV2__factory.ts +1 -1
- package/typechain-types/factories/PendleSwap__factory.ts +110 -0
- package/typechain-types/hardhat.d.ts +99 -0
- package/typechain-types/index.ts +16 -0
- package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.json +0 -160
- package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.json +0 -10
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwapArbitrum.sol/PendleSwapArbitrum.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwapArbitrum.sol/PendleSwapArbitrum.json +0 -76
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwapEthereum.sol/PendleSwapEthereum.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwapEthereum.sol/PendleSwapEthereum.json +0 -76
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/IExecutorHelper1.sol/IExecutorHelper1.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/IExecutorHelper2.sol/IExecutorHelper2.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/IExecutorHelper2.sol/IExecutorHelper2.json +0 -40
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/IHashflow.sol/IHashflow.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/IHashflow.sol/IHashflow.json +0 -101
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/KyberHelperArbitrum.sol/KyberHelperArbitrum.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/ScaleDataHelperArbitrum.sol/ScaleDataHelperArbitrum.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/arbitrum/ScaleDataHelperArbitrum.sol/ScaleDataHelperArbitrum.json +0 -10
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/IAggregationExecutor.sol/IAggregationExecutor.json +0 -65
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.json +0 -388
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/IHashflow.sol/IHashflow.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.json +0 -215
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/KyberHelperEthereum.sol/KyberHelperEthereum.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/KyberHelperEthereum.sol/KyberHelperEthereum.json +0 -10
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/ScaleDataHelperEthereum.sol/ScaleDataHelperEthereum.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ethereum/ScaleDataHelperEthereum.sol/ScaleDataHelperEthereum.json +0 -10
- package/typechain-types/IPVotingEscrowSidechain.ts +0 -155
- package/typechain-types/PendleCamelotRewardHelper.ts +0 -347
- package/typechain-types/PendleCamelotV1RouterHelper.ts +0 -133
- package/typechain-types/factories/CamelotV1PreviewHelper__factory.ts +0 -400
- package/typechain-types/factories/IPVotingEscrowSidechain__factory.ts +0 -112
- package/typechain-types/factories/PendleCamelotRewardHelper__factory.ts +0 -317
- package/typechain-types/factories/PendleCamelotV1RouterHelper__factory.ts +0 -95
- package/typechain-types/factories/PendleCamelotV1SY__factory.ts +0 -1448
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
|
+
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
6
|
+
|
|
7
|
+
import "../../../../../../interfaces/Balancer/IComposableStable.sol";
|
|
8
|
+
|
|
9
|
+
import "../FixedPoint.sol";
|
|
10
|
+
import "./ComposableStableMath.sol";
|
|
11
|
+
import "../StablePoolUserData.sol";
|
|
12
|
+
|
|
13
|
+
import "../StablePreviewBase.sol";
|
|
14
|
+
import "../../../../../libraries/BoringOwnableUpgradeable.sol";
|
|
15
|
+
|
|
16
|
+
contract ComposableStablePreview is StablePreviewBase, BoringOwnableUpgradeable, UUPSUpgradeable {
|
|
17
|
+
using ComposableStableMath for uint256;
|
|
18
|
+
using StablePoolUserData for bytes;
|
|
19
|
+
using FixedPoint for uint256;
|
|
20
|
+
|
|
21
|
+
struct ImmutableData {
|
|
22
|
+
address[] poolTokens;
|
|
23
|
+
address[] rateProviders;
|
|
24
|
+
uint256[] rawScalingFactors;
|
|
25
|
+
bool[] isExemptFromYieldProtocolFee;
|
|
26
|
+
//
|
|
27
|
+
address LP;
|
|
28
|
+
bool noTokensExempt;
|
|
29
|
+
bool allTokensExempt;
|
|
30
|
+
uint256 bptIndex;
|
|
31
|
+
uint256 totalTokens;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
struct TokenRateCache {
|
|
35
|
+
uint256 currentRate;
|
|
36
|
+
uint256 oldRate;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
constructor() initializer {}
|
|
40
|
+
|
|
41
|
+
function initialize() external initializer {
|
|
42
|
+
__BoringOwnable_init();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
46
|
+
|
|
47
|
+
function onJoinPool(
|
|
48
|
+
bytes32 poolId,
|
|
49
|
+
address sender,
|
|
50
|
+
address recipient,
|
|
51
|
+
uint256[] memory balances,
|
|
52
|
+
uint256 lastChangeBlock,
|
|
53
|
+
uint256 protocolSwapFeePercentage,
|
|
54
|
+
bytes memory userData,
|
|
55
|
+
bytes memory poolImmutableData
|
|
56
|
+
) internal view override returns (uint256 bptAmountOut) {
|
|
57
|
+
ImmutableData memory imd = abi.decode(poolImmutableData, (ImmutableData));
|
|
58
|
+
|
|
59
|
+
TokenRateCache[] memory caches = _beforeSwapJoinExit(imd);
|
|
60
|
+
|
|
61
|
+
uint256[] memory scalingFactors = _scalingFactors(imd, caches);
|
|
62
|
+
|
|
63
|
+
// skip totalSupply == 0 case
|
|
64
|
+
|
|
65
|
+
_upscaleArray(balances, scalingFactors);
|
|
66
|
+
(bptAmountOut, ) = _onJoinPool(
|
|
67
|
+
poolId,
|
|
68
|
+
sender,
|
|
69
|
+
recipient,
|
|
70
|
+
balances,
|
|
71
|
+
lastChangeBlock,
|
|
72
|
+
protocolSwapFeePercentage,
|
|
73
|
+
scalingFactors,
|
|
74
|
+
userData,
|
|
75
|
+
imd,
|
|
76
|
+
caches
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// skip _mintPoolTokens, _downscaleUpArray
|
|
80
|
+
|
|
81
|
+
// we return bptAmountOut instead of minting
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function onExitPool(
|
|
85
|
+
bytes32 poolId,
|
|
86
|
+
address sender,
|
|
87
|
+
address recipient,
|
|
88
|
+
uint256[] memory balances,
|
|
89
|
+
uint256 lastChangeBlock,
|
|
90
|
+
uint256 protocolSwapFeePercentage,
|
|
91
|
+
bytes memory userData,
|
|
92
|
+
bytes memory poolImmutableData
|
|
93
|
+
) internal view override returns (uint256 amountTokenOut) {
|
|
94
|
+
ImmutableData memory imd = abi.decode(poolImmutableData, (ImmutableData));
|
|
95
|
+
|
|
96
|
+
uint256 bptAmountIn;
|
|
97
|
+
uint256[] memory amountsOut;
|
|
98
|
+
|
|
99
|
+
// skip recovery mode
|
|
100
|
+
|
|
101
|
+
TokenRateCache[] memory caches = _beforeSwapJoinExit(imd);
|
|
102
|
+
|
|
103
|
+
uint256[] memory scalingFactors = _scalingFactors(imd, caches);
|
|
104
|
+
_upscaleArray(balances, scalingFactors);
|
|
105
|
+
|
|
106
|
+
(bptAmountIn, amountsOut) = _onExitPool(
|
|
107
|
+
poolId,
|
|
108
|
+
sender,
|
|
109
|
+
recipient,
|
|
110
|
+
balances,
|
|
111
|
+
lastChangeBlock,
|
|
112
|
+
protocolSwapFeePercentage, // assume no recovery mode
|
|
113
|
+
scalingFactors,
|
|
114
|
+
userData,
|
|
115
|
+
imd,
|
|
116
|
+
caches
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
_downscaleDownArray(amountsOut, scalingFactors);
|
|
120
|
+
|
|
121
|
+
// skip burnPoolTokens
|
|
122
|
+
|
|
123
|
+
for (uint256 i = 0; i < amountsOut.length; i++) {
|
|
124
|
+
if (amountsOut[i] > 0) return amountsOut[i];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function _onJoinPool(
|
|
129
|
+
bytes32,
|
|
130
|
+
address,
|
|
131
|
+
address,
|
|
132
|
+
uint256[] memory registeredBalances,
|
|
133
|
+
uint256,
|
|
134
|
+
uint256,
|
|
135
|
+
uint256[] memory scalingFactors,
|
|
136
|
+
bytes memory userData,
|
|
137
|
+
ImmutableData memory imd,
|
|
138
|
+
TokenRateCache[] memory caches
|
|
139
|
+
) internal view returns (uint256, uint256[] memory) {
|
|
140
|
+
return _onJoinExitPool(true, registeredBalances, scalingFactors, userData, imd, caches);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function _onExitPool(
|
|
144
|
+
bytes32,
|
|
145
|
+
address,
|
|
146
|
+
address,
|
|
147
|
+
uint256[] memory registeredBalances,
|
|
148
|
+
uint256,
|
|
149
|
+
uint256,
|
|
150
|
+
uint256[] memory scalingFactors,
|
|
151
|
+
bytes memory userData,
|
|
152
|
+
ImmutableData memory imd,
|
|
153
|
+
TokenRateCache[] memory caches
|
|
154
|
+
) internal view returns (uint256, uint256[] memory) {
|
|
155
|
+
return _onJoinExitPool(false, registeredBalances, scalingFactors, userData, imd, caches);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @return bptAmount
|
|
160
|
+
* @return amountsDelta this will not contain bpt item since it will be discarded on the upper level
|
|
161
|
+
*/
|
|
162
|
+
function _onJoinExitPool(
|
|
163
|
+
bool isJoin,
|
|
164
|
+
uint256[] memory registeredBalances,
|
|
165
|
+
uint256[] memory scalingFactors,
|
|
166
|
+
bytes memory userData,
|
|
167
|
+
ImmutableData memory imd,
|
|
168
|
+
TokenRateCache[] memory caches
|
|
169
|
+
) internal view returns (uint256 bptAmount, uint256[] memory amountsDelta) {
|
|
170
|
+
(
|
|
171
|
+
uint256 preJoinExitSupply,
|
|
172
|
+
uint256[] memory balances,
|
|
173
|
+
uint256 currentAmp,
|
|
174
|
+
uint256 preJoinExitInvariant
|
|
175
|
+
) = _beforeJoinExit(registeredBalances, imd, caches);
|
|
176
|
+
|
|
177
|
+
function(
|
|
178
|
+
uint256[] memory,
|
|
179
|
+
uint256,
|
|
180
|
+
uint256,
|
|
181
|
+
uint256,
|
|
182
|
+
uint256[] memory,
|
|
183
|
+
bytes memory,
|
|
184
|
+
ImmutableData memory
|
|
185
|
+
) internal view returns (uint256, uint256[] memory) _doJoinOrExit = (
|
|
186
|
+
isJoin ? _doJoin : _doExit
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
(bptAmount, amountsDelta) = _doJoinOrExit(
|
|
190
|
+
balances,
|
|
191
|
+
currentAmp,
|
|
192
|
+
preJoinExitSupply,
|
|
193
|
+
preJoinExitInvariant,
|
|
194
|
+
scalingFactors,
|
|
195
|
+
userData,
|
|
196
|
+
imd
|
|
197
|
+
);
|
|
198
|
+
amountsDelta = _addBptItem(amountsDelta, 0, imd);
|
|
199
|
+
|
|
200
|
+
// _mutateAmounts
|
|
201
|
+
|
|
202
|
+
// skip _updateInvariantAfterJoinExit here
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function _addBptItem(
|
|
206
|
+
uint256[] memory amounts,
|
|
207
|
+
uint256 bptAmount,
|
|
208
|
+
ImmutableData memory imd
|
|
209
|
+
) internal pure returns (uint256[] memory registeredTokenAmounts) {
|
|
210
|
+
registeredTokenAmounts = new uint256[](amounts.length + 1);
|
|
211
|
+
for (uint256 i = 0; i < registeredTokenAmounts.length; i++) {
|
|
212
|
+
registeredTokenAmounts[i] = i == imd.bptIndex
|
|
213
|
+
? bptAmount
|
|
214
|
+
: amounts[i < imd.bptIndex ? i : i - 1];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function _doJoin(
|
|
219
|
+
uint256[] memory balances,
|
|
220
|
+
uint256 currentAmp,
|
|
221
|
+
uint256 preJoinExitSupply,
|
|
222
|
+
uint256 preJoinExitInvariant,
|
|
223
|
+
uint256[] memory scalingFactors,
|
|
224
|
+
bytes memory userData,
|
|
225
|
+
ImmutableData memory imd
|
|
226
|
+
) internal view returns (uint256, uint256[] memory) {
|
|
227
|
+
// this is always true given Pendle SY context
|
|
228
|
+
return
|
|
229
|
+
_joinExactTokensInForBPTOut(
|
|
230
|
+
preJoinExitSupply,
|
|
231
|
+
preJoinExitInvariant,
|
|
232
|
+
currentAmp,
|
|
233
|
+
balances,
|
|
234
|
+
scalingFactors,
|
|
235
|
+
userData,
|
|
236
|
+
imd
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function _joinExactTokensInForBPTOut(
|
|
241
|
+
uint256 actualSupply,
|
|
242
|
+
uint256 preJoinExitInvariant,
|
|
243
|
+
uint256 currentAmp,
|
|
244
|
+
uint256[] memory balances,
|
|
245
|
+
uint256[] memory scalingFactors,
|
|
246
|
+
bytes memory userData,
|
|
247
|
+
ImmutableData memory imd
|
|
248
|
+
) private view returns (uint256, uint256[] memory) {
|
|
249
|
+
(uint256[] memory amountsIn, ) = userData.exactTokensInForBptOut();
|
|
250
|
+
|
|
251
|
+
// The user-provided amountsIn is unscaled, so we address that.
|
|
252
|
+
_upscaleArray(amountsIn, _dropBptItem(imd, scalingFactors));
|
|
253
|
+
|
|
254
|
+
uint256 bptAmountOut = currentAmp._calcBptOutGivenExactTokensIn(
|
|
255
|
+
balances,
|
|
256
|
+
amountsIn,
|
|
257
|
+
actualSupply,
|
|
258
|
+
preJoinExitInvariant,
|
|
259
|
+
IBasePool(imd.LP).getSwapFeePercentage()
|
|
260
|
+
);
|
|
261
|
+
return (bptAmountOut, amountsIn);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function _doExit(
|
|
265
|
+
uint256[] memory balances,
|
|
266
|
+
uint256 currentAmp,
|
|
267
|
+
uint256 preJoinExitSupply,
|
|
268
|
+
uint256 preJoinExitInvariant,
|
|
269
|
+
uint256[] memory, /*scalingFactors*/
|
|
270
|
+
bytes memory userData,
|
|
271
|
+
ImmutableData memory imd
|
|
272
|
+
) internal view returns (uint256, uint256[] memory) {
|
|
273
|
+
// this is always true given Pendle SY context
|
|
274
|
+
return
|
|
275
|
+
_exitExactBPTInForTokenOut(
|
|
276
|
+
preJoinExitSupply,
|
|
277
|
+
preJoinExitInvariant,
|
|
278
|
+
currentAmp,
|
|
279
|
+
balances,
|
|
280
|
+
userData,
|
|
281
|
+
imd
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function _exitExactBPTInForTokenOut(
|
|
286
|
+
uint256 actualSupply,
|
|
287
|
+
uint256 preJoinExitInvariant,
|
|
288
|
+
uint256 currentAmp,
|
|
289
|
+
uint256[] memory balances,
|
|
290
|
+
bytes memory userData,
|
|
291
|
+
ImmutableData memory imd
|
|
292
|
+
) private view returns (uint256, uint256[] memory) {
|
|
293
|
+
(uint256 bptAmountIn, uint256 tokenIndex) = userData.exactBptInForTokenOut();
|
|
294
|
+
|
|
295
|
+
uint256[] memory amountsOut = new uint256[](balances.length);
|
|
296
|
+
|
|
297
|
+
amountsOut[tokenIndex] = currentAmp._calcTokenOutGivenExactBptIn(
|
|
298
|
+
balances,
|
|
299
|
+
tokenIndex,
|
|
300
|
+
bptAmountIn,
|
|
301
|
+
actualSupply,
|
|
302
|
+
preJoinExitInvariant,
|
|
303
|
+
IBasePool(imd.LP).getSwapFeePercentage()
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
return (bptAmountIn, amountsOut);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function _beforeJoinExit(
|
|
310
|
+
uint256[] memory registeredBalances,
|
|
311
|
+
ImmutableData memory imd,
|
|
312
|
+
TokenRateCache[] memory caches
|
|
313
|
+
)
|
|
314
|
+
internal
|
|
315
|
+
view
|
|
316
|
+
returns (
|
|
317
|
+
uint256,
|
|
318
|
+
uint256[] memory,
|
|
319
|
+
uint256,
|
|
320
|
+
uint256
|
|
321
|
+
)
|
|
322
|
+
{
|
|
323
|
+
(uint256 lastJoinExitAmp, uint256 lastPostJoinExitInvariant) = IComposableStable(imd.LP)
|
|
324
|
+
.getLastJoinExitData();
|
|
325
|
+
|
|
326
|
+
(
|
|
327
|
+
uint256 preJoinExitSupply,
|
|
328
|
+
uint256[] memory balances,
|
|
329
|
+
uint256 oldAmpPreJoinExitInvariant
|
|
330
|
+
) = _payProtocolFeesBeforeJoinExit(
|
|
331
|
+
registeredBalances,
|
|
332
|
+
lastJoinExitAmp,
|
|
333
|
+
lastPostJoinExitInvariant,
|
|
334
|
+
imd,
|
|
335
|
+
caches
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
(uint256 currentAmp, , ) = IComposableStable(imd.LP).getAmplificationParameter();
|
|
339
|
+
uint256 preJoinExitInvariant = currentAmp == lastJoinExitAmp
|
|
340
|
+
? oldAmpPreJoinExitInvariant
|
|
341
|
+
: currentAmp._calculateInvariant(balances);
|
|
342
|
+
|
|
343
|
+
return (preJoinExitSupply, balances, currentAmp, preJoinExitInvariant);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function _payProtocolFeesBeforeJoinExit(
|
|
347
|
+
uint256[] memory registeredBalances,
|
|
348
|
+
uint256 lastJoinExitAmp,
|
|
349
|
+
uint256 lastPostJoinExitInvariant,
|
|
350
|
+
ImmutableData memory imd,
|
|
351
|
+
TokenRateCache[] memory caches
|
|
352
|
+
)
|
|
353
|
+
internal
|
|
354
|
+
view
|
|
355
|
+
returns (
|
|
356
|
+
uint256,
|
|
357
|
+
uint256[] memory,
|
|
358
|
+
uint256
|
|
359
|
+
)
|
|
360
|
+
{
|
|
361
|
+
(uint256 virtualSupply, uint256[] memory balances) = _dropBptItemFromBalances(
|
|
362
|
+
imd,
|
|
363
|
+
registeredBalances
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
(
|
|
367
|
+
uint256 expectedProtocolOwnershipPercentage,
|
|
368
|
+
uint256 currentInvariantWithLastJoinExitAmp
|
|
369
|
+
) = _getProtocolPoolOwnershipPercentage(
|
|
370
|
+
balances,
|
|
371
|
+
lastJoinExitAmp,
|
|
372
|
+
lastPostJoinExitInvariant,
|
|
373
|
+
imd,
|
|
374
|
+
caches
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
uint256 protocolFeeAmount = _calculateAdjustedProtocolFeeAmount(
|
|
378
|
+
virtualSupply,
|
|
379
|
+
expectedProtocolOwnershipPercentage
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
// skip _payProtocolFee, which will make the LP balance from this point onwards to be off
|
|
383
|
+
|
|
384
|
+
return (virtualSupply + protocolFeeAmount, balances, currentInvariantWithLastJoinExitAmp);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function _getProtocolPoolOwnershipPercentage(
|
|
388
|
+
uint256[] memory balances,
|
|
389
|
+
uint256 lastJoinExitAmp,
|
|
390
|
+
uint256 lastPostJoinExitInvariant,
|
|
391
|
+
ImmutableData memory imd,
|
|
392
|
+
TokenRateCache[] memory caches
|
|
393
|
+
) internal view returns (uint256, uint256) {
|
|
394
|
+
(
|
|
395
|
+
uint256 swapFeeGrowthInvariant,
|
|
396
|
+
uint256 totalNonExemptGrowthInvariant,
|
|
397
|
+
uint256 totalGrowthInvariant
|
|
398
|
+
) = _getGrowthInvariants(balances, lastJoinExitAmp, imd, caches);
|
|
399
|
+
|
|
400
|
+
uint256 swapFeeGrowthInvariantDelta = (swapFeeGrowthInvariant > lastPostJoinExitInvariant)
|
|
401
|
+
? swapFeeGrowthInvariant - lastPostJoinExitInvariant
|
|
402
|
+
: 0;
|
|
403
|
+
uint256 nonExemptYieldGrowthInvariantDelta = (totalNonExemptGrowthInvariant >
|
|
404
|
+
swapFeeGrowthInvariant)
|
|
405
|
+
? totalNonExemptGrowthInvariant - swapFeeGrowthInvariant
|
|
406
|
+
: 0;
|
|
407
|
+
|
|
408
|
+
uint256 protocolSwapFeePercentage = swapFeeGrowthInvariantDelta
|
|
409
|
+
.divDown(totalGrowthInvariant)
|
|
410
|
+
.mulDown(
|
|
411
|
+
IComposableStable(imd.LP).getProtocolFeePercentageCache(0) // ProtocolFeeType.SWAP // can't get better
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
uint256 protocolYieldPercentage = nonExemptYieldGrowthInvariantDelta
|
|
415
|
+
.divDown(totalGrowthInvariant)
|
|
416
|
+
.mulDown(
|
|
417
|
+
IComposableStable(imd.LP).getProtocolFeePercentageCache(2) // ProtocolFeeType.YIELD // can't get better
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
// These percentages can then be simply added to compute the total protocol Pool ownership percentage.
|
|
421
|
+
// This is naturally bounded above by FixedPoint.ONE so this addition cannot overflow.
|
|
422
|
+
return (protocolSwapFeePercentage + protocolYieldPercentage, totalGrowthInvariant);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function _getGrowthInvariants(
|
|
426
|
+
uint256[] memory balances,
|
|
427
|
+
uint256 lastJoinExitAmp,
|
|
428
|
+
ImmutableData memory imd,
|
|
429
|
+
TokenRateCache[] memory caches
|
|
430
|
+
)
|
|
431
|
+
internal
|
|
432
|
+
pure
|
|
433
|
+
returns (
|
|
434
|
+
uint256 swapFeeGrowthInvariant,
|
|
435
|
+
uint256 totalNonExemptGrowthInvariant,
|
|
436
|
+
uint256 totalGrowthInvariant
|
|
437
|
+
)
|
|
438
|
+
{
|
|
439
|
+
swapFeeGrowthInvariant = lastJoinExitAmp._calculateInvariant(
|
|
440
|
+
_getAdjustedBalances(balances, true, imd, caches)
|
|
441
|
+
);
|
|
442
|
+
|
|
443
|
+
if (imd.noTokensExempt) {
|
|
444
|
+
totalNonExemptGrowthInvariant = lastJoinExitAmp._calculateInvariant(balances);
|
|
445
|
+
totalGrowthInvariant = totalNonExemptGrowthInvariant;
|
|
446
|
+
} else if (imd.allTokensExempt) {
|
|
447
|
+
totalNonExemptGrowthInvariant = swapFeeGrowthInvariant;
|
|
448
|
+
totalGrowthInvariant = lastJoinExitAmp._calculateInvariant(balances);
|
|
449
|
+
} else {
|
|
450
|
+
totalNonExemptGrowthInvariant = lastJoinExitAmp._calculateInvariant(
|
|
451
|
+
_getAdjustedBalances(balances, false, imd, caches)
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
totalGrowthInvariant = lastJoinExitAmp._calculateInvariant(balances);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function _getAdjustedBalances(
|
|
459
|
+
uint256[] memory balances,
|
|
460
|
+
bool ignoreExemptFlags,
|
|
461
|
+
ImmutableData memory imd,
|
|
462
|
+
TokenRateCache[] memory tokenRateCaches
|
|
463
|
+
) internal pure returns (uint256[] memory) {
|
|
464
|
+
uint256 totalTokensWithoutBpt = balances.length;
|
|
465
|
+
uint256[] memory adjustedBalances = new uint256[](totalTokensWithoutBpt);
|
|
466
|
+
|
|
467
|
+
for (uint256 i = 0; i < totalTokensWithoutBpt; ++i) {
|
|
468
|
+
uint256 skipBptIndex = i >= imd.bptIndex ? i + 1 : i;
|
|
469
|
+
adjustedBalances[i] = _isTokenExemptFromYieldProtocolFee(imd, skipBptIndex) ||
|
|
470
|
+
(ignoreExemptFlags && _hasRateProvider(imd, skipBptIndex))
|
|
471
|
+
? _adjustedBalance(balances[i], tokenRateCaches[skipBptIndex])
|
|
472
|
+
: balances[i];
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return adjustedBalances;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function _adjustedBalance(uint256 balance, TokenRateCache memory cache)
|
|
479
|
+
private
|
|
480
|
+
pure
|
|
481
|
+
returns (uint256)
|
|
482
|
+
{
|
|
483
|
+
return (balance * cache.oldRate) / cache.currentRate;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function _calculateAdjustedProtocolFeeAmount(uint256 supply, uint256 basePercentage)
|
|
487
|
+
internal
|
|
488
|
+
pure
|
|
489
|
+
returns (uint256)
|
|
490
|
+
{
|
|
491
|
+
return supply.mulDown(basePercentage).divDown(basePercentage.complement());
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function _dropBptItemFromBalances(
|
|
495
|
+
ImmutableData memory imd,
|
|
496
|
+
uint256[] memory registeredBalances
|
|
497
|
+
) internal view returns (uint256, uint256[] memory) {
|
|
498
|
+
return (
|
|
499
|
+
_getVirtualSupply(imd, registeredBalances[imd.bptIndex]),
|
|
500
|
+
_dropBptItem(imd, registeredBalances)
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function _dropBptItem(ImmutableData memory imd, uint256[] memory amounts)
|
|
505
|
+
internal
|
|
506
|
+
pure
|
|
507
|
+
returns (uint256[] memory)
|
|
508
|
+
{
|
|
509
|
+
uint256[] memory amountsWithoutBpt = new uint256[](amounts.length - 1);
|
|
510
|
+
for (uint256 i = 0; i < amountsWithoutBpt.length; i++) {
|
|
511
|
+
amountsWithoutBpt[i] = amounts[i < imd.bptIndex ? i : i + 1];
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
return amountsWithoutBpt;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function _getVirtualSupply(ImmutableData memory imd, uint256 bptBalance)
|
|
518
|
+
internal
|
|
519
|
+
view
|
|
520
|
+
returns (uint256)
|
|
521
|
+
{
|
|
522
|
+
return (IERC20(imd.LP).totalSupply()).sub(bptBalance); // can't get better
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function _beforeSwapJoinExit(ImmutableData memory imd)
|
|
526
|
+
internal
|
|
527
|
+
view
|
|
528
|
+
returns (TokenRateCache[] memory tokenRateCaches)
|
|
529
|
+
{
|
|
530
|
+
return _cacheTokenRatesIfNecessary(imd);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function _cacheTokenRatesIfNecessary(ImmutableData memory imd)
|
|
534
|
+
internal
|
|
535
|
+
view
|
|
536
|
+
returns (TokenRateCache[] memory tokenRateCaches)
|
|
537
|
+
{
|
|
538
|
+
tokenRateCaches = new TokenRateCache[](imd.totalTokens);
|
|
539
|
+
|
|
540
|
+
for (uint256 i = 0; i < imd.totalTokens; ++i) {
|
|
541
|
+
tokenRateCaches[i] = _cacheTokenRateIfNecessary(i, imd);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* @dev Caches the rate for a token if necessary. It ignores the call if there is no provider set.
|
|
547
|
+
*/
|
|
548
|
+
function _cacheTokenRateIfNecessary(uint256 index, ImmutableData memory imd)
|
|
549
|
+
internal
|
|
550
|
+
view
|
|
551
|
+
returns (TokenRateCache memory res)
|
|
552
|
+
{
|
|
553
|
+
if (index == imd.bptIndex || !_hasRateProvider(imd, index)) return res;
|
|
554
|
+
|
|
555
|
+
uint256 expires;
|
|
556
|
+
(res.currentRate, res.oldRate, , expires) = IComposableStable(imd.LP).getTokenRateCache(
|
|
557
|
+
IERC20(imd.poolTokens[index])
|
|
558
|
+
);
|
|
559
|
+
|
|
560
|
+
if (block.timestamp > expires) {
|
|
561
|
+
res.currentRate = IRateProvider(imd.rateProviders[index]).getRate();
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function _scalingFactors(ImmutableData memory imd, TokenRateCache[] memory caches)
|
|
566
|
+
internal
|
|
567
|
+
view
|
|
568
|
+
virtual
|
|
569
|
+
returns (uint256[] memory)
|
|
570
|
+
{
|
|
571
|
+
// There is no need to check the arrays length since both are based on `_getTotalTokens`
|
|
572
|
+
uint256[] memory scalingFactors = new uint256[](imd.totalTokens);
|
|
573
|
+
|
|
574
|
+
for (uint256 i = 0; i < imd.totalTokens; ++i) {
|
|
575
|
+
scalingFactors[i] = imd.rawScalingFactors[i].mulDown(_getTokenRate(caches, i));
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
return scalingFactors;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function _getTokenRate(TokenRateCache[] memory caches, uint256 index)
|
|
582
|
+
internal
|
|
583
|
+
view
|
|
584
|
+
virtual
|
|
585
|
+
returns (uint256)
|
|
586
|
+
{
|
|
587
|
+
return caches[index].currentRate == 0 ? FixedPoint.ONE : caches[index].currentRate;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/*///////////////////////////////////////////////////////////////
|
|
591
|
+
Helpers functions
|
|
592
|
+
//////////////////////////////////////////////////////////////*/
|
|
593
|
+
|
|
594
|
+
function _upscaleArray(uint256[] memory amounts, uint256[] memory scalingFactors)
|
|
595
|
+
internal
|
|
596
|
+
pure
|
|
597
|
+
{
|
|
598
|
+
uint256 length = amounts.length;
|
|
599
|
+
for (uint256 i = 0; i < length; ++i) {
|
|
600
|
+
amounts[i] = FixedPoint.mulDown(amounts[i], scalingFactors[i]);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function _downscaleDownArray(uint256[] memory amounts, uint256[] memory scalingFactors)
|
|
605
|
+
internal
|
|
606
|
+
pure
|
|
607
|
+
{
|
|
608
|
+
uint256 length = amounts.length;
|
|
609
|
+
for (uint256 i = 0; i < length; ++i) {
|
|
610
|
+
amounts[i] = FixedPoint.divDown(amounts[i], scalingFactors[i]);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function _hasRateProvider(ImmutableData memory imd, uint256 index)
|
|
615
|
+
internal
|
|
616
|
+
pure
|
|
617
|
+
returns (bool)
|
|
618
|
+
{
|
|
619
|
+
return address(imd.rateProviders[index]) != address(0);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function _isTokenExemptFromYieldProtocolFee(ImmutableData memory imd, uint256 index)
|
|
623
|
+
internal
|
|
624
|
+
pure
|
|
625
|
+
returns (bool)
|
|
626
|
+
{
|
|
627
|
+
return imd.isExemptFromYieldProtocolFee[index];
|
|
628
|
+
}
|
|
629
|
+
}
|