@pendle/core-v2 1.2.0-mainnet → 1.2.0-testnet
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/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.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/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
- 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/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +3 -3
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +34 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +2 -2
- 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/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 +3 -3
- 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/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerFactory.sol/BulkSellerFactory.json +2 -2
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.json +2 -2
- 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/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +2 -2
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +2 -2
- package/build/artifacts/contracts/core/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/SYBase.sol/SYBase.json +141 -0
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.json +141 -0
- package/build/artifacts/contracts/core/StandardizedYield/SYUtils.sol/SYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/StEthHelper.sol/StEthHelper.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol/PendleAuraWethRethSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol/PendleAuraWethRethSY.json +1218 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol/PendleAuraWethWstethSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol/PendleAuraWethWstethSY.json +1192 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol/FixedPoint.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol/MetaStableMath.json +40 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol/MetaStablePreview.json +322 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol/PendleAuraBalancerStableLPSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol/PendleAuraBalancerStableLPSY.json +1171 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol/StablePoolUserData.json +10 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol/StablePreviewBase.json +133 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.json +143 -2
- 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/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.json +141 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/GLPPreviewHelper.sol/GLPPreviewHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/GLPPreviewHelper.sol/GLPPreviewHelper.json +50 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.json +1163 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.json +143 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.json +143 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.json +66 -0
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol/PendlePrincipalTokenV2.json +476 -0
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.json +590 -0
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.json +1017 -0
- 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/ArrayLib.sol/ArrayLib.json +2 -2
- 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/Errors.sol/Errors.json +87 -2
- 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 +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IAsset.sol/IAsset.json +10 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerFees.sol/IBalancerFees.json +24 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBalancerStablePreview.sol/IBalancerStablePreview.json +133 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IBasePool.sol/IBasePool.json +328 -0
- package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IComposableStable.sol/IComposableStable.json +467 -0
- package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IGauge.sol/IGauge.json +61 -0
- package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol/ILiquidityGaugeFactory.json +30 -0
- package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IMetaStablePool.sol/IMetaStablePool.json +398 -0
- package/build/artifacts/contracts/interfaces/Balancer/IRateProvider.sol/IRateProvider.dbg.json +4 -0
- package/build/artifacts/contracts/{router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.json → interfaces/Balancer/IRateProvider.sol/IRateProvider.json} +5 -5
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Balancer/IVault.sol/IVault.json +278 -0
- 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/ConvexCurve/IRewards.sol/IRewards.json +18 -0
- 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/GMX/IGMXVault.sol/IGMXVault.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/GMX/IGMXVault.sol/IGMXVault.json +308 -0
- package/build/artifacts/contracts/interfaces/GMX/IGlpManager.sol/IGlpManager.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/GMX/IGlpManager.sol/IGlpManager.json +43 -0
- package/build/artifacts/contracts/interfaces/GMX/IRewardRouterV2.sol/IRewardRouterV2.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/GMX/IRewardRouterV2.sol/IRewardRouterV2.json +201 -0
- package/build/artifacts/contracts/interfaces/GMX/IVaultPriceFeed.sol/IVaultPriceFeed.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/GMX/IVaultPriceFeed.sol/IVaultPriceFeed.json +45 -0
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAddressProvider.sol/IAddressProvider.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IAddressProvider.sol/IAddressProvider.json +48 -0
- 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/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IDiamondCut.sol/IDiamondCut.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IDiamondCut.sol/IDiamondCut.json +93 -0
- package/build/artifacts/contracts/interfaces/IDiamondLoupe.sol/IDiamondLoupe.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IDiamondLoupe.sol/IDiamondLoupe.json +87 -0
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.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/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.json +338 -16
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.json +105 -224
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.json +56 -12
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +52 -8
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +231 -8
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +675 -241
- 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/IPFeeDistributor.sol/IPFeeDistributor.json +19 -0
- 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/IPGovernanceManager.sol/IPGovernanceManager.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 +4 -0
- package/build/artifacts/contracts/interfaces/IPInterestManagerYTV2.sol/IPInterestManagerYTV2.json +40 -0
- 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/IPMsgReceiverApp.sol/IPMsgReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/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 +4 -0
- package/build/artifacts/contracts/interfaces/IPYieldTokenV2.sol/IPYieldTokenV2.json +679 -0
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISAvax.sol/ISAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISJoe.sol/ISJoe.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/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWAvax.sol/IWAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWXBTRFLY.sol/IWXBTRFLY.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.json +143 -0
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -28
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/Multicall2.sol/Multicall2.json +322 -0
- package/build/artifacts/contracts/offchain-helpers/PendleMulticall.sol/PendleMulticall.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/PendleMulticall.sol/PendleMulticall.json +47 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +144 -60
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +345 -62
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +107 -260
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMisc.sol/ActionMisc.json +57 -18
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +54 -65
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +342 -44
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +76 -67
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +4 -0
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.json +141 -0
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.json +1 -15
- 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/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol/I1inchAggregationRouterV5.json +160 -0
- package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol/OneInchAggregationRouterHelper.json +10 -0
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.json +56 -0
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwapAggregator.sol/PendleSwapAggregator.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwapAggregator.sol/PendleSwapAggregator.json +72 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol/KyberAggregationRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol/KyberAggregationRouterHelper.json +10 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol/ScaleDataHelperEthereum1.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol/ScaleDataHelperEthereum1.json +10 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol/IAggregationExecutor.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol/IAggregationExecutor.json +65 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol/IExecutorHelperEthereum1.json +388 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol/IHashflow.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol/IHashflow.json +101 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol/IMetaAggregationRouterV2.json +215 -0
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +0 -1
- package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +9 -9
- package/contracts/core/RewardManager/RewardManager.sol +1 -1
- package/contracts/core/StandardizedYield/SYBase.sol +23 -5
- package/contracts/core/StandardizedYield/StEthHelper.sol +71 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRethSY.sol +134 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSY.sol +154 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/FixedPoint.sol +68 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStableMath.sol +322 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/MetaStable/MetaStablePreview.sol +390 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSY.sol +329 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol +30 -0
- package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol +189 -0
- package/contracts/core/StandardizedYield/implementations/GLP/GLPPreviewHelper.sol +142 -0
- package/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol +224 -0
- package/contracts/core/StandardizedYield/implementations/GLP/README.md +61 -0
- package/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol +138 -0
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +10 -0
- package/contracts/core/YieldContractsV2/InterestManagerYTV2.sol +114 -0
- package/contracts/core/YieldContractsV2/PendlePrincipalTokenV2.sol +63 -0
- package/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol +200 -0
- package/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol +485 -0
- package/contracts/core/libraries/ArrayLib.sol +27 -12
- package/contracts/core/libraries/Errors.sol +8 -2
- package/contracts/core/libraries/TokenHelper.sol +10 -0
- package/contracts/interfaces/Balancer/IAsset.sol +4 -0
- package/contracts/interfaces/Balancer/IBalancerFees.sol +6 -0
- package/contracts/interfaces/Balancer/IBalancerStablePreview.sol +22 -0
- package/contracts/interfaces/Balancer/IBasePool.sol +30 -0
- package/contracts/interfaces/Balancer/IComposableStable.sol +39 -0
- package/contracts/interfaces/Balancer/IGauge.sol +10 -0
- package/contracts/interfaces/Balancer/ILiquidityGaugeFactory.sol +6 -0
- package/contracts/interfaces/Balancer/IMetaStablePool.sol +31 -0
- package/contracts/interfaces/Balancer/IRateProvider.sol +6 -0
- package/contracts/interfaces/Balancer/IVault.sol +78 -0
- package/contracts/interfaces/ConvexCurve/IRewards.sol +5 -0
- package/contracts/interfaces/GMX/IGMXVault.sol +47 -0
- package/contracts/interfaces/GMX/IGlpManager.sol +12 -0
- package/contracts/interfaces/GMX/IRewardRouterV2.sol +43 -0
- package/contracts/interfaces/GMX/IVaultPriceFeed.sol +11 -0
- package/contracts/interfaces/IAddressProvider.sol +7 -0
- package/contracts/interfaces/IDiamondCut.sol +36 -0
- package/contracts/interfaces/IDiamondLoupe.sol +38 -0
- package/contracts/interfaces/IERC4626.sol +2 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +36 -1
- package/contracts/interfaces/IPActionInfoStatic.sol +43 -0
- package/contracts/interfaces/IPActionMarketAuxStatic.sol +30 -0
- package/contracts/interfaces/IPActionMarketCoreStatic.sol +317 -0
- package/contracts/interfaces/IPActionMintRedeem.sol +2 -55
- package/contracts/interfaces/IPActionMintRedeemStatic.sol +60 -0
- package/contracts/interfaces/IPActionMisc.sol +18 -4
- package/contracts/interfaces/IPActionStorageStatic.sol +25 -0
- package/contracts/interfaces/IPActionSwapPT.sol +1 -1
- package/contracts/interfaces/IPActionSwapYT.sol +28 -4
- package/contracts/interfaces/IPActionVePendleStatic.sol +9 -0
- package/contracts/interfaces/IPAllAction.sol +5 -3
- package/contracts/interfaces/IPInterestManagerYTV2.sol +13 -0
- package/contracts/interfaces/IPMiniDiamond.sol +12 -0
- package/contracts/interfaces/IPMsgReceiverApp.sol +1 -1
- package/contracts/interfaces/IPRouterStatic.sol +19 -0
- package/contracts/interfaces/IPVotingController.sol +6 -0
- package/contracts/interfaces/IPYieldTokenV2.sol +66 -0
- package/contracts/interfaces/IStandardizedYield.sol +1 -1
- package/contracts/offchain-helpers/AddressProvider.sol +16 -0
- package/contracts/offchain-helpers/Broadcaster.sol +48 -0
- package/contracts/offchain-helpers/PendleMulticall.sol +26 -0
- package/contracts/offchain-helpers/{MarketMathStatic.sol → legacy/MarketMathStatic.sol} +2 -2
- package/contracts/offchain-helpers/{RouterStatic.sol → legacy/RouterStatic.sol} +7 -7
- package/contracts/offchain-helpers/router-static/PendleRouterStatic.sol +19 -0
- package/contracts/offchain-helpers/router-static/StorageLayout.sol +21 -0
- package/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol +125 -0
- package/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol +166 -0
- package/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol +769 -0
- package/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol +166 -0
- package/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol +75 -0
- package/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol +55 -0
- package/contracts/router/ActionAddRemoveLiq.sol +116 -6
- package/contracts/router/ActionMintRedeem.sol +12 -202
- package/contracts/router/ActionMisc.sol +45 -19
- package/contracts/router/ActionSwapPT.sol +0 -5
- package/contracts/router/ActionSwapYT.sol +103 -13
- package/contracts/router/PendleRouter.sol +211 -72
- package/contracts/router/{ActionCallback.sol → base/ActionBaseCallback.sol} +47 -47
- package/contracts/router/base/ActionBaseMintRedeem.sol +105 -60
- package/contracts/router/base/CallbackHelper.sol +137 -44
- package/contracts/router/base/MarketApproxLib.sol +227 -350
- package/contracts/router/swap-aggregator/1inch/I1inchAggregationRouterV5.sol +45 -0
- package/contracts/router/swap-aggregator/1inch/OneInchAggregationRouterHelper.sol +69 -0
- package/contracts/router/swap-aggregator/IPSwapAggregator.sol +25 -0
- package/contracts/router/swap-aggregator/PendleSwapAggregator.sol +46 -0
- package/contracts/router/swap-aggregator/kyberswap/KyberAggregationRouterHelper.sol +214 -0
- package/contracts/router/swap-aggregator/kyberswap/ScaleDataHelperEthereum1.sol +147 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IAggregationExecutor.sol +17 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IExecutorHelperEthereum1.sol +191 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IHashflow.sol +30 -0
- package/contracts/router/swap-aggregator/kyberswap/interfaces/IMetaAggregationRouterV2.sol +42 -0
- package/deployments/43113-core.json +30 -0
- package/deployments/43113-markets/APE-30-MARCH.json +10 -0
- package/deployments/43113-markets/USDC-FEB-2ND-2024.json +10 -0
- package/deployments/43113-markets/USDC-FEB-2ND.json +10 -0
- package/deployments/43113-markets/USDC-FEB-4TH.json +10 -0
- package/deployments/43113-markets/WETH-FEB-2ND.json +11 -0
- package/deployments/43113-markets/WETH-FEB-4TH.json +11 -0
- package/deployments/43113-offchain-helper.json +4 -0
- package/deployments/43113-testenv.json +22 -0
- package/deployments/80001-core.json +29 -0
- package/deployments/80001-markets/GLP-DEC-8TH.json +10 -0
- package/deployments/80001-markets/USDC-DEC-8TH.json +10 -0
- package/deployments/80001-markets/USDC-FEB-4TH.json +10 -0
- package/deployments/80001-markets/WETH-FEB-4TH.json +11 -0
- package/deployments/80001-offchain-helper.json +4 -0
- package/deployments/80001-testenv.json +22 -0
- package/package.json +9 -10
- package/typechain-types/ActionAddRemoveLiq.ts +203 -23
- package/typechain-types/ActionBaseCallback.ts +115 -0
- package/typechain-types/ActionMintRedeem.ts +29 -230
- package/typechain-types/ActionMisc.ts +77 -27
- package/typechain-types/ActionSwapPT.ts +26 -31
- package/typechain-types/ActionSwapYT.ts +202 -21
- package/typechain-types/AddressProvider.ts +280 -0
- package/typechain-types/ComposableStablePreview.ts +217 -0
- package/typechain-types/GLPPreviewHelper.ts +121 -0
- package/typechain-types/GMXPreviewHelper.ts +121 -0
- package/typechain-types/I1inchAggregationRouterV5.ts +257 -0
- package/typechain-types/IAddressProvider.ts +123 -0
- package/typechain-types/IAggregationExecutor.ts +182 -0
- package/typechain-types/IBalancerFees.ts +89 -0
- package/typechain-types/IBalancerStablePreview.ts +217 -0
- package/typechain-types/IBasePool.ts +482 -0
- package/typechain-types/IComposableStable.ts +730 -0
- package/typechain-types/IDiamondCut.ts +152 -0
- package/typechain-types/IDiamondLoupe.ts +190 -0
- package/typechain-types/IExecutorHelperEthereum1.ts +643 -0
- package/typechain-types/IGMXVault.ts +494 -0
- package/typechain-types/IGauge.ts +160 -0
- package/typechain-types/IGlpManager.ts +115 -0
- package/typechain-types/IHashflow.ts +159 -0
- package/typechain-types/IKyberSwapAggregationRouterHelper.ts +109 -0
- package/typechain-types/ILiquidityGaugeFactory.ts +99 -0
- package/typechain-types/IMetaAggregationRouter.ts +213 -0
- package/typechain-types/IMetaAggregationRouterV2.ts +221 -0
- package/typechain-types/IMetaStablePool.ts +619 -0
- package/typechain-types/IPActionAddRemoveLiq.ts +213 -14
- package/typechain-types/IPActionMintRedeem.ts +29 -211
- package/typechain-types/IPActionMisc.ts +77 -27
- package/typechain-types/IPActionSwapPT.ts +26 -12
- package/typechain-types/IPActionSwapYT.ts +168 -12
- package/typechain-types/IPAllAction.ts +445 -227
- package/typechain-types/IPFeeDistributor.ts +18 -0
- package/typechain-types/IPInterestManagerYTV2.ts +117 -0
- package/typechain-types/IPMsgReceiverApp.ts +5 -5
- package/typechain-types/IPSwapAggregator.ts +126 -0
- package/typechain-types/IPYieldTokenV2.ts +901 -0
- package/typechain-types/IRateProvider.ts +81 -0
- package/typechain-types/IRewardRouterV2.ts +346 -0
- package/typechain-types/IRewards.ts +35 -5
- package/typechain-types/ISwapAggregator.ts +124 -0
- package/typechain-types/IVault.ts +410 -0
- package/typechain-types/IVaultPriceFeed.ts +114 -0
- package/typechain-types/InterestManagerYTV2.ts +157 -0
- package/typechain-types/MetaStableMath.ts +113 -0
- package/typechain-types/MetaStablePreview.ts +501 -0
- package/typechain-types/Multicall2.ts +437 -0
- package/typechain-types/PendleAura3EthSY.ts +1600 -0
- package/typechain-types/PendleAuraBalancerStableLPSY.ts +1523 -0
- package/typechain-types/PendleAuraCbethWstethSY.ts +1587 -0
- package/typechain-types/PendleAuraWethRethSY.ts +1549 -0
- package/typechain-types/PendleAuraWethWstethSY.ts +1523 -0
- package/typechain-types/PendleConvexLPSY.ts +204 -0
- package/typechain-types/PendleCurveFraxUsdcSY.ts +204 -0
- package/typechain-types/PendleCurveUsdd3CrvSY.ts +204 -0
- package/typechain-types/PendleFeeDistributor.ts +37 -0
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +4 -4
- package/typechain-types/PendleGlpSY.ts +1463 -0
- package/typechain-types/PendleLooksStakingSY.ts +204 -0
- package/typechain-types/PendleMsgReceiverAppUpg.ts +5 -5
- package/typechain-types/PendleMulticall.ts +110 -0
- package/typechain-types/PendlePrincipalTokenV2.ts +614 -0
- package/typechain-types/PendleQiTokenSY.ts +204 -0
- package/typechain-types/PendleRouter.ts +109 -131
- package/typechain-types/PendleSwapAggregator.ts +126 -0
- package/typechain-types/PendleWstEthSY.ts +204 -0
- package/typechain-types/PendleYieldContractFactoryV2.ts +801 -0
- package/typechain-types/PendleYieldTokenV2.ts +1298 -0
- package/typechain-types/RouterStatic.ts +92 -0
- package/typechain-types/SAPE.ts +204 -0
- package/typechain-types/SYBase.ts +204 -0
- package/typechain-types/SYBaseWithRewards.ts +204 -0
- package/typechain-types/StEthHelper.ts +107 -0
- package/typechain-types/StablePreviewBase.ts +217 -0
- package/typechain-types/SwapAggregator.ts +406 -0
- package/typechain-types/VotingEscrowPendleSidechain.ts +4 -5
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +346 -68
- package/typechain-types/factories/ActionBaseCallback__factory.ts +156 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +108 -266
- package/typechain-types/factories/ActionMisc__factory.ts +56 -17
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +55 -71
- package/typechain-types/factories/ActionSwapYT__factory.ts +356 -48
- package/typechain-types/factories/AddressProvider__factory.ts +196 -0
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerFactory__factory.ts +1 -1
- package/typechain-types/factories/BulkSellerOffchain__factory.ts +1 -1
- package/typechain-types/factories/BulkSeller__factory.ts +1 -1
- package/typechain-types/factories/ComposableStablePreview__factory.ts +190 -0
- package/typechain-types/factories/Errors__factory.ts +86 -1
- package/typechain-types/factories/GLPPreviewHelper__factory.ts +65 -0
- package/typechain-types/factories/GMXPreviewHelper__factory.ts +65 -0
- package/typechain-types/factories/I1inchAggregationRouterV5__factory.ts +179 -0
- package/typechain-types/factories/IAddressProvider__factory.ts +63 -0
- package/typechain-types/factories/IAggregationExecutor__factory.ts +84 -0
- package/typechain-types/factories/IBalancerFees__factory.ts +36 -0
- package/typechain-types/factories/IBalancerStablePreview__factory.ts +152 -0
- package/typechain-types/factories/IBasePool__factory.ts +340 -0
- package/typechain-types/factories/IComposableStable__factory.ts +482 -0
- package/typechain-types/factories/IDiamondCut__factory.ts +105 -0
- package/typechain-types/factories/IDiamondLoupe__factory.ts +99 -0
- package/typechain-types/factories/IExecutorHelperEthereum1__factory.ts +407 -0
- package/typechain-types/factories/IGMXVault__factory.ts +320 -0
- package/typechain-types/factories/IGauge__factory.ts +70 -0
- package/typechain-types/factories/IGlpManager__factory.ts +55 -0
- package/typechain-types/factories/IHashflow__factory.ts +113 -0
- package/typechain-types/factories/IKyberSwapAggregationRouterHelper__factory.ts +56 -0
- package/typechain-types/factories/ILiquidityGaugeFactory__factory.ts +49 -0
- package/typechain-types/factories/IMetaAggregationRouterV2__factory.ts +234 -0
- package/typechain-types/factories/IMetaAggregationRouter__factory.ts +202 -0
- package/typechain-types/factories/IMetaStablePool__factory.ts +413 -0
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +338 -16
- package/typechain-types/factories/IPActionMintRedeem__factory.ts +105 -224
- package/typechain-types/factories/IPActionMisc__factory.ts +55 -11
- package/typechain-types/factories/IPActionSwapPT__factory.ts +52 -8
- package/typechain-types/factories/IPActionSwapYT__factory.ts +231 -8
- package/typechain-types/factories/IPAllAction__factory.ts +675 -241
- package/typechain-types/factories/IPFeeDistributor__factory.ts +19 -0
- package/typechain-types/factories/IPInterestManagerYTV2__factory.ts +59 -0
- package/typechain-types/factories/IPMsgReceiverApp__factory.ts +1 -1
- package/typechain-types/factories/IPSwapAggregator__factory.ts +71 -0
- package/typechain-types/factories/IPYieldTokenV2__factory.ts +694 -0
- package/typechain-types/factories/IRateProvider__factory.ts +36 -0
- package/typechain-types/factories/IRewardRouterV2__factory.ts +216 -0
- package/typechain-types/factories/IRewards__factory.ts +18 -0
- package/typechain-types/factories/ISwapAggregator__factory.ts +66 -0
- package/typechain-types/factories/IVaultPriceFeed__factory.ts +60 -0
- package/typechain-types/factories/IVault__factory.ts +287 -0
- package/typechain-types/factories/InterestManagerYTV2__factory.ts +81 -0
- package/typechain-types/factories/MarketMathStatic__factory.ts +1 -27
- package/typechain-types/factories/MetaStableMath__factory.ts +93 -0
- package/typechain-types/factories/MetaStablePreview__factory.ts +375 -0
- package/typechain-types/factories/Multicall2__factory.ts +372 -0
- package/typechain-types/factories/OracleLib__factory.ts +1 -1
- package/typechain-types/factories/PendleAura3EthSY__factory.ts +1326 -0
- package/typechain-types/factories/PendleAuraBalancerStableLPSY__factory.ts +1190 -0
- package/typechain-types/factories/PendleAuraCbethWstethSY__factory.ts +1317 -0
- package/typechain-types/factories/PendleAuraWethRethSY__factory.ts +1291 -0
- package/typechain-types/factories/PendleAuraWethWstethSY__factory.ts +1265 -0
- package/typechain-types/factories/PendleConvexLPSY__factory.ts +141 -0
- package/typechain-types/factories/PendleCurveFraxUsdcSY__factory.ts +142 -1
- package/typechain-types/factories/PendleCurveUsdd3CrvSY__factory.ts +142 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +33 -1
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +2 -2
- package/typechain-types/factories/PendleGlpSY__factory.ts +1249 -0
- package/typechain-types/factories/PendleLooksStakingSY__factory.ts +142 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgReceiverAppUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMulticall__factory.ts +100 -0
- package/typechain-types/factories/PendlePrincipalTokenV2__factory.ts +564 -0
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSY__factory.ts +142 -1
- package/typechain-types/factories/PendleRouter__factory.ts +75 -74
- package/typechain-types/factories/PendleSwapAggregator__factory.ts +129 -0
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleWstEthSY__factory.ts +142 -1
- package/typechain-types/factories/PendleYieldContractFactoryV2__factory.ts +674 -0
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldTokenV2__factory.ts +1109 -0
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +69 -1
- package/typechain-types/factories/SAPE__factory.ts +142 -1
- package/typechain-types/factories/SYBaseWithRewards__factory.ts +141 -0
- package/typechain-types/factories/SYBase__factory.ts +141 -0
- package/typechain-types/factories/StEthHelper__factory.ts +62 -0
- package/typechain-types/factories/StablePreviewBase__factory.ts +148 -0
- package/typechain-types/factories/SwapAggregator__factory.ts +309 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +2 -2
- package/typechain-types/hardhat.d.ts +369 -54
- package/typechain-types/index.ts +88 -18
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +0 -190
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.dbg.json +0 -4
- package/build/artifacts/contracts/router/ActionCallback.sol/ActionCallback.json +0 -165
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +0 -4
- package/build/artifacts/contracts/router/ActionSwapPTYT.sol/ActionSwapPTYT.json +0 -343
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +0 -4
- package/build/artifacts/contracts/router/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +0 -224
- package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.dbg.json +0 -4
- package/build/artifacts/contracts/router/kyberswap/IAggregatorRouterHelper.sol/IAggregationRouterHelper.json +0 -35
- package/build/artifacts/contracts/router/kyberswap/IMultihopRouterEthereum.sol/IMultihopRouterEthereum.dbg.json +0 -4
- package/build/artifacts/contracts/router/kyberswap/IMultihopRouterEthereum.sol/IMultihopRouterEthereum.json +0 -136
- package/build/artifacts/contracts/router/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +0 -4
- package/contracts/interfaces/IBoringOwnableUpgradeable.sol +0 -10
- package/contracts/interfaces/IPActionSwapPTYT.sol +0 -31
- package/contracts/router/ActionSwapPTYT.sol +0 -108
- package/contracts/router/kyberswap/AggregationRouterHelper.sol +0 -331
- package/contracts/router/kyberswap/IAggregatorRouterHelper.sol +0 -10
- package/contracts/router/kyberswap/IMultihopRouterEthereum.sol +0 -141
- package/contracts/router/kyberswap/KyberSwapHelper.sol +0 -79
- package/deployments/1-core.json +0 -30
- package/deployments/1-markets/APE-JUNE-29.json +0 -8
- package/deployments/1-markets/FRAXUSDC-CURVELP-MARCH30.json +0 -11
- package/deployments/1-markets/LOOKS-STAKING-MARCH30.json +0 -10
- package/deployments/1-markets/STETH-JUNE29.json +0 -10
- package/deployments/1-markets/STETH-MARCH30.json +0 -10
|
@@ -0,0 +1,329 @@
|
|
|
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
|
+
|
|
6
|
+
import "../../../../../interfaces/Balancer/IVault.sol";
|
|
7
|
+
import "../../../../../interfaces/Balancer/IRateProvider.sol";
|
|
8
|
+
import "../../../../../interfaces/Balancer/IBasePool.sol";
|
|
9
|
+
import "../../../../../interfaces/Balancer/IBalancerStablePreview.sol";
|
|
10
|
+
import "../../../../../interfaces/ConvexCurve/IBooster.sol";
|
|
11
|
+
import "../../../../../interfaces/ConvexCurve/IRewards.sol";
|
|
12
|
+
|
|
13
|
+
import "./StablePoolUserData.sol";
|
|
14
|
+
import "../../../../libraries/ArrayLib.sol";
|
|
15
|
+
import "../../../SYBaseWithRewards.sol";
|
|
16
|
+
|
|
17
|
+
abstract contract PendleAuraBalancerStableLPSY is SYBaseWithRewards {
|
|
18
|
+
using ArrayLib for address[];
|
|
19
|
+
|
|
20
|
+
address public constant BAL_TOKEN = 0xba100000625a3754423978a60c9317c58a424e3D;
|
|
21
|
+
address public constant AURA_TOKEN = 0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF;
|
|
22
|
+
address public constant AURA_BOOSTER = 0xA57b8d98dAE62B26Ec3bcC4a365338157060B234;
|
|
23
|
+
address public constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;
|
|
24
|
+
|
|
25
|
+
address public immutable balLp;
|
|
26
|
+
bytes32 public immutable balPoolId;
|
|
27
|
+
|
|
28
|
+
uint256 public immutable auraPid;
|
|
29
|
+
address public immutable auraRewardManager;
|
|
30
|
+
|
|
31
|
+
IBalancerStablePreview public immutable previewHelper;
|
|
32
|
+
|
|
33
|
+
address[] public extraRewards;
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
string memory _name,
|
|
37
|
+
string memory _symbol,
|
|
38
|
+
address _balLp,
|
|
39
|
+
uint256 _auraPid,
|
|
40
|
+
IBalancerStablePreview _previewHelper
|
|
41
|
+
) SYBaseWithRewards(_name, _symbol, _balLp) {
|
|
42
|
+
balPoolId = IBasePool(_balLp).getPoolId();
|
|
43
|
+
auraPid = _auraPid;
|
|
44
|
+
|
|
45
|
+
(balLp, auraRewardManager) = _getPoolInfo(_auraPid);
|
|
46
|
+
if (balLp != _balLp) revert Errors.SYBalancerInvalidPid();
|
|
47
|
+
|
|
48
|
+
_safeApproveInf(_balLp, AURA_BOOSTER);
|
|
49
|
+
|
|
50
|
+
address[] memory tokens = _getPoolTokenAddresses();
|
|
51
|
+
for (uint256 i = 0; i < tokens.length; ++i) {
|
|
52
|
+
_safeApproveInf(tokens[i], BALANCER_VAULT);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
previewHelper = _previewHelper;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _getPoolInfo(uint256 _auraPid)
|
|
59
|
+
internal
|
|
60
|
+
view
|
|
61
|
+
returns (address _auraLp, address _auraRewardManager)
|
|
62
|
+
{
|
|
63
|
+
if (_auraPid > IBooster(AURA_BOOSTER).poolLength()) revert Errors.SYBalancerInvalidPid();
|
|
64
|
+
(_auraLp, , , _auraRewardManager, , ) = IBooster(AURA_BOOSTER).poolInfo(_auraPid);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*///////////////////////////////////////////////////////////////
|
|
68
|
+
DEPOSIT/REDEEM USING BASE TOKENS
|
|
69
|
+
//////////////////////////////////////////////////////////////*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @notice Either wraps LP, or also joins pool using exact tokenIn
|
|
73
|
+
*/
|
|
74
|
+
function _deposit(address tokenIn, uint256 amount)
|
|
75
|
+
internal
|
|
76
|
+
virtual
|
|
77
|
+
override
|
|
78
|
+
returns (uint256 amountSharesOut)
|
|
79
|
+
{
|
|
80
|
+
if (tokenIn == balLp) {
|
|
81
|
+
amountSharesOut = amount;
|
|
82
|
+
} else {
|
|
83
|
+
amountSharesOut = _depositToBalancer(tokenIn, amount);
|
|
84
|
+
}
|
|
85
|
+
IBooster(AURA_BOOSTER).deposit(auraPid, amountSharesOut, true);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @notice Either unwraps LP, or also exits pool using exact LP for only `tokenOut`
|
|
90
|
+
*/
|
|
91
|
+
function _redeem(
|
|
92
|
+
address receiver,
|
|
93
|
+
address tokenOut,
|
|
94
|
+
uint256 amountSharesToRedeem
|
|
95
|
+
) internal virtual override returns (uint256 amountTokenOut) {
|
|
96
|
+
IRewards(auraRewardManager).withdrawAndUnwrap(amountSharesToRedeem, false);
|
|
97
|
+
|
|
98
|
+
if (tokenOut == balLp) {
|
|
99
|
+
amountTokenOut = amountSharesToRedeem;
|
|
100
|
+
_transferOut(tokenOut, receiver, amountTokenOut);
|
|
101
|
+
} else {
|
|
102
|
+
amountTokenOut = _redeemFromBalancer(receiver, tokenOut, amountSharesToRedeem);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function exchangeRate() external view override returns (uint256) {
|
|
107
|
+
return IRateProvider(balLp).getRate();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/*///////////////////////////////////////////////////////////////
|
|
111
|
+
BALANCER-RELATED FUNCTIONS
|
|
112
|
+
//////////////////////////////////////////////////////////////*/
|
|
113
|
+
|
|
114
|
+
function _depositToBalancer(address tokenIn, uint256 amountTokenToDeposit)
|
|
115
|
+
internal
|
|
116
|
+
virtual
|
|
117
|
+
returns (uint256)
|
|
118
|
+
{
|
|
119
|
+
IVault.JoinPoolRequest memory request = _assembleJoinRequest(
|
|
120
|
+
tokenIn,
|
|
121
|
+
amountTokenToDeposit
|
|
122
|
+
);
|
|
123
|
+
IVault(BALANCER_VAULT).joinPool(balPoolId, address(this), address(this), request);
|
|
124
|
+
|
|
125
|
+
// amount shares out = amount LP received
|
|
126
|
+
return _selfBalance(balLp);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function _assembleJoinRequest(address tokenIn, uint256 amountTokenToDeposit)
|
|
130
|
+
internal
|
|
131
|
+
view
|
|
132
|
+
virtual
|
|
133
|
+
returns (IVault.JoinPoolRequest memory request)
|
|
134
|
+
{
|
|
135
|
+
// max amounts in
|
|
136
|
+
address[] memory assets = _getPoolTokenAddresses();
|
|
137
|
+
|
|
138
|
+
uint256 amountsLength = _getBPTIndex() < type(uint256).max
|
|
139
|
+
? assets.length - 1
|
|
140
|
+
: assets.length;
|
|
141
|
+
|
|
142
|
+
uint256[] memory amountsIn = new uint256[](amountsLength);
|
|
143
|
+
uint256[] memory maxAmountsIn = new uint256[](assets.length);
|
|
144
|
+
|
|
145
|
+
uint256 index = assets.find(tokenIn);
|
|
146
|
+
uint256 indexSkipBPT = index > _getBPTIndex() ? index - 1 : index;
|
|
147
|
+
maxAmountsIn[index] = amountsIn[indexSkipBPT] = amountTokenToDeposit;
|
|
148
|
+
|
|
149
|
+
// encode user data
|
|
150
|
+
StablePoolUserData.JoinKind joinKind = StablePoolUserData
|
|
151
|
+
.JoinKind
|
|
152
|
+
.EXACT_TOKENS_IN_FOR_BPT_OUT;
|
|
153
|
+
uint256 minimumBPT = 0;
|
|
154
|
+
|
|
155
|
+
bytes memory userData = abi.encode(joinKind, amountsIn, minimumBPT);
|
|
156
|
+
|
|
157
|
+
// assemble joinpoolrequest
|
|
158
|
+
request = IVault.JoinPoolRequest(assets, maxAmountsIn, userData, false);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function _redeemFromBalancer(
|
|
162
|
+
address receiver,
|
|
163
|
+
address tokenOut,
|
|
164
|
+
uint256 amountLpToRedeem
|
|
165
|
+
) internal virtual returns (uint256) {
|
|
166
|
+
uint256 balanceBefore = IERC20(tokenOut).balanceOf(receiver);
|
|
167
|
+
|
|
168
|
+
IVault.ExitPoolRequest memory request = _assembleExitRequest(tokenOut, amountLpToRedeem);
|
|
169
|
+
IVault(BALANCER_VAULT).exitPool(balPoolId, address(this), payable(receiver), request);
|
|
170
|
+
|
|
171
|
+
// calculate amount of tokens out
|
|
172
|
+
uint256 balanceAfter = IERC20(tokenOut).balanceOf(receiver);
|
|
173
|
+
return balanceAfter - balanceBefore;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function _assembleExitRequest(address tokenOut, uint256 amountLpToRedeem)
|
|
177
|
+
internal
|
|
178
|
+
view
|
|
179
|
+
virtual
|
|
180
|
+
returns (IVault.ExitPoolRequest memory request)
|
|
181
|
+
{
|
|
182
|
+
address[] memory assets = _getPoolTokenAddresses();
|
|
183
|
+
uint256[] memory minAmountsOut = new uint256[](assets.length);
|
|
184
|
+
|
|
185
|
+
// encode user data
|
|
186
|
+
StablePoolUserData.ExitKind exitKind = StablePoolUserData
|
|
187
|
+
.ExitKind
|
|
188
|
+
.EXACT_BPT_IN_FOR_ONE_TOKEN_OUT;
|
|
189
|
+
uint256 bptAmountIn = amountLpToRedeem;
|
|
190
|
+
uint256 exitTokenIndex = assets.find(tokenOut);
|
|
191
|
+
|
|
192
|
+
// must drop BPT index as well
|
|
193
|
+
exitTokenIndex = _getBPTIndex() < exitTokenIndex ? exitTokenIndex - 1 : exitTokenIndex;
|
|
194
|
+
|
|
195
|
+
bytes memory userData = abi.encode(exitKind, bptAmountIn, exitTokenIndex);
|
|
196
|
+
|
|
197
|
+
// assemble exitpoolrequest
|
|
198
|
+
request = IVault.ExitPoolRequest(assets, minAmountsOut, userData, false);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/// @dev this should return tokens in the same order as `IVault.getPoolTokens()`
|
|
202
|
+
function _getPoolTokenAddresses() internal view virtual returns (address[] memory res);
|
|
203
|
+
|
|
204
|
+
/// @dev should be overriden if and only if BPT is one of the pool tokens
|
|
205
|
+
function _getBPTIndex() internal view virtual returns (uint256) {
|
|
206
|
+
return type(uint256).max;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/*///////////////////////////////////////////////////////////////
|
|
210
|
+
PREVIEW FUNCTIONS
|
|
211
|
+
//////////////////////////////////////////////////////////////*/
|
|
212
|
+
|
|
213
|
+
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
214
|
+
internal
|
|
215
|
+
view
|
|
216
|
+
virtual
|
|
217
|
+
override
|
|
218
|
+
returns (uint256 amountSharesOut)
|
|
219
|
+
{
|
|
220
|
+
if (tokenIn == balLp) {
|
|
221
|
+
amountSharesOut = amountTokenToDeposit;
|
|
222
|
+
} else {
|
|
223
|
+
IVault.JoinPoolRequest memory request = _assembleJoinRequest(
|
|
224
|
+
tokenIn,
|
|
225
|
+
amountTokenToDeposit
|
|
226
|
+
);
|
|
227
|
+
amountSharesOut = previewHelper.joinPoolPreview(
|
|
228
|
+
balPoolId,
|
|
229
|
+
address(this),
|
|
230
|
+
address(this),
|
|
231
|
+
request,
|
|
232
|
+
_getImmutablePoolData()
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function _previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
238
|
+
internal
|
|
239
|
+
view
|
|
240
|
+
virtual
|
|
241
|
+
override
|
|
242
|
+
returns (uint256 amountTokenOut)
|
|
243
|
+
{
|
|
244
|
+
if (tokenOut == balLp) {
|
|
245
|
+
amountTokenOut = amountSharesToRedeem;
|
|
246
|
+
} else {
|
|
247
|
+
IVault.ExitPoolRequest memory request = _assembleExitRequest(
|
|
248
|
+
tokenOut,
|
|
249
|
+
amountSharesToRedeem
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
amountTokenOut = previewHelper.exitPoolPreview(
|
|
253
|
+
balPoolId,
|
|
254
|
+
address(this),
|
|
255
|
+
address(this),
|
|
256
|
+
request,
|
|
257
|
+
_getImmutablePoolData()
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function _getImmutablePoolData() internal view virtual returns (bytes memory);
|
|
263
|
+
|
|
264
|
+
/*///////////////////////////////////////////////////////////////
|
|
265
|
+
REWARDS-RELATED
|
|
266
|
+
//////////////////////////////////////////////////////////////*/
|
|
267
|
+
|
|
268
|
+
/// @notice allows owner to add new reward tokens in in case Aura does so with their pools
|
|
269
|
+
function addRewardTokens(address token) external virtual onlyOwner {
|
|
270
|
+
if (token == BAL_TOKEN || token == AURA_TOKEN || extraRewards.contains(token))
|
|
271
|
+
revert Errors.SYInvalidRewardToken(token);
|
|
272
|
+
|
|
273
|
+
uint256 nRewardsAura = IRewards(auraRewardManager).extraRewardsLength();
|
|
274
|
+
for (uint256 i = 0; i < nRewardsAura; i++) {
|
|
275
|
+
if (token == IRewards(IRewards(auraRewardManager).extraRewards(i)).rewardToken()) {
|
|
276
|
+
extraRewards.push(token);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
revert Errors.SYInvalidRewardToken(token);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function extraRewardsLength() external view virtual returns (uint256) {
|
|
285
|
+
return extraRewards.length;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function _getRewardTokens() internal view virtual override returns (address[] memory res) {
|
|
289
|
+
uint256 extraRewardsLen = extraRewards.length;
|
|
290
|
+
res = new address[](2 + extraRewardsLen);
|
|
291
|
+
res[0] = BAL_TOKEN;
|
|
292
|
+
res[1] = AURA_TOKEN;
|
|
293
|
+
for (uint256 i = 0; i < extraRewardsLen; i++) {
|
|
294
|
+
res[2 + i] = extraRewards[i];
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/// @dev if there is no extra rewards, we can call getReward with the 2nd arg (_claimExtra) to be false
|
|
299
|
+
/// which helps save even more gas
|
|
300
|
+
function _redeemExternalReward() internal virtual override {
|
|
301
|
+
uint256 extraRewardsLen = extraRewards.length;
|
|
302
|
+
if (extraRewardsLen == 0) IRewards(auraRewardManager).getReward(address(this), false);
|
|
303
|
+
else IRewards(auraRewardManager).getReward(address(this), true);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/*///////////////////////////////////////////////////////////////
|
|
307
|
+
MISC FUNCTIONS FOR METADATA
|
|
308
|
+
//////////////////////////////////////////////////////////////*/
|
|
309
|
+
|
|
310
|
+
function getTokensIn() public view virtual override returns (address[] memory res);
|
|
311
|
+
|
|
312
|
+
function getTokensOut() public view virtual override returns (address[] memory res);
|
|
313
|
+
|
|
314
|
+
function isValidTokenIn(address token) public view virtual override returns (bool);
|
|
315
|
+
|
|
316
|
+
function isValidTokenOut(address token) public view virtual override returns (bool);
|
|
317
|
+
|
|
318
|
+
function assetInfo()
|
|
319
|
+
external
|
|
320
|
+
view
|
|
321
|
+
returns (
|
|
322
|
+
AssetType assetType,
|
|
323
|
+
address assetAddress,
|
|
324
|
+
uint8 assetDecimals
|
|
325
|
+
)
|
|
326
|
+
{
|
|
327
|
+
return (AssetType.LIQUIDITY, balLp, IERC20Metadata(balLp).decimals());
|
|
328
|
+
}
|
|
329
|
+
}
|
package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePoolUserData.sol
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
library StablePoolUserData {
|
|
5
|
+
enum JoinKind {
|
|
6
|
+
INIT,
|
|
7
|
+
EXACT_TOKENS_IN_FOR_BPT_OUT,
|
|
8
|
+
TOKEN_IN_FOR_EXACT_BPT_OUT
|
|
9
|
+
}
|
|
10
|
+
enum ExitKind {
|
|
11
|
+
EXACT_BPT_IN_FOR_ONE_TOKEN_OUT,
|
|
12
|
+
BPT_IN_FOR_EXACT_TOKENS_OUT
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function exactTokensInForBptOut(bytes memory self)
|
|
16
|
+
internal
|
|
17
|
+
pure
|
|
18
|
+
returns (uint256[] memory amountsIn, uint256 minBPTAmountOut)
|
|
19
|
+
{
|
|
20
|
+
(, amountsIn, minBPTAmountOut) = abi.decode(self, (JoinKind, uint256[], uint256));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function exactBptInForTokenOut(bytes memory self)
|
|
24
|
+
internal
|
|
25
|
+
pure
|
|
26
|
+
returns (uint256 bptAmountIn, uint256 tokenIndex)
|
|
27
|
+
{
|
|
28
|
+
(, bptAmountIn, tokenIndex) = abi.decode(self, (ExitKind, uint256, uint256));
|
|
29
|
+
}
|
|
30
|
+
}
|
package/contracts/core/StandardizedYield/implementations/BalancerStable/base/StablePreviewBase.sol
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
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 "../../../../../interfaces/Balancer/IVault.sol";
|
|
6
|
+
import "../../../../../interfaces/Balancer/IBalancerFees.sol";
|
|
7
|
+
import "../../../../../interfaces/Balancer/IBalancerStablePreview.sol";
|
|
8
|
+
|
|
9
|
+
abstract contract StablePreviewBase is IBalancerStablePreview {
|
|
10
|
+
address internal constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;
|
|
11
|
+
address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
|
|
12
|
+
address internal constant FEE_COLLECTOR = 0xce88686553686DA562CE7Cea497CE749DA109f9F;
|
|
13
|
+
|
|
14
|
+
enum PoolBalanceChangeKind {
|
|
15
|
+
JOIN,
|
|
16
|
+
EXIT
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
struct PoolBalanceChange {
|
|
20
|
+
IAsset[] assets;
|
|
21
|
+
uint256[] limits;
|
|
22
|
+
bytes userData;
|
|
23
|
+
bool useInternalBalance;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function joinPoolPreview(
|
|
27
|
+
bytes32 poolId,
|
|
28
|
+
address sender,
|
|
29
|
+
address recipient,
|
|
30
|
+
IVault.JoinPoolRequest memory request,
|
|
31
|
+
bytes memory data
|
|
32
|
+
) external view returns (uint256 amountBptOut) {
|
|
33
|
+
amountBptOut = _joinOrExit(
|
|
34
|
+
PoolBalanceChangeKind.JOIN,
|
|
35
|
+
poolId,
|
|
36
|
+
sender,
|
|
37
|
+
payable(recipient),
|
|
38
|
+
_toPoolBalanceChange(request),
|
|
39
|
+
data
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function exitPoolPreview(
|
|
44
|
+
bytes32 poolId,
|
|
45
|
+
address sender,
|
|
46
|
+
address recipient,
|
|
47
|
+
IVault.ExitPoolRequest memory request,
|
|
48
|
+
bytes memory data
|
|
49
|
+
) external view returns (uint256 amountTokenOut) {
|
|
50
|
+
amountTokenOut = _joinOrExit(
|
|
51
|
+
PoolBalanceChangeKind.EXIT,
|
|
52
|
+
poolId,
|
|
53
|
+
sender,
|
|
54
|
+
recipient,
|
|
55
|
+
_toPoolBalanceChange(request),
|
|
56
|
+
data
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _joinOrExit(
|
|
61
|
+
PoolBalanceChangeKind kind,
|
|
62
|
+
bytes32 poolId,
|
|
63
|
+
address sender,
|
|
64
|
+
address recipient,
|
|
65
|
+
PoolBalanceChange memory change,
|
|
66
|
+
bytes memory data
|
|
67
|
+
) private view returns (uint256 amountBptOrTokensOut) {
|
|
68
|
+
IERC20[] memory tokens = _translateToIERC20(change.assets);
|
|
69
|
+
(uint256[] memory balances, uint256 lastChangeBlock) = _validateTokensAndGetBalances(
|
|
70
|
+
poolId,
|
|
71
|
+
tokens
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
amountBptOrTokensOut = _callPoolBalanceChange(
|
|
75
|
+
kind,
|
|
76
|
+
poolId,
|
|
77
|
+
sender,
|
|
78
|
+
recipient,
|
|
79
|
+
change,
|
|
80
|
+
balances,
|
|
81
|
+
lastChangeBlock,
|
|
82
|
+
data
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function _callPoolBalanceChange(
|
|
87
|
+
PoolBalanceChangeKind kind,
|
|
88
|
+
bytes32 poolId,
|
|
89
|
+
address sender,
|
|
90
|
+
address recipient,
|
|
91
|
+
PoolBalanceChange memory change,
|
|
92
|
+
uint256[] memory balances,
|
|
93
|
+
uint256 lastChangeBlock,
|
|
94
|
+
bytes memory data
|
|
95
|
+
) private view returns (uint256 amountsChanged) {
|
|
96
|
+
if (kind == PoolBalanceChangeKind.JOIN) {
|
|
97
|
+
amountsChanged = onJoinPool(
|
|
98
|
+
poolId,
|
|
99
|
+
sender,
|
|
100
|
+
recipient,
|
|
101
|
+
balances,
|
|
102
|
+
lastChangeBlock,
|
|
103
|
+
_getProtocolSwapFeePercentage(),
|
|
104
|
+
change.userData,
|
|
105
|
+
data
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
amountsChanged = onExitPool(
|
|
109
|
+
poolId,
|
|
110
|
+
sender,
|
|
111
|
+
recipient,
|
|
112
|
+
balances,
|
|
113
|
+
lastChangeBlock,
|
|
114
|
+
_getProtocolSwapFeePercentage(),
|
|
115
|
+
change.userData,
|
|
116
|
+
data
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function _getProtocolSwapFeePercentage() private view returns (uint256) {
|
|
122
|
+
return IBalancerFees(FEE_COLLECTOR).getSwapFeePercentage();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function _validateTokensAndGetBalances(
|
|
126
|
+
bytes32 poolId,
|
|
127
|
+
IERC20[] memory //expectedTokens
|
|
128
|
+
) private view returns (uint256[] memory, uint256) {
|
|
129
|
+
(, uint256[] memory balances, uint256 lastChangeBlock) = IVault(BALANCER_VAULT)
|
|
130
|
+
.getPoolTokens(poolId);
|
|
131
|
+
return (balances, lastChangeBlock);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function _translateToIERC20(IAsset[] memory assets) internal pure returns (IERC20[] memory) {
|
|
135
|
+
IERC20[] memory tokens = new IERC20[](assets.length);
|
|
136
|
+
for (uint256 i = 0; i < assets.length; ++i) {
|
|
137
|
+
tokens[i] = _translateToIERC20(assets[i]);
|
|
138
|
+
}
|
|
139
|
+
return tokens;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function _translateToIERC20(IAsset asset) internal pure returns (IERC20) {
|
|
143
|
+
return address(asset) == address(0) ? IERC20(WETH) : IERC20(address(asset));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function _toPoolBalanceChange(IVault.JoinPoolRequest memory request)
|
|
147
|
+
private
|
|
148
|
+
pure
|
|
149
|
+
returns (PoolBalanceChange memory change)
|
|
150
|
+
{
|
|
151
|
+
// solhint-disable-next-line no-inline-assembly
|
|
152
|
+
assembly {
|
|
153
|
+
change := request
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function _toPoolBalanceChange(IVault.ExitPoolRequest memory request)
|
|
158
|
+
private
|
|
159
|
+
pure
|
|
160
|
+
returns (PoolBalanceChange memory change)
|
|
161
|
+
{
|
|
162
|
+
// solhint-disable-next-line no-inline-assembly
|
|
163
|
+
assembly {
|
|
164
|
+
change := request
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function onJoinPool(
|
|
169
|
+
bytes32 poolId,
|
|
170
|
+
address sender,
|
|
171
|
+
address recipient,
|
|
172
|
+
uint256[] memory balances,
|
|
173
|
+
uint256 lastChangeBlock,
|
|
174
|
+
uint256 protocolSwapFeePercentage,
|
|
175
|
+
bytes memory userData,
|
|
176
|
+
bytes memory data
|
|
177
|
+
) internal view virtual returns (uint256 bptAmountOut);
|
|
178
|
+
|
|
179
|
+
function onExitPool(
|
|
180
|
+
bytes32 poolId,
|
|
181
|
+
address sender,
|
|
182
|
+
address recipient,
|
|
183
|
+
uint256[] memory balances,
|
|
184
|
+
uint256 lastChangeBlock,
|
|
185
|
+
uint256 protocolSwapFeePercentage,
|
|
186
|
+
bytes memory userData,
|
|
187
|
+
bytes memory data
|
|
188
|
+
) internal view virtual returns (uint256 amountTokenOut);
|
|
189
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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 "../../../../interfaces/GMX/IGMXVault.sol";
|
|
6
|
+
import "../../../../interfaces/GMX/IVaultPriceFeed.sol";
|
|
7
|
+
|
|
8
|
+
abstract contract GLPPreviewHelper {
|
|
9
|
+
// Based on Vault functions
|
|
10
|
+
|
|
11
|
+
IGMXVault public immutable vault;
|
|
12
|
+
address internal immutable usdg;
|
|
13
|
+
uint256 public constant PRICE_PRECISION = 10**30;
|
|
14
|
+
uint256 public constant BASIS_POINTS_DIVISOR = 10000;
|
|
15
|
+
|
|
16
|
+
constructor(address _vaultAddress) {
|
|
17
|
+
vault = IGMXVault(_vaultAddress);
|
|
18
|
+
usdg = vault.usdg();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function _buyUSDG(address _token, uint256 tokenAmount) internal view returns (uint256) {
|
|
22
|
+
tokenAmount = __transferIn(_token, tokenAmount);
|
|
23
|
+
assert(tokenAmount > 0);
|
|
24
|
+
|
|
25
|
+
uint256 price = vault.getMinPrice(_token);
|
|
26
|
+
|
|
27
|
+
uint256 usdgAmount = (tokenAmount * price) / PRICE_PRECISION;
|
|
28
|
+
usdgAmount = vault.adjustForDecimals(usdgAmount, _token, usdg);
|
|
29
|
+
require(usdgAmount > 0, "preview buyUSDG: usdgAmount must be > 0");
|
|
30
|
+
|
|
31
|
+
uint256 feeBasisPoints = __getFeeBasisPoints(
|
|
32
|
+
_token,
|
|
33
|
+
usdgAmount,
|
|
34
|
+
0,
|
|
35
|
+
vault.mintBurnFeeBasisPoints(),
|
|
36
|
+
vault.taxBasisPoints(),
|
|
37
|
+
true
|
|
38
|
+
);
|
|
39
|
+
uint256 amountAfterFees = __collectSwapFees(_token, tokenAmount, feeBasisPoints);
|
|
40
|
+
uint256 mintAmount = (amountAfterFees * price) / PRICE_PRECISION;
|
|
41
|
+
mintAmount = vault.adjustForDecimals(mintAmount, _token, usdg);
|
|
42
|
+
|
|
43
|
+
return mintAmount;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _sellUSDG(address _token, uint256 usdgAmount) internal view returns (uint256) {
|
|
47
|
+
usdgAmount = __transferIn(usdg, usdgAmount);
|
|
48
|
+
assert(usdgAmount > 0);
|
|
49
|
+
|
|
50
|
+
uint256 redemptionAmount = vault.getRedemptionAmount(_token, usdgAmount);
|
|
51
|
+
require(redemptionAmount > 0, "preview sellUSDG: redemptionAmount must be > 0");
|
|
52
|
+
|
|
53
|
+
uint256 feeBasisPoints = __getFeeBasisPoints(
|
|
54
|
+
_token,
|
|
55
|
+
usdgAmount,
|
|
56
|
+
usdgAmount,
|
|
57
|
+
vault.mintBurnFeeBasisPoints(),
|
|
58
|
+
vault.taxBasisPoints(),
|
|
59
|
+
false
|
|
60
|
+
);
|
|
61
|
+
uint256 amountOut = __collectSwapFees(_token, redemptionAmount, feeBasisPoints);
|
|
62
|
+
require(amountOut > 0, "preview sellUSDG: amountOut must be > 0");
|
|
63
|
+
|
|
64
|
+
return amountOut;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function __transferIn(address _token, uint256 _amount) private view returns (uint256) {
|
|
68
|
+
uint256 prevBalance = vault.tokenBalances(_token);
|
|
69
|
+
uint256 nextBalance = IERC20(_token).balanceOf(address(vault)) + _amount;
|
|
70
|
+
|
|
71
|
+
return nextBalance - prevBalance;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function __collectSwapFees(
|
|
75
|
+
address, /*_token*/
|
|
76
|
+
uint256 _amount,
|
|
77
|
+
uint256 _feeBasisPoints
|
|
78
|
+
) private pure returns (uint256) {
|
|
79
|
+
uint256 afterFeeAmount = (_amount * (BASIS_POINTS_DIVISOR - _feeBasisPoints)) /
|
|
80
|
+
(BASIS_POINTS_DIVISOR);
|
|
81
|
+
return afterFeeAmount;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function __getFeeBasisPoints(
|
|
85
|
+
address _token,
|
|
86
|
+
uint256 _usdgDelta,
|
|
87
|
+
uint256 _burnedUsdg,
|
|
88
|
+
uint256 _feeBasisPoints,
|
|
89
|
+
uint256 _taxBasisPoints,
|
|
90
|
+
bool _increment
|
|
91
|
+
) private view returns (uint256) {
|
|
92
|
+
if (!vault.hasDynamicFees()) {
|
|
93
|
+
return _feeBasisPoints;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
uint256 initialAmount = vault.usdgAmounts(_token);
|
|
97
|
+
initialAmount = (initialAmount >= _burnedUsdg) ? initialAmount - _burnedUsdg : 0;
|
|
98
|
+
|
|
99
|
+
uint256 nextAmount = initialAmount + _usdgDelta;
|
|
100
|
+
if (!_increment) {
|
|
101
|
+
nextAmount = _usdgDelta > initialAmount ? 0 : initialAmount - _usdgDelta;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
uint256 targetAmount = __getTargetUsdgAmount(_token, _burnedUsdg);
|
|
105
|
+
if (targetAmount == 0) {
|
|
106
|
+
return _feeBasisPoints;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
uint256 initialDiff = initialAmount > targetAmount
|
|
110
|
+
? initialAmount - targetAmount
|
|
111
|
+
: targetAmount - initialAmount;
|
|
112
|
+
uint256 nextDiff = nextAmount > targetAmount
|
|
113
|
+
? nextAmount - targetAmount
|
|
114
|
+
: targetAmount - nextAmount;
|
|
115
|
+
|
|
116
|
+
// action improves relative asset balance
|
|
117
|
+
if (nextDiff < initialDiff) {
|
|
118
|
+
uint256 rebateBps = (_taxBasisPoints * initialDiff) / targetAmount;
|
|
119
|
+
return rebateBps > _feeBasisPoints ? 0 : _feeBasisPoints - rebateBps;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
uint256 averageDiff = (initialDiff + nextDiff) / 2;
|
|
123
|
+
if (averageDiff > targetAmount) {
|
|
124
|
+
averageDiff = targetAmount;
|
|
125
|
+
}
|
|
126
|
+
uint256 taxBps = (_taxBasisPoints * averageDiff) / targetAmount;
|
|
127
|
+
return _feeBasisPoints + taxBps;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function __getTargetUsdgAmount(address _token, uint256 _burnedUsdg)
|
|
131
|
+
private
|
|
132
|
+
view
|
|
133
|
+
returns (uint256)
|
|
134
|
+
{
|
|
135
|
+
uint256 supply = IERC20(usdg).totalSupply() - _burnedUsdg;
|
|
136
|
+
if (supply == 0) {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
uint256 weight = vault.tokenWeights(_token);
|
|
140
|
+
return (weight * supply) / vault.totalTokenWeights();
|
|
141
|
+
}
|
|
142
|
+
}
|