@pendle/core-v2 0.11.11-testnet → 0.12.1-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/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +2 -2
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +199 -30
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol/Pendle3CrvAndTokenSCY.json +1030 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol/PendleConvexCurveLP2PoolSCY.json +1025 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol/PendleConvexCurveLPSCY.json +948 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol/Pendle3CrvHelper.json +76 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +140 -25
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.json +138 -23
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +138 -23
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +310 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.json → CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.json} +18 -85
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +336 -0
- package/build/artifacts/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json → CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.json} +8 -21
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol/EpochResultManager.json +131 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +297 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol/PendleFeeDistributorFactory.json +376 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +11 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +29 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +40 -86
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +228 -40
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +232 -12
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +164 -47
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +25 -93
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +222 -9
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +106 -5
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +13 -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 +87 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +80 -16
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +164 -2
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +172 -4
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +109 -2
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.json +57 -4
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.json +7 -2
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.json +199 -4
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.json +108 -2
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.json +146 -4
- package/build/artifacts/contracts/core/actions/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IBooster.sol/IBooster.json +177 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICrvDepositor.sol/ICrvDepositor.json +78 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/ICvxCrv.sol/ICvxCrv.json +24 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ConvexCurve/IRewards.sol/IRewards.json +264 -0
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Curve/ICrvPool.sol/ICrvPool.json +305 -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/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 +4 -0
- package/build/artifacts/contracts/interfaces/IBoringOwnableUpgradeable.sol/IBoringOwnableUpgradeable.json +34 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerEToken.sol/IEulerEToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IEulerMarkets.sol/IEulerMarkets.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 +31 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMisc.sol/IPActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.json +30 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.json +10 -0
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.json +30 -0
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +101 -1
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributor.sol/IPFeeDistributor.json +112 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPFeeDistributorFactory.sol/IPFeeDistributorFactory.json +76 -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/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +13 -0
- 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 +4 -0
- package/build/artifacts/contracts/interfaces/IPMsgReceiverApp.sol/IPMsgReceiverApp.json +24 -0
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPMsgSendEndpoint.sol/IPMsgSendEndpoint.json +63 -0
- 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/IPVotingController.sol/IPVotingController.json +148 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPVotingEscrow.sol/IPVotingEscrow.json → IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.json} +88 -2
- 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/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/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +4 -28
- 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/libraries/Errors.sol/Errors.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/Errors.sol/Errors.json +886 -0
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/OracleLib.sol/OracleLib.json +28 -2
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{solmate/SSTORE2.sol/SSTORE2.json → VeHistoryLib.sol/CheckpointHelper.json} +4 -4
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/BaseSplitCodeFactory.json +45 -0
- package/build/artifacts/contracts/libraries/helpers/BaseSplitCodeFactory.sol/CodeDeployer.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/{SSTORE2Deployer.sol/SSTORE2Deployer.json → BaseSplitCodeFactory.sol/CodeDeployer.json} +4 -4
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.json +2 -2
- package/build/artifacts/contracts/libraries/kyberswap/IMultihopRouter.sol/IMultihopRouter.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.json +2 -2
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +167 -0
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +182 -4
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +142 -66
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +3 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +19 -16
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/Pendle3CrvAndTokenSCY.sol +135 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLP2PoolSCY.sol +96 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/ConvexCurveLP/PendleConvexCurveLPSCY.sol +215 -0
- package/contracts/SuperComposableYield/SCY-implementations/Convex/Pendle3CrvHelper.sol +83 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +10 -15
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +30 -43
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +74 -0
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +38 -0
- package/contracts/core/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +83 -0
- package/contracts/core/LiquidityMining/{CelerAbstracts/CelerSenderUpg.sol → CrossChainMsg/PendleMsgSenderAppUpg.sol} +12 -13
- package/contracts/core/LiquidityMining/FeeDistributor/EpochResultManager.sol +159 -0
- package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributor.sol +96 -0
- package/contracts/core/LiquidityMining/FeeDistributor/PendleFeeDistributorFactory.sol +68 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +4 -3
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +6 -2
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +12 -4
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +29 -19
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +27 -19
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +63 -27
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +6 -5
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +2 -2
- package/contracts/core/Market/PendleMarket.sol +26 -24
- package/contracts/core/Market/PendleMarketFactory.sol +41 -20
- package/contracts/core/PendleERC20Permit.sol +84 -0
- package/contracts/core/PendleRouter.sol +2 -1
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +8 -7
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +37 -22
- package/contracts/core/YieldContracts/PendleYieldToken.sol +106 -35
- package/contracts/core/actions/ActionAddRemoveLiq.sol +58 -41
- package/contracts/core/actions/ActionCallback.sol +24 -14
- package/contracts/core/actions/ActionMintRedeem.sol +11 -5
- package/contracts/core/actions/ActionMisc.sol +2 -1
- package/contracts/core/actions/ActionSwapPT.sol +38 -19
- package/contracts/core/actions/ActionSwapPTYT.sol +7 -6
- package/contracts/core/actions/ActionSwapYT.sol +36 -19
- package/contracts/core/actions/base/ActionBaseMintRedeem.sol +15 -8
- package/contracts/interfaces/ConvexCurve/IBooster.sol +32 -0
- package/contracts/interfaces/ConvexCurve/ICrvDepositor.sol +20 -0
- package/contracts/interfaces/ConvexCurve/ICvxCrv.sol +6 -0
- package/contracts/interfaces/ConvexCurve/IRewards.sol +38 -0
- package/contracts/interfaces/Curve/ICrvPool.sol +69 -0
- package/contracts/interfaces/IBoringOwnableUpgradeable.sol +10 -0
- package/contracts/interfaces/IPActionAddRemoveLiq.sol +7 -7
- package/contracts/interfaces/IPActionSwapPT.sol +6 -6
- package/contracts/interfaces/IPActionSwapPTYT.sol +2 -2
- package/contracts/interfaces/IPActionSwapYT.sol +13 -13
- package/contracts/interfaces/IPFeeDistributor.sol +19 -0
- package/contracts/interfaces/IPFeeDistributorFactory.sol +14 -0
- package/contracts/interfaces/IPMarket.sol +2 -0
- package/contracts/interfaces/IPMsgReceiverApp.sol +7 -0
- package/contracts/interfaces/IPMsgSendEndpoint.sol +17 -0
- package/contracts/interfaces/IPVotingController.sol +22 -0
- package/contracts/interfaces/{IPVotingEscrow.sol → IPVotingEscrowMainchain.sol} +11 -1
- package/contracts/interfaces/ISuperComposableYield.sol +2 -7
- package/contracts/libraries/Errors.sol +121 -0
- package/contracts/libraries/OracleLib.sol +6 -3
- package/contracts/libraries/VeBalanceLib.sol +5 -1
- package/contracts/libraries/VeHistoryLib.sol +20 -31
- package/contracts/libraries/helpers/ArrayLib.sol +0 -17
- package/contracts/libraries/helpers/BaseSplitCodeFactory.sol +288 -0
- package/contracts/libraries/helpers/TokenHelper.sol +4 -0
- package/contracts/libraries/kyberswap/AggregationRouterHelper.sol +0 -7
- package/contracts/libraries/math/MarketMathCore.sol +29 -25
- package/contracts/libraries/math/Math.sol +6 -2
- package/contracts/libraries/math/WeekMath.sol +2 -2
- package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +43 -0
- package/contracts/offchain-helpers/MarketMathStatic.sol +36 -36
- package/contracts/offchain-helpers/RouterStatic.sol +53 -37
- package/deployments/43113-core.json +11 -10
- package/deployments/43113-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
- package/deployments/43113-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
- package/deployments/43113-testenv.json +9 -9
- package/deployments/80001-core.json +10 -9
- package/deployments/80001-markets/benqi-market-QI-USDC-FEB-2ND.json +8 -0
- package/deployments/80001-markets/benqi-market-QI-WETH-DEC-1ST.json +8 -0
- package/deployments/80001-testenv.json +16 -16
- package/package.json +1 -1
- package/typechain-types/ActionAddRemoveLiq.ts +18 -6
- package/typechain-types/ActionSwapPT.ts +18 -6
- package/typechain-types/ActionSwapPTYT.ts +6 -2
- package/typechain-types/ActionSwapYT.ts +18 -6
- package/typechain-types/IPActionAddRemoveLiq.ts +19 -7
- package/typechain-types/IPActionSwapPT.ts +18 -6
- package/typechain-types/IPActionSwapPTYT.ts +6 -2
- package/typechain-types/IPActionSwapYT.ts +18 -6
- package/typechain-types/IPAllAction.ts +61 -21
- package/typechain-types/IPBatchSeller.ts +19 -37
- package/typechain-types/IPMarket.ts +13 -0
- package/typechain-types/IPVotingController.ts +244 -7
- package/typechain-types/ISuperComposableYield.ts +7 -46
- package/typechain-types/MarketMathStatic.ts +139 -10
- package/typechain-types/PendleBatchSeller.ts +72 -50
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +28 -149
- package/typechain-types/PendleMarket.ts +104 -0
- package/typechain-types/PendleMarketFactory.ts +76 -13
- package/typechain-types/PendlePrincipalToken.ts +104 -0
- package/typechain-types/PendleQiTokenSCY.ts +111 -46
- package/typechain-types/PendleVotingControllerUpg.ts +133 -77
- package/typechain-types/PendleWstEthSCY.ts +111 -46
- package/typechain-types/PendleYieldContractFactory.ts +84 -21
- package/typechain-types/PendleYieldToken.ts +175 -0
- package/typechain-types/RouterStatic.ts +136 -67
- package/typechain-types/SCYBase.ts +111 -46
- package/typechain-types/SCYBaseWithRewards.ts +111 -46
- package/typechain-types/VotingControllerStorageUpg.ts +246 -27
- package/typechain-types/VotingEscrowPendleMainchain.ts +81 -93
- package/typechain-types/VotingEscrowPendleSidechain.ts +26 -171
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +169 -1
- package/typechain-types/factories/ActionCallback__factory.ts +108 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +54 -1
- package/typechain-types/factories/ActionMisc__factory.ts +6 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +107 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +196 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +143 -1
- package/typechain-types/factories/AggregationRouterHelper__factory.ts +1 -1
- package/typechain-types/factories/IPActionAddRemoveLiq__factory.ts +31 -1
- package/typechain-types/factories/IPActionSwapPTYT__factory.ts +10 -0
- package/typechain-types/factories/IPActionSwapPT__factory.ts +30 -0
- package/typechain-types/factories/IPActionSwapYT__factory.ts +30 -0
- package/typechain-types/factories/IPAllAction__factory.ts +101 -1
- package/typechain-types/factories/IPBatchSeller__factory.ts +4 -10
- package/typechain-types/factories/IPMarket__factory.ts +13 -0
- package/typechain-types/factories/IPVotingController__factory.ts +148 -0
- package/typechain-types/factories/ISuperComposableYield__factory.ts +4 -28
- package/typechain-types/factories/MarketMathStatic__factory.ts +181 -3
- package/typechain-types/factories/OracleLib__factory.ts +27 -1
- package/typechain-types/factories/Pendle3CrvAndTokenSCY__factory.ts +1 -1
- package/typechain-types/factories/Pendle3CrvHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleBatchSeller__factory.ts +40 -118
- package/typechain-types/factories/PendleConvexCurveLP2PoolSCY__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerBaseUpg__factory.ts +11 -0
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +28 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +48 -86
- package/typechain-types/factories/PendleMarketFactory__factory.ts +129 -9
- package/typechain-types/factories/PendleMarket__factory.ts +214 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +86 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +198 -29
- package/typechain-types/factories/PendleRouter__factory.ts +12 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +235 -40
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +137 -22
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +103 -20
- package/typechain-types/factories/PendleYieldToken__factory.ts +163 -1
- package/typechain-types/factories/PtAMMArb__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +95 -19
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +136 -21
- package/typechain-types/factories/SCYBase__factory.ts +136 -21
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +232 -12
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +171 -47
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +31 -93
- package/typechain-types/hardhat.d.ts +393 -114
- package/typechain-types/index.ts +36 -66
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -810
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.json +0 -10
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.json +0 -833
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.json +0 -723
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.json +0 -728
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +0 -705
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +0 -864
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.json +0 -718
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.json +0 -784
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.dbg.json +0 -4
- package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.json +0 -134
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +0 -161
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol +0 -126
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol +0 -242
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol +0 -146
- package/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol +0 -176
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +0 -129
- package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +0 -193
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol +0 -155
- package/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol +0 -182
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol +0 -53
- package/contracts/libraries/helpers/SSTORE2Deployer.sol +0 -30
- package/contracts/libraries/solmate/SSTORE2.sol +0 -99
- package/contracts/offchain-helpers/SSTORE2DeployerContract.sol +0 -21
- package/deployments/43113-markets/benqi-market-10D931.json +0 -8
- package/deployments/43113-markets/benqi-market-9fbD64.json +0 -8
- package/deployments/43113-markets/benqi-market-A12361.json +0 -8
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
// This program is free software: you can redistribute it and/or modify
|
|
3
|
+
// it under the terms of the GNU General Public License as published by
|
|
4
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
5
|
+
// (at your option) any later version.
|
|
6
|
+
|
|
7
|
+
// This program is distributed in the hope that it will be useful,
|
|
8
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
+
// GNU General Public License for more details.
|
|
11
|
+
|
|
12
|
+
// You should have received a copy of the GNU General Public License
|
|
13
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
14
|
+
|
|
15
|
+
pragma solidity 0.8.15;
|
|
16
|
+
|
|
17
|
+
import "@openzeppelin/contracts/utils/Create2.sol";
|
|
18
|
+
|
|
19
|
+
library CodeDeployer {
|
|
20
|
+
// During contract construction, the full code supplied exists as code, and can be accessed via `codesize` and
|
|
21
|
+
// `codecopy`. This is not the contract's final code however: whatever the constructor returns is what will be
|
|
22
|
+
// stored as its code.
|
|
23
|
+
//
|
|
24
|
+
// We use this mechanism to have a simple constructor that stores whatever is appended to it. The following opcode
|
|
25
|
+
// sequence corresponds to the creation code of the following equivalent Solidity contract, plus padding to make the
|
|
26
|
+
// full code 32 bytes long:
|
|
27
|
+
//
|
|
28
|
+
// contract CodeDeployer {
|
|
29
|
+
// constructor() payable {
|
|
30
|
+
// uint256 size;
|
|
31
|
+
// assembly {
|
|
32
|
+
// size := sub(codesize(), 32) // size of appended data, as constructor is 32 bytes long
|
|
33
|
+
// codecopy(0, 32, size) // copy all appended data to memory at position 0
|
|
34
|
+
// return(0, size) // return appended data for it to be stored as code
|
|
35
|
+
// }
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
//
|
|
39
|
+
// More specifically, it is composed of the following opcodes (plus padding):
|
|
40
|
+
//
|
|
41
|
+
// [1] PUSH1 0x20
|
|
42
|
+
// [2] CODESIZE
|
|
43
|
+
// [3] SUB
|
|
44
|
+
// [4] DUP1
|
|
45
|
+
// [6] PUSH1 0x20
|
|
46
|
+
// [8] PUSH1 0x00
|
|
47
|
+
// [9] CODECOPY
|
|
48
|
+
// [11] PUSH1 0x00
|
|
49
|
+
// [12] RETURN
|
|
50
|
+
//
|
|
51
|
+
// The padding is just the 0xfe sequence (invalid opcode). It is important as it lets us work in-place, avoiding
|
|
52
|
+
// memory allocation and copying.
|
|
53
|
+
bytes32 private constant _DEPLOYER_CREATION_CODE =
|
|
54
|
+
0x602038038060206000396000f3fefefefefefefefefefefefefefefefefefefe;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @dev Deploys a contract with `code` as its code, returning the destination address.
|
|
58
|
+
*
|
|
59
|
+
* Reverts if deployment fails.
|
|
60
|
+
*/
|
|
61
|
+
function deploy(bytes memory code) internal returns (address destination) {
|
|
62
|
+
bytes32 deployerCreationCode = _DEPLOYER_CREATION_CODE;
|
|
63
|
+
|
|
64
|
+
// We need to concatenate the deployer creation code and `code` in memory, but want to avoid copying all of
|
|
65
|
+
// `code` (which could be quite long) into a new memory location. Therefore, we operate in-place using
|
|
66
|
+
// assembly.
|
|
67
|
+
|
|
68
|
+
// solhint-disable-next-line no-inline-assembly
|
|
69
|
+
assembly {
|
|
70
|
+
let codeLength := mload(code)
|
|
71
|
+
|
|
72
|
+
// `code` is composed of length and data. We've already stored its length in `codeLength`, so we simply
|
|
73
|
+
// replace it with the deployer creation code (which is exactly 32 bytes long).
|
|
74
|
+
mstore(code, deployerCreationCode)
|
|
75
|
+
|
|
76
|
+
// At this point, `code` now points to the deployer creation code immediately followed by `code`'s data
|
|
77
|
+
// contents. This is exactly what the deployer expects to receive when created.
|
|
78
|
+
destination := create(0, code, add(codeLength, 32))
|
|
79
|
+
|
|
80
|
+
// Finally, we restore the original length in order to not mutate `code`.
|
|
81
|
+
mstore(code, codeLength)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// The create opcode returns the zero address when contract creation fails, so we revert if this happens.
|
|
85
|
+
require(destination != address(0), "DEPLOYMENT_FAILED_BALANCER");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
library BaseSplitCodeFactory {
|
|
90
|
+
function setCreationCode(bytes memory creationCode)
|
|
91
|
+
internal
|
|
92
|
+
returns (
|
|
93
|
+
address creationCodeContractA,
|
|
94
|
+
uint256 creationCodeSizeA,
|
|
95
|
+
address creationCodeContractB,
|
|
96
|
+
uint256 creationCodeSizeB
|
|
97
|
+
)
|
|
98
|
+
{
|
|
99
|
+
unchecked {
|
|
100
|
+
require(creationCode.length > 0, "zero length");
|
|
101
|
+
uint256 creationCodeSize = creationCode.length;
|
|
102
|
+
|
|
103
|
+
// We are going to deploy two contracts: one with approximately the first half of `creationCode`'s contents
|
|
104
|
+
// (A), and another with the remaining half (B).
|
|
105
|
+
// We store the lengths in both immutable and stack variables, since immutable variables cannot be read during
|
|
106
|
+
// construction.
|
|
107
|
+
creationCodeSizeA = creationCodeSize / 2;
|
|
108
|
+
|
|
109
|
+
creationCodeSizeB = creationCodeSize - creationCodeSizeA;
|
|
110
|
+
|
|
111
|
+
// To deploy the contracts, we're going to use `CodeDeployer.deploy()`, which expects a memory array with
|
|
112
|
+
// the code to deploy. Note that we cannot simply create arrays for A and B's code by copying or moving
|
|
113
|
+
// `creationCode`'s contents as they are expected to be very large (> 24kB), so we must operate in-place.
|
|
114
|
+
|
|
115
|
+
// Memory: [ code length ] [ A.data ] [ B.data ]
|
|
116
|
+
|
|
117
|
+
// Creating A's array is simple: we simply replace `creationCode`'s length with A's length. We'll later restore
|
|
118
|
+
// the original length.
|
|
119
|
+
|
|
120
|
+
bytes memory creationCodeA;
|
|
121
|
+
assembly {
|
|
122
|
+
creationCodeA := creationCode
|
|
123
|
+
mstore(creationCodeA, creationCodeSizeA)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Memory: [ A.length ] [ A.data ] [ B.data ]
|
|
127
|
+
// ^ creationCodeA
|
|
128
|
+
|
|
129
|
+
creationCodeContractA = CodeDeployer.deploy(creationCodeA);
|
|
130
|
+
|
|
131
|
+
// Creating B's array is a bit more involved: since we cannot move B's contents, we are going to create a 'new'
|
|
132
|
+
// memory array starting at A's last 32 bytes, which will be replaced with B's length. We'll back-up this last
|
|
133
|
+
// byte to later restore it.
|
|
134
|
+
|
|
135
|
+
bytes memory creationCodeB;
|
|
136
|
+
bytes32 lastByteA;
|
|
137
|
+
|
|
138
|
+
assembly {
|
|
139
|
+
// `creationCode` points to the array's length, not data, so by adding A's length to it we arrive at A's
|
|
140
|
+
// last 32 bytes.
|
|
141
|
+
creationCodeB := add(creationCode, creationCodeSizeA)
|
|
142
|
+
lastByteA := mload(creationCodeB)
|
|
143
|
+
mstore(creationCodeB, creationCodeSizeB)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Memory: [ A.length ] [ A.data[ : -1] ] [ B.length ][ B.data ]
|
|
147
|
+
// ^ creationCodeA ^ creationCodeB
|
|
148
|
+
|
|
149
|
+
creationCodeContractB = CodeDeployer.deploy(creationCodeB);
|
|
150
|
+
|
|
151
|
+
// We now restore the original contents of `creationCode` by writing back the original length and A's last byte.
|
|
152
|
+
assembly {
|
|
153
|
+
mstore(creationCodeA, creationCodeSize)
|
|
154
|
+
mstore(creationCodeB, lastByteA)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @dev Returns the creation code of the contract this factory creates.
|
|
161
|
+
*/
|
|
162
|
+
function getCreationCode(
|
|
163
|
+
address creationCodeContractA,
|
|
164
|
+
uint256 creationCodeSizeA,
|
|
165
|
+
address creationCodeContractB,
|
|
166
|
+
uint256 creationCodeSizeB
|
|
167
|
+
) public view returns (bytes memory) {
|
|
168
|
+
return
|
|
169
|
+
_getCreationCodeWithArgs(
|
|
170
|
+
"",
|
|
171
|
+
creationCodeContractA,
|
|
172
|
+
creationCodeSizeA,
|
|
173
|
+
creationCodeContractB,
|
|
174
|
+
creationCodeSizeB
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @dev Returns the creation code that will result in a contract being deployed with `constructorArgs`.
|
|
180
|
+
*/
|
|
181
|
+
function _getCreationCodeWithArgs(
|
|
182
|
+
bytes memory constructorArgs,
|
|
183
|
+
address creationCodeContractA,
|
|
184
|
+
uint256 creationCodeSizeA,
|
|
185
|
+
address creationCodeContractB,
|
|
186
|
+
uint256 creationCodeSizeB
|
|
187
|
+
) private view returns (bytes memory code) {
|
|
188
|
+
unchecked {
|
|
189
|
+
// This function exists because `abi.encode()` cannot be instructed to place its result at a specific address.
|
|
190
|
+
// We need for the ABI-encoded constructor arguments to be located immediately after the creation code, but
|
|
191
|
+
// cannot rely on `abi.encodePacked()` to perform concatenation as that would involve copying the creation code,
|
|
192
|
+
// which would be prohibitively expensive.
|
|
193
|
+
// Instead, we compute the creation code in a pre-allocated array that is large enough to hold *both* the
|
|
194
|
+
// creation code and the constructor arguments, and then copy the ABI-encoded arguments (which should not be
|
|
195
|
+
// overly long) right after the end of the creation code.
|
|
196
|
+
|
|
197
|
+
// Immutable variables cannot be used in assembly, so we store them in the stack first.
|
|
198
|
+
|
|
199
|
+
uint256 creationCodeSize = creationCodeSizeA + creationCodeSizeB;
|
|
200
|
+
uint256 constructorArgsSize = constructorArgs.length;
|
|
201
|
+
|
|
202
|
+
uint256 codeSize = creationCodeSize + constructorArgsSize;
|
|
203
|
+
|
|
204
|
+
assembly {
|
|
205
|
+
// First, we allocate memory for `code` by retrieving the free memory pointer and then moving it ahead of
|
|
206
|
+
// `code` by the size of the creation code plus constructor arguments, and 32 bytes for the array length.
|
|
207
|
+
code := mload(0x40)
|
|
208
|
+
mstore(0x40, add(code, add(codeSize, 32)))
|
|
209
|
+
|
|
210
|
+
// We now store the length of the code plus constructor arguments.
|
|
211
|
+
mstore(code, codeSize)
|
|
212
|
+
|
|
213
|
+
// Next, we concatenate the creation code stored in A and B.
|
|
214
|
+
let dataStart := add(code, 32)
|
|
215
|
+
extcodecopy(creationCodeContractA, dataStart, 0, creationCodeSizeA)
|
|
216
|
+
extcodecopy(
|
|
217
|
+
creationCodeContractB,
|
|
218
|
+
add(dataStart, creationCodeSizeA),
|
|
219
|
+
0,
|
|
220
|
+
creationCodeSizeB
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Finally, we copy the constructorArgs to the end of the array. Unfortunately there is no way to avoid this
|
|
225
|
+
// copy, as it is not possible to tell Solidity where to store the result of `abi.encode()`.
|
|
226
|
+
uint256 constructorArgsDataPtr;
|
|
227
|
+
uint256 constructorArgsCodeDataPtr;
|
|
228
|
+
assembly {
|
|
229
|
+
constructorArgsDataPtr := add(constructorArgs, 32)
|
|
230
|
+
constructorArgsCodeDataPtr := add(add(code, 32), creationCodeSize)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
_memcpy(constructorArgsCodeDataPtr, constructorArgsDataPtr, constructorArgsSize);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @dev Deploys a contract with constructor arguments. To create `constructorArgs`, call `abi.encode()` with the
|
|
239
|
+
* contract's constructor arguments, in order.
|
|
240
|
+
*/
|
|
241
|
+
function _create2(
|
|
242
|
+
uint256 amount,
|
|
243
|
+
bytes32 salt,
|
|
244
|
+
bytes memory constructorArgs,
|
|
245
|
+
address creationCodeContractA,
|
|
246
|
+
uint256 creationCodeSizeA,
|
|
247
|
+
address creationCodeContractB,
|
|
248
|
+
uint256 creationCodeSizeB
|
|
249
|
+
) internal returns (address) {
|
|
250
|
+
unchecked {
|
|
251
|
+
bytes memory creationCode = _getCreationCodeWithArgs(
|
|
252
|
+
constructorArgs,
|
|
253
|
+
creationCodeContractA,
|
|
254
|
+
creationCodeSizeA,
|
|
255
|
+
creationCodeContractB,
|
|
256
|
+
creationCodeSizeB
|
|
257
|
+
);
|
|
258
|
+
return Create2.deploy(amount, salt, creationCode);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// From
|
|
263
|
+
// https://github.com/Arachnid/solidity-stringutils/blob/b9a6f6615cf18a87a823cbc461ce9e140a61c305/src/strings.sol
|
|
264
|
+
function _memcpy(
|
|
265
|
+
uint256 dest,
|
|
266
|
+
uint256 src,
|
|
267
|
+
uint256 len
|
|
268
|
+
) private pure {
|
|
269
|
+
unchecked {
|
|
270
|
+
// Copy word-length chunks while possible
|
|
271
|
+
for (; len >= 32; len -= 32) {
|
|
272
|
+
assembly {
|
|
273
|
+
mstore(dest, mload(src))
|
|
274
|
+
}
|
|
275
|
+
dest += 32;
|
|
276
|
+
src += 32;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Copy remaining bytes
|
|
280
|
+
uint256 mask = 256**(32 - len) - 1;
|
|
281
|
+
assembly {
|
|
282
|
+
let srcpart := and(mload(src), not(mask))
|
|
283
|
+
let destpart := and(mload(dest), mask)
|
|
284
|
+
mstore(dest, or(destpart, srcpart))
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
@@ -83,6 +83,10 @@ abstract contract TokenHelper {
|
|
|
83
83
|
return (token == NATIVE) ? address(this).balance : IERC20(token).balanceOf(address(this));
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
function _selfBalance(IERC20 token) internal view returns (uint256) {
|
|
87
|
+
return token.balanceOf(address(this));
|
|
88
|
+
}
|
|
89
|
+
|
|
86
90
|
function _selfBalances(address[] memory tokens)
|
|
87
91
|
internal
|
|
88
92
|
view
|
|
@@ -86,13 +86,6 @@ library AggregationRouterHelper {
|
|
|
86
86
|
return (desc, executorData);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
//if the difference of newAmount and oldAmount > 5%, revert
|
|
90
|
-
require(
|
|
91
|
-
(oldAmount * (100 - SLIPPAGE_RANGE)) / 100 <= newAmount &&
|
|
92
|
-
newAmount <= (oldAmount * (100 + SLIPPAGE_RANGE)) / 100,
|
|
93
|
-
"kyber: difference too large"
|
|
94
|
-
);
|
|
95
|
-
|
|
96
89
|
// simple mode swap
|
|
97
90
|
if (flags & _SIMPLE_SWAP != 0) {
|
|
98
91
|
require(desc.srcReceivers.length == 0, "kyber: can't scale if take fee");
|
|
@@ -5,6 +5,7 @@ import "./Math.sol";
|
|
|
5
5
|
import "./LogExpMath.sol";
|
|
6
6
|
import "../helpers/PYIndex.sol";
|
|
7
7
|
import "../helpers/MiniHelpers.sol";
|
|
8
|
+
import "../Errors.sol";
|
|
8
9
|
|
|
9
10
|
struct MarketState {
|
|
10
11
|
int256 totalPt;
|
|
@@ -51,7 +52,6 @@ library MarketMathCore {
|
|
|
51
52
|
|
|
52
53
|
function addLiquidity(
|
|
53
54
|
MarketState memory market,
|
|
54
|
-
PYIndex index,
|
|
55
55
|
uint256 scyDesired,
|
|
56
56
|
uint256 ptDesired,
|
|
57
57
|
uint256 blockTime
|
|
@@ -69,13 +69,13 @@ library MarketMathCore {
|
|
|
69
69
|
int256 _lpToReserve,
|
|
70
70
|
int256 _lpToAccount,
|
|
71
71
|
int256 _scyUsed,
|
|
72
|
-
int256
|
|
73
|
-
) = addLiquidityCore(market,
|
|
72
|
+
int256 _ptUsed
|
|
73
|
+
) = addLiquidityCore(market, scyDesired.Int(), ptDesired.Int(), blockTime);
|
|
74
74
|
|
|
75
75
|
lpToReserve = _lpToReserve.Uint();
|
|
76
76
|
lpToAccount = _lpToAccount.Uint();
|
|
77
77
|
scyUsed = _scyUsed.Uint();
|
|
78
|
-
ptUsed =
|
|
78
|
+
ptUsed = _ptUsed.Uint();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function removeLiquidity(MarketState memory market, uint256 lpToRemove)
|
|
@@ -132,7 +132,6 @@ library MarketMathCore {
|
|
|
132
132
|
|
|
133
133
|
function addLiquidityCore(
|
|
134
134
|
MarketState memory market,
|
|
135
|
-
PYIndex index,
|
|
136
135
|
int256 scyDesired,
|
|
137
136
|
int256 ptDesired,
|
|
138
137
|
uint256 blockTime
|
|
@@ -149,16 +148,14 @@ library MarketMathCore {
|
|
|
149
148
|
/// ------------------------------------------------------------
|
|
150
149
|
/// CHECKS
|
|
151
150
|
/// ------------------------------------------------------------
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
if (scyDesired == 0 || ptDesired == 0) revert Errors.MarketZeroAmountsInput();
|
|
152
|
+
if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();
|
|
154
153
|
|
|
155
154
|
/// ------------------------------------------------------------
|
|
156
155
|
/// MATH
|
|
157
156
|
/// ------------------------------------------------------------
|
|
158
157
|
if (market.totalLp == 0) {
|
|
159
|
-
lpToAccount =
|
|
160
|
-
Math.sqrt((index.scyToAsset(scyDesired) * ptDesired).Uint()).Int() -
|
|
161
|
-
MINIMUM_LIQUIDITY;
|
|
158
|
+
lpToAccount = Math.sqrt((scyDesired * ptDesired).Uint()).Int() - MINIMUM_LIQUIDITY;
|
|
162
159
|
lpToReserve = MINIMUM_LIQUIDITY;
|
|
163
160
|
scyUsed = scyDesired;
|
|
164
161
|
ptUsed = ptDesired;
|
|
@@ -176,7 +173,7 @@ library MarketMathCore {
|
|
|
176
173
|
}
|
|
177
174
|
}
|
|
178
175
|
|
|
179
|
-
|
|
176
|
+
if (lpToAccount == 0) revert Errors.MarketZeroAmountsOutput();
|
|
180
177
|
|
|
181
178
|
/// ------------------------------------------------------------
|
|
182
179
|
/// WRITE
|
|
@@ -194,7 +191,7 @@ library MarketMathCore {
|
|
|
194
191
|
/// ------------------------------------------------------------
|
|
195
192
|
/// CHECKS
|
|
196
193
|
/// ------------------------------------------------------------
|
|
197
|
-
|
|
194
|
+
if (lpToRemove == 0) revert Errors.MarketZeroAmountsInput();
|
|
198
195
|
|
|
199
196
|
/// ------------------------------------------------------------
|
|
200
197
|
/// MATH
|
|
@@ -202,7 +199,8 @@ library MarketMathCore {
|
|
|
202
199
|
netScyToAccount = (lpToRemove * market.totalScy) / market.totalLp;
|
|
203
200
|
netPtToAccount = (lpToRemove * market.totalPt) / market.totalLp;
|
|
204
201
|
|
|
205
|
-
|
|
202
|
+
if (netScyToAccount == 0 || netPtToAccount == 0) revert Errors.MarketZeroAmountsOutput();
|
|
203
|
+
|
|
206
204
|
/// ------------------------------------------------------------
|
|
207
205
|
/// WRITE
|
|
208
206
|
/// ------------------------------------------------------------
|
|
@@ -220,8 +218,9 @@ library MarketMathCore {
|
|
|
220
218
|
/// ------------------------------------------------------------
|
|
221
219
|
/// CHECKS
|
|
222
220
|
/// ------------------------------------------------------------
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();
|
|
222
|
+
if (market.totalPt <= netPtToAccount)
|
|
223
|
+
revert Errors.MarketInsufficientPtForTrade(market.totalPt, netPtToAccount);
|
|
225
224
|
|
|
226
225
|
/// ------------------------------------------------------------
|
|
227
226
|
/// MATH
|
|
@@ -258,14 +257,15 @@ library MarketMathCore {
|
|
|
258
257
|
PYIndex index,
|
|
259
258
|
uint256 blockTime
|
|
260
259
|
) internal pure returns (MarketPreCompute memory res) {
|
|
261
|
-
|
|
260
|
+
if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();
|
|
262
261
|
|
|
263
262
|
uint256 timeToExpiry = market.expiry - blockTime;
|
|
264
263
|
|
|
265
264
|
res.rateScalar = _getRateScalar(market, timeToExpiry);
|
|
266
265
|
res.totalAsset = index.scyToAsset(market.totalScy);
|
|
267
266
|
|
|
268
|
-
|
|
267
|
+
if (market.totalPt == 0 || res.totalAsset == 0)
|
|
268
|
+
revert Errors.MarketZeroTotalPtOrTotalAsset(market.totalPt, res.totalAsset);
|
|
269
269
|
|
|
270
270
|
res.rateAnchor = _getRateAnchor(
|
|
271
271
|
market.totalPt,
|
|
@@ -295,7 +295,9 @@ library MarketMathCore {
|
|
|
295
295
|
|
|
296
296
|
if (netPtToAccount > 0) {
|
|
297
297
|
int256 postFeeExchangeRate = preFeeExchangeRate.divDown(fee);
|
|
298
|
-
|
|
298
|
+
if (postFeeExchangeRate < Math.IONE)
|
|
299
|
+
revert Errors.MarketExchangeRateBelowOne(postFeeExchangeRate);
|
|
300
|
+
|
|
299
301
|
fee = preFeeAssetToAccount.mulDown(Math.IONE - fee);
|
|
300
302
|
} else {
|
|
301
303
|
fee = ((preFeeAssetToAccount * (Math.IONE - fee)) / fee).neg();
|
|
@@ -326,7 +328,8 @@ library MarketMathCore {
|
|
|
326
328
|
comp.rateAnchor,
|
|
327
329
|
timeToExpiry
|
|
328
330
|
);
|
|
329
|
-
|
|
331
|
+
|
|
332
|
+
if (market.lastLnImpliedRate == 0) revert Errors.MarketZeroLnImpliedRate();
|
|
330
333
|
}
|
|
331
334
|
|
|
332
335
|
function _getRateAnchor(
|
|
@@ -338,7 +341,7 @@ library MarketMathCore {
|
|
|
338
341
|
) internal pure returns (int256 rateAnchor) {
|
|
339
342
|
int256 newExchangeRate = _getExchangeRateFromImpliedRate(lastLnImpliedRate, timeToExpiry);
|
|
340
343
|
|
|
341
|
-
|
|
344
|
+
if (newExchangeRate < Math.IONE) revert Errors.MarketExchangeRateBelowOne(newExchangeRate);
|
|
342
345
|
|
|
343
346
|
{
|
|
344
347
|
int256 proportion = totalPt.divDown(totalPt + totalAsset);
|
|
@@ -390,17 +393,18 @@ library MarketMathCore {
|
|
|
390
393
|
|
|
391
394
|
int256 proportion = (numerator.divDown(totalPt + totalAsset));
|
|
392
395
|
|
|
393
|
-
|
|
396
|
+
if (proportion > MAX_MARKET_PROPORTION)
|
|
397
|
+
revert Errors.MarketProportionTooHigh(proportion, MAX_MARKET_PROPORTION);
|
|
394
398
|
|
|
395
399
|
int256 lnProportion = _logProportion(proportion);
|
|
396
400
|
|
|
397
401
|
exchangeRate = lnProportion.divDown(rateScalar) + rateAnchor;
|
|
398
402
|
|
|
399
|
-
|
|
403
|
+
if (exchangeRate < Math.IONE) revert Errors.MarketExchangeRateBelowOne(exchangeRate);
|
|
400
404
|
}
|
|
401
405
|
|
|
402
406
|
function _logProportion(int256 proportion) internal pure returns (int256 res) {
|
|
403
|
-
|
|
407
|
+
if (proportion == Math.IONE) revert Errors.MarketProportionMustNotEqualOne();
|
|
404
408
|
|
|
405
409
|
int256 logitP = proportion.divDown(Math.IONE - proportion);
|
|
406
410
|
|
|
@@ -413,7 +417,7 @@ library MarketMathCore {
|
|
|
413
417
|
returns (int256 rateScalar)
|
|
414
418
|
{
|
|
415
419
|
rateScalar = (market.scalarRoot * IMPLIED_RATE_TIME.Int()) / timeToExpiry.Int();
|
|
416
|
-
|
|
420
|
+
if (rateScalar <= 0) revert Errors.MarketRateScalarBelowZero(rateScalar);
|
|
417
421
|
}
|
|
418
422
|
|
|
419
423
|
function setInitialLnImpliedRate(
|
|
@@ -425,7 +429,7 @@ library MarketMathCore {
|
|
|
425
429
|
/// ------------------------------------------------------------
|
|
426
430
|
/// CHECKS
|
|
427
431
|
/// ------------------------------------------------------------
|
|
428
|
-
|
|
432
|
+
if (MiniHelpers.isExpired(market.expiry, blockTime)) revert Errors.MarketExpired();
|
|
429
433
|
|
|
430
434
|
/// ------------------------------------------------------------
|
|
431
435
|
/// MATH
|
|
@@ -119,6 +119,10 @@ library Math {
|
|
|
119
119
|
return int128(x);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
function Int128(uint256 x) internal pure returns (int128) {
|
|
123
|
+
return Int128(Int(x));
|
|
124
|
+
}
|
|
125
|
+
|
|
122
126
|
/*///////////////////////////////////////////////////////////////
|
|
123
127
|
UNSIGNED CASTS
|
|
124
128
|
//////////////////////////////////////////////////////////////*/
|
|
@@ -161,7 +165,7 @@ library Math {
|
|
|
161
165
|
uint256 b,
|
|
162
166
|
uint256 eps
|
|
163
167
|
) internal pure returns (bool) {
|
|
164
|
-
return a >= b && a <= mulDown(b,
|
|
168
|
+
return a >= b && a <= mulDown(b, ONE + eps);
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
function isASmallerApproxB(
|
|
@@ -169,6 +173,6 @@ library Math {
|
|
|
169
173
|
uint256 b,
|
|
170
174
|
uint256 eps
|
|
171
175
|
) internal pure returns (bool) {
|
|
172
|
-
return a <= b && a >= mulDown(b,
|
|
176
|
+
return a <= b && a >= mulDown(b, ONE - eps);
|
|
173
177
|
}
|
|
174
178
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
pragma solidity 0.8.15;
|
|
4
4
|
|
|
5
5
|
library WeekMath {
|
|
6
|
-
uint128 internal constant WEEK =
|
|
6
|
+
uint128 internal constant WEEK = 1 days;
|
|
7
7
|
|
|
8
8
|
function getWeekStartTimestamp(uint128 timestamp) internal pure returns (uint128) {
|
|
9
9
|
return (timestamp / WEEK) * WEEK;
|
|
@@ -13,7 +13,7 @@ library WeekMath {
|
|
|
13
13
|
return getWeekStartTimestamp(uint128(block.timestamp));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
function isValidWTime(
|
|
16
|
+
function isValidWTime(uint256 time) internal pure returns (bool) {
|
|
17
17
|
return time % WEEK == 0;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
import "../libraries/helpers/BaseSplitCodeFactory.sol";
|
|
4
|
+
import "../periphery/BoringOwnableUpgradeable.sol";
|
|
5
|
+
|
|
6
|
+
contract BaseSplitCodeFactoryContract is BoringOwnableUpgradeable {
|
|
7
|
+
event Deployed(
|
|
8
|
+
string indexed name,
|
|
9
|
+
address creationCodeContractA,
|
|
10
|
+
uint256 creationCodeSizeA,
|
|
11
|
+
address creationCodeContractB,
|
|
12
|
+
uint256 creationCodeSizeB
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
constructor() initializer {
|
|
16
|
+
__BoringOwnable_init();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function deploy(string memory name, bytes calldata creationCode)
|
|
20
|
+
external
|
|
21
|
+
onlyOwner
|
|
22
|
+
returns (
|
|
23
|
+
address creationCodeContractA,
|
|
24
|
+
uint256 creationCodeSizeA,
|
|
25
|
+
address creationCodeContractB,
|
|
26
|
+
uint256 creationCodeSizeB
|
|
27
|
+
)
|
|
28
|
+
{
|
|
29
|
+
(
|
|
30
|
+
creationCodeContractA,
|
|
31
|
+
creationCodeSizeA,
|
|
32
|
+
creationCodeContractB,
|
|
33
|
+
creationCodeSizeB
|
|
34
|
+
) = BaseSplitCodeFactory.setCreationCode(creationCode);
|
|
35
|
+
emit Deployed(
|
|
36
|
+
name,
|
|
37
|
+
creationCodeContractA,
|
|
38
|
+
creationCodeSizeA,
|
|
39
|
+
creationCodeContractB,
|
|
40
|
+
creationCodeSizeB
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|