@pendle/core-v2 0.8.0-beta-12 → 0.8.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +39 -7
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- 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 +39 -7
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +38 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.json +864 -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 +38 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +38 -6
- 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 +36 -4
- 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 +36 -4
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +242 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerSidechain.sol → PendleGaugeControllerSidechainUpg.sol}/PendleGaugeControllerSidechainUpg.json +3 -3
- 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 +2 -15
- 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 +0 -13
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +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/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +2 -2
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +2 -2
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +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/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCore.sol/ActionCore.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +2 -2
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.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/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +15 -0
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/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/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargateLPStaking.sol/IStargateLPStaking.json +137 -0
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargatePool.sol/IStargatePool.json +135 -0
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IStargateRouter.sol/IStargateRouter.json +63 -0
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +36 -4
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.json +2 -2
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.json +2 -2
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.json +2 -2
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.json +2 -2
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +174 -6
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +13 -3
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +13 -9
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +12 -2
- package/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol +194 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +12 -8
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +12 -8
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +10 -12
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +1 -2
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +1 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +1 -1
- package/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerMainchain.sol → PendleGaugeControllerMainchainUpg.sol} +0 -0
- package/contracts/core/LiquidityMining/GaugeController/{PendleGaugeControllerSidechain.sol → PendleGaugeControllerSidechainUpg.sol} +0 -0
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +18 -24
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +8 -10
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +3 -3
- package/contracts/core/Market/PendleMarketFactory.sol +1 -0
- package/contracts/core/PendleERC20.sol +1 -1
- package/contracts/core/YieldContracts/PendleYieldToken.sol +0 -7
- package/contracts/core/actions/ActionCallback.sol +3 -1
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +1 -0
- package/contracts/core/actions/base/CallbackHelper.sol +1 -1
- package/contracts/interfaces/IPGaugeController.sol +1 -1
- package/contracts/interfaces/IPRouterStatic.sol +15 -3
- package/contracts/interfaces/IStargateLPStaking.sol +47 -0
- package/contracts/interfaces/IStargatePool.sol +49 -0
- package/contracts/interfaces/IStargateRouter.sol +37 -0
- package/contracts/interfaces/ISuperComposableYield.sol +6 -9
- package/contracts/libraries/RewardManager.sol +2 -3
- package/contracts/libraries/RewardManagerAbstract.sol +1 -0
- package/contracts/libraries/VeBalanceLib.sol +13 -0
- package/contracts/libraries/helpers/ArrayLib.sol +0 -17
- package/contracts/libraries/helpers/TokenHelper.sol +4 -2
- package/contracts/libraries/math/LogExpMath.sol +46 -44
- package/contracts/libraries/math/MarketApproxLib.sol +5 -7
- package/contracts/libraries/math/MarketMathCore.sol +14 -5
- package/contracts/libraries/math/Math.sol +14 -0
- package/contracts/offchain-helpers/RouterStatic.sol +163 -34
- package/deployments/43113-core.json +7 -7
- package/deployments/43113-markets/benqi-market-4Ccb97.json +7 -0
- package/deployments/43113-markets/benqi-market-534471.json +7 -0
- package/deployments/80001-core.json +6 -6
- package/deployments/80001-markets/benqi-market-109acB.json +7 -0
- package/deployments/80001-markets/benqi-market-4e470E.json +7 -0
- package/package.json +3 -3
- package/typechain-types/IPRouterStatic.ts +45 -9
- package/typechain-types/IStargateLPStaking.ts +108 -0
- package/typechain-types/IStargatePool.ts +94 -0
- package/typechain-types/ISuperComposableYield.ts +72 -26
- package/typechain-types/PendleAaveV3SCY.ts +74 -28
- package/typechain-types/PendleERC4626SCY.ts +73 -27
- package/typechain-types/PendleQiTokenSCY.ts +74 -28
- package/typechain-types/PendleStargatePool.ts +73 -27
- package/typechain-types/PendleStargateSCY.ts +1135 -0
- package/typechain-types/PendleVotingControllerUpg.ts +0 -21
- package/typechain-types/PendleWstEthSCY.ts +73 -27
- package/typechain-types/PendleYearnVaultScy.ts +73 -27
- package/typechain-types/RouterStatic.ts +314 -74
- package/typechain-types/SCYBase.ts +73 -27
- package/typechain-types/SCYBaseWithRewards.ts +73 -27
- package/typechain-types/VotingControllerStorageUpg.ts +0 -21
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +1 -1
- package/typechain-types/factories/ActionYT__factory.ts +1 -1
- package/typechain-types/factories/IPRouterStatic__factory.ts +15 -0
- package/typechain-types/factories/IStargateLPStaking__factory.ts +90 -0
- package/typechain-types/factories/IStargatePool__factory.ts +79 -0
- package/typechain-types/factories/ISuperComposableYield__factory.ts +36 -4
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +38 -6
- package/typechain-types/factories/PendleERC20Permit__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +37 -5
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +1 -1
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +38 -6
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleStargatePool__factory.ts +37 -5
- package/typechain-types/factories/PendleStargateSCY__factory.ts +952 -0
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -14
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +37 -5
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +37 -5
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +173 -5
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +36 -4
- package/typechain-types/factories/SCYBase__factory.ts +36 -4
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +0 -13
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +9 -0
- package/typechain-types/index.ts +2 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +0 -242
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +0 -4
- package/deployments/43113-markets/benqi-market-5C60ba.json +0 -7
- package/deployments/43113-markets/benqi-market-611eA3.json +0 -7
- package/deployments/43113-markets/benqi-market-A386eA.json +0 -7
- package/deployments/43113-markets/benqi-market-bf8841.json +0 -7
- package/deployments/80001-markets/benqi-market-5E1104.json +0 -7
- package/deployments/80001-markets/benqi-market-899134.json +0 -7
- package/deployments/80001-markets/benqi-market-94C86f.json +0 -7
- package/deployments/80001-markets/benqi-market-c68429.json +0 -7
|
@@ -253,13 +253,6 @@ contract PendleYieldToken is
|
|
|
253
253
|
return SCYUtils.scyToAsset(scyIndexCurrent(), amountScy);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
function _calcScyRedeemableFromPY(uint256 amountPY)
|
|
257
|
-
internal
|
|
258
|
-
returns (uint256 scyToUser, uint256 scyInterestPostExpiry)
|
|
259
|
-
{
|
|
260
|
-
return _calcScyRedeemableFromPY(amountPY, scyIndexCurrent());
|
|
261
|
-
}
|
|
262
|
-
|
|
263
256
|
function _calcScyRedeemableFromPY(uint256 amountPY, uint256 indexCurrent)
|
|
264
257
|
internal
|
|
265
258
|
view
|
|
@@ -104,7 +104,9 @@ contract ActionCallback is IPMarketSwapCallback, CallbackHelper {
|
|
|
104
104
|
/// ------------------------------------------------------------
|
|
105
105
|
/// mint & transfer
|
|
106
106
|
/// ------------------------------------------------------------
|
|
107
|
-
|
|
107
|
+
if (netScyToPull > 0) {
|
|
108
|
+
SCY.safeTransferFrom(vars.payer, address(YT), netScyToPull);
|
|
109
|
+
}
|
|
108
110
|
|
|
109
111
|
uint256 amountPYout = YT.mintPY(market, vars.receiver);
|
|
110
112
|
require(amountPYout >= ptOwed, "insufficient pt to pay");
|
|
@@ -118,6 +118,7 @@ abstract contract ActionSCYAndYTBase is ActionSCYAndPYBase, CallbackHelper {
|
|
|
118
118
|
exactYtOut, // exactPtIn = exactYtOut
|
|
119
119
|
_encodeSwapScyForExactYt(msg.sender, receiver, maxScyIn)
|
|
120
120
|
);
|
|
121
|
+
|
|
121
122
|
netScyIn = preScyBalance - SCY.balanceOf(msg.sender);
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -76,6 +76,6 @@ abstract contract CallbackHelper {
|
|
|
76
76
|
/// Misc functions
|
|
77
77
|
/// ------------------------------------------------------------
|
|
78
78
|
function _getActionType(bytes memory data) internal pure returns (ActionType actionType) {
|
|
79
|
-
|
|
79
|
+
actionType = abi.decode(data, (ActionType));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -108,17 +108,29 @@ interface IPRouterStatic {
|
|
|
108
108
|
function swapExactPtForScyStatic(address market, uint256 exactPtIn)
|
|
109
109
|
external
|
|
110
110
|
view
|
|
111
|
-
returns (
|
|
111
|
+
returns (
|
|
112
|
+
uint256 netScyOut,
|
|
113
|
+
uint256 netScyFee,
|
|
114
|
+
uint256 priceImpact
|
|
115
|
+
);
|
|
112
116
|
|
|
113
117
|
function swapScyForExactPtStatic(address market, uint256 exactPtOut)
|
|
114
118
|
external
|
|
115
119
|
view
|
|
116
|
-
returns (
|
|
120
|
+
returns (
|
|
121
|
+
uint256 netScyIn,
|
|
122
|
+
uint256 netScyFee,
|
|
123
|
+
uint256 priceImpact
|
|
124
|
+
);
|
|
117
125
|
|
|
118
126
|
function swapExactScyForPtStatic(address market, uint256 exactScyIn)
|
|
119
127
|
external
|
|
120
128
|
view
|
|
121
|
-
returns (
|
|
129
|
+
returns (
|
|
130
|
+
uint256 netPtOut,
|
|
131
|
+
uint256 netScyFee,
|
|
132
|
+
uint256 priceImpact
|
|
133
|
+
);
|
|
122
134
|
|
|
123
135
|
// ============= OTHER HELPERS =============
|
|
124
136
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
pragma solidity 0.8.15;
|
|
24
|
+
|
|
25
|
+
interface IStargateLPStaking {
|
|
26
|
+
struct PoolInfo {
|
|
27
|
+
address lpToken; // Address of LP token contract.
|
|
28
|
+
uint256 allocPoint; // How many allocation points assigned to this pool. STGs to distribute per block.
|
|
29
|
+
uint256 lastRewardBlock; // Last block number that STGs distribution occurs.
|
|
30
|
+
uint256 accStargatePerShare; // Accumulated STGs per share, times 1e12. See below.
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
struct UserInfo {
|
|
34
|
+
uint256 amount; // How many LP tokens the user has provided.
|
|
35
|
+
uint256 rewardDebt; // Reward debt. See explanation below.
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function stargate() external view returns (address);
|
|
39
|
+
|
|
40
|
+
function deposit(uint256 _pid, uint256 _amount) external;
|
|
41
|
+
|
|
42
|
+
function withdraw(uint256 _pid, uint256 _amount) external;
|
|
43
|
+
|
|
44
|
+
function poolInfo(uint256 _pid) external view returns (PoolInfo memory);
|
|
45
|
+
|
|
46
|
+
function userInfo(uint256 _pid, address _user) external view returns (UserInfo memory);
|
|
47
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
pragma solidity 0.8.15;
|
|
24
|
+
|
|
25
|
+
interface IStargatePool {
|
|
26
|
+
struct SwapObj {
|
|
27
|
+
uint256 amount;
|
|
28
|
+
uint256 eqFee;
|
|
29
|
+
uint256 eqReward;
|
|
30
|
+
uint256 lpFee;
|
|
31
|
+
uint256 protocolFee;
|
|
32
|
+
uint256 lkbRemove;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function swapRemote(
|
|
36
|
+
uint16 _srcChainId,
|
|
37
|
+
uint256 _srcPoolId,
|
|
38
|
+
address _to,
|
|
39
|
+
SwapObj memory _s
|
|
40
|
+
) external returns (uint256 amountLD);
|
|
41
|
+
|
|
42
|
+
function poolId() external view returns (uint256);
|
|
43
|
+
|
|
44
|
+
function amountLPtoLD(uint256 _amountLP) external view returns (uint256);
|
|
45
|
+
|
|
46
|
+
function token() external view returns (address);
|
|
47
|
+
|
|
48
|
+
function totalLiquidity() external view returns (uint256);
|
|
49
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
pragma solidity 0.8.15;
|
|
24
|
+
|
|
25
|
+
interface IStargateRouter {
|
|
26
|
+
function addLiquidity(
|
|
27
|
+
uint256 _poolId,
|
|
28
|
+
uint256 _amountLD,
|
|
29
|
+
address _to
|
|
30
|
+
) external;
|
|
31
|
+
|
|
32
|
+
function instantRedeemLocal(
|
|
33
|
+
uint16 _srcPoolId,
|
|
34
|
+
uint256 _amountLP,
|
|
35
|
+
address _to
|
|
36
|
+
) external returns (uint256 amountSD);
|
|
37
|
+
}
|
|
@@ -136,16 +136,13 @@ interface ISuperComposableYield is IERC20Metadata {
|
|
|
136
136
|
*/
|
|
137
137
|
function yieldToken() external view returns (address);
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
* @notice returns a list of all the base tokens that can be deposited to mint shares
|
|
141
|
-
*/
|
|
142
|
-
function getBaseTokens() external view returns (address[] memory res);
|
|
139
|
+
function getTokensIn() external view returns (address[] memory res);
|
|
143
140
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
function
|
|
141
|
+
function getTokensOut() external view returns (address[] memory res);
|
|
142
|
+
|
|
143
|
+
function isValidTokenIn(address token) external view returns (bool);
|
|
144
|
+
|
|
145
|
+
function isValidTokenOut(address token) external view returns (bool);
|
|
149
146
|
|
|
150
147
|
function previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
151
148
|
external
|
|
@@ -5,9 +5,8 @@ import "./RewardManagerAbstract.sol";
|
|
|
5
5
|
import "./math/Math.sol";
|
|
6
6
|
import "../libraries/helpers/ArrayLib.sol";
|
|
7
7
|
|
|
8
|
-
///
|
|
9
|
-
///
|
|
10
|
-
/// * Use with SCY + PendleMarket. For YT, it has its own native implementation for gas saving
|
|
8
|
+
/// NOTE: This RewardManager is used with PendleMarket & SCY. For YT, it will use RewardManagerAbstract
|
|
9
|
+
/// NOTE: RewardManager must not have duplicated rewardTokens
|
|
11
10
|
abstract contract RewardManager is RewardManagerAbstract {
|
|
12
11
|
using Math for uint256;
|
|
13
12
|
using ArrayLib for uint256[];
|
|
@@ -4,6 +4,7 @@ import "../interfaces/IRewardManager.sol";
|
|
|
4
4
|
import "./helpers/TokenHelper.sol";
|
|
5
5
|
import "./math/Math.sol";
|
|
6
6
|
|
|
7
|
+
/// NOTE: RewardManager must not have duplicated rewardTokens
|
|
7
8
|
abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
|
|
8
9
|
using Math for uint256;
|
|
9
10
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
pragma solidity 0.8.15;
|
|
3
3
|
|
|
4
|
+
import "./math/Math.sol";
|
|
5
|
+
|
|
4
6
|
struct VeBalance {
|
|
5
7
|
uint128 bias;
|
|
6
8
|
uint128 slope;
|
|
@@ -12,7 +14,9 @@ struct LockedPosition {
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
library VeBalanceLib {
|
|
17
|
+
using Math for uint256;
|
|
15
18
|
uint128 internal constant MAX_LOCK_TIME = 104 weeks;
|
|
19
|
+
uint256 internal constant USER_VOTE_MAX_WEIGHT = 10**18;
|
|
16
20
|
|
|
17
21
|
function add(VeBalance memory a, VeBalance memory b)
|
|
18
22
|
internal
|
|
@@ -68,6 +72,15 @@ library VeBalanceLib {
|
|
|
68
72
|
res.bias = res.slope * position.expiry;
|
|
69
73
|
}
|
|
70
74
|
|
|
75
|
+
function convertToVeBalance(LockedPosition memory position, uint256 weight)
|
|
76
|
+
internal
|
|
77
|
+
pure
|
|
78
|
+
returns (VeBalance memory res)
|
|
79
|
+
{
|
|
80
|
+
res.slope = ((position.amount * weight) / MAX_LOCK_TIME / USER_VOTE_MAX_WEIGHT).Uint128();
|
|
81
|
+
res.bias = res.slope * position.expiry;
|
|
82
|
+
}
|
|
83
|
+
|
|
71
84
|
function convertToVeBalance(uint128 amount, uint128 expiry)
|
|
72
85
|
internal
|
|
73
86
|
pure
|
|
@@ -2,23 +2,6 @@
|
|
|
2
2
|
pragma solidity >=0.8.0;
|
|
3
3
|
|
|
4
4
|
library ArrayLib {
|
|
5
|
-
function padZeroRight(uint256[] memory input, uint256 length)
|
|
6
|
-
internal
|
|
7
|
-
pure
|
|
8
|
-
returns (uint256[] memory)
|
|
9
|
-
{
|
|
10
|
-
uint256[] memory output = new uint256[](length);
|
|
11
|
-
uint256 inputLength = input.length;
|
|
12
|
-
for (uint8 i = 0; i < length; ) {
|
|
13
|
-
if (i < inputLength) output[i] = input[i];
|
|
14
|
-
else output[i] = 0;
|
|
15
|
-
unchecked {
|
|
16
|
-
i++;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return output;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
5
|
function sum(uint256[] memory input) internal pure returns (uint256) {
|
|
23
6
|
uint256 value = 0;
|
|
24
7
|
for (uint256 i = 0; i < input.length; ) {
|
|
@@ -12,8 +12,10 @@ abstract contract TokenHelper {
|
|
|
12
12
|
address from,
|
|
13
13
|
uint256 amount
|
|
14
14
|
) internal {
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
if (token == NATIVE) require(msg.value == amount, "eth mismatch");
|
|
16
|
+
else if (amount != 0) {
|
|
17
|
+
IERC20(token).safeTransferFrom(from, address(this), amount);
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
function _transferOut(
|
|
@@ -248,54 +248,56 @@ library LogExpMath {
|
|
|
248
248
|
* Reverts if ln(x) * y is smaller than `MIN_NATURAL_EXPONENT`, or larger than `MAX_NATURAL_EXPONENT`.
|
|
249
249
|
*/
|
|
250
250
|
function pow(uint256 x, uint256 y) internal pure returns (uint256) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
unchecked {
|
|
252
|
+
if (y == 0) {
|
|
253
|
+
// We solve the 0^0 indetermination by making it equal one.
|
|
254
|
+
return uint256(ONE_18);
|
|
255
|
+
}
|
|
255
256
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
if (x == 0) {
|
|
258
|
+
return 0;
|
|
259
|
+
}
|
|
259
260
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
261
|
+
// Instead of computing x^y directly, we instead rely on the properties of logarithms and exponentiation to
|
|
262
|
+
// arrive at that r`esult. In particular, exp(ln(x)) = x, and ln(x^y) = y * ln(x). This means
|
|
263
|
+
// x^y = exp(y * ln(x)).
|
|
264
|
+
|
|
265
|
+
// The ln function takes a signed value, so we need to make sure x fits in the signed 256 bit range.
|
|
266
|
+
require(x < 2**255, "x out of bounds");
|
|
267
|
+
int256 x_int256 = int256(x);
|
|
268
|
+
|
|
269
|
+
// We will compute y * ln(x) in a single step. Depending on the value of x, we can either use ln or ln_36. In
|
|
270
|
+
// both cases, we leave the division by ONE_18 (due to fixed point multiplication) to the end.
|
|
271
|
+
|
|
272
|
+
// This prevents y * ln(x) from overflowing, and at the same time guarantees y fits in the signed 256 bit range.
|
|
273
|
+
require(y < MILD_EXPONENT_BOUND, "y out of bounds");
|
|
274
|
+
int256 y_int256 = int256(y);
|
|
275
|
+
|
|
276
|
+
int256 logx_times_y;
|
|
277
|
+
if (LN_36_LOWER_BOUND < x_int256 && x_int256 < LN_36_UPPER_BOUND) {
|
|
278
|
+
int256 ln_36_x = _ln_36(x_int256);
|
|
279
|
+
|
|
280
|
+
// ln_36_x has 36 decimal places, so multiplying by y_int256 isn't as straightforward, since we can't just
|
|
281
|
+
// bring y_int256 to 36 decimal places, as it might overflow. Instead, we perform two 18 decimal
|
|
282
|
+
// multiplications and add the results: one with the first 18 decimals of ln_36_x, and one with the
|
|
283
|
+
// (downscaled) last 18 decimals.
|
|
284
|
+
logx_times_y = ((ln_36_x / ONE_18) *
|
|
285
|
+
y_int256 +
|
|
286
|
+
((ln_36_x % ONE_18) * y_int256) /
|
|
287
|
+
ONE_18);
|
|
288
|
+
} else {
|
|
289
|
+
logx_times_y = _ln(x_int256) * y_int256;
|
|
290
|
+
}
|
|
291
|
+
logx_times_y /= ONE_18;
|
|
291
292
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
293
|
+
// Finally, we compute exp(y * ln(x)) to arrive at x^y
|
|
294
|
+
require(
|
|
295
|
+
MIN_NATURAL_EXPONENT <= logx_times_y && logx_times_y <= MAX_NATURAL_EXPONENT,
|
|
296
|
+
"product out of bounds"
|
|
297
|
+
);
|
|
297
298
|
|
|
298
|
-
|
|
299
|
+
return uint256(exp(logx_times_y));
|
|
300
|
+
}
|
|
299
301
|
}
|
|
300
302
|
|
|
301
303
|
/**
|
|
@@ -85,7 +85,7 @@ library MarketApproxLib {
|
|
|
85
85
|
|
|
86
86
|
if (approx.guessMax == type(uint256).max) approx.guessMax = calcMaxPtIn(comp.totalAsset);
|
|
87
87
|
|
|
88
|
-
vars.minAssetOut = index.
|
|
88
|
+
vars.minAssetOut = index.scyToAssetUp(minScyOut);
|
|
89
89
|
|
|
90
90
|
for (uint256 iter = 0; iter < approx.maxIteration; ) {
|
|
91
91
|
vars.netPtInGuess = getCurrentGuess(iter, approx);
|
|
@@ -155,7 +155,7 @@ library MarketApproxLib {
|
|
|
155
155
|
returns (
|
|
156
156
|
uint256, /*netYtOut*/
|
|
157
157
|
uint256, /*netScyIn*/
|
|
158
|
-
uint256
|
|
158
|
+
uint256 /*netScyToReserve*/
|
|
159
159
|
)
|
|
160
160
|
{
|
|
161
161
|
/*
|
|
@@ -254,7 +254,7 @@ library MarketApproxLib {
|
|
|
254
254
|
returns (
|
|
255
255
|
uint256, /*netPtOut*/
|
|
256
256
|
uint256, /*netScyIn*/
|
|
257
|
-
uint256
|
|
257
|
+
uint256 /*netScyToReserve*/
|
|
258
258
|
)
|
|
259
259
|
{
|
|
260
260
|
/*
|
|
@@ -336,7 +336,7 @@ library MarketApproxLib {
|
|
|
336
336
|
returns (
|
|
337
337
|
uint256, /*netYtIn*/
|
|
338
338
|
uint256, /*netScyOut*/
|
|
339
|
-
uint256
|
|
339
|
+
uint256 /*netScyToReserve*/
|
|
340
340
|
)
|
|
341
341
|
{
|
|
342
342
|
/*
|
|
@@ -448,9 +448,7 @@ library MarketApproxLib {
|
|
|
448
448
|
pure
|
|
449
449
|
returns (uint256)
|
|
450
450
|
{
|
|
451
|
-
int256 logitP = (
|
|
452
|
-
.mulDown(comp.rateScalar)
|
|
453
|
-
.exp();
|
|
451
|
+
int256 logitP = (comp.feeRate - comp.rateAnchor).mulDown(comp.rateScalar).exp();
|
|
454
452
|
int256 proportion = logitP.divDown(logitP + Math.IONE);
|
|
455
453
|
int256 numerator = proportion.mulDown(totalPt + comp.totalAsset);
|
|
456
454
|
int256 maxPtOut = totalPt - numerator;
|
|
@@ -159,7 +159,9 @@ library MarketMathCore {
|
|
|
159
159
|
/// MATH
|
|
160
160
|
/// ------------------------------------------------------------
|
|
161
161
|
if (market.totalLp == 0) {
|
|
162
|
-
lpToAccount =
|
|
162
|
+
lpToAccount =
|
|
163
|
+
Math.sqrt((index.scyToAsset(scyDesired) * ptDesired).Uint()).Int() -
|
|
164
|
+
MINIMUM_LIQUIDITY;
|
|
163
165
|
lpToReserve = MINIMUM_LIQUIDITY;
|
|
164
166
|
scyUsed = scyDesired;
|
|
165
167
|
ptUsed = ptDesired;
|
|
@@ -241,7 +243,15 @@ library MarketMathCore {
|
|
|
241
243
|
/// ------------------------------------------------------------
|
|
242
244
|
/// WRITE
|
|
243
245
|
/// ------------------------------------------------------------
|
|
244
|
-
_setNewMarketStateTrade(
|
|
246
|
+
_setNewMarketStateTrade(
|
|
247
|
+
market,
|
|
248
|
+
comp,
|
|
249
|
+
index,
|
|
250
|
+
netPtToAccount,
|
|
251
|
+
netScyToAccount,
|
|
252
|
+
netScyToReserve,
|
|
253
|
+
blockTime
|
|
254
|
+
);
|
|
245
255
|
}
|
|
246
256
|
|
|
247
257
|
function getMarketPreCompute(
|
|
@@ -294,8 +304,6 @@ library MarketMathCore {
|
|
|
294
304
|
|
|
295
305
|
netAssetToReserve = (fee * market.reserveFeePercent.Int()) / PERCENTAGE_DECIMALS;
|
|
296
306
|
netAssetToAccount = preFeeAssetToAccount - fee;
|
|
297
|
-
// netAssetToMarket = (preFeeAssetToAccount - fee + netAssetToReserve)
|
|
298
|
-
// .neg();
|
|
299
307
|
}
|
|
300
308
|
|
|
301
309
|
function _setNewMarketStateTrade(
|
|
@@ -304,6 +312,7 @@ library MarketMathCore {
|
|
|
304
312
|
SCYIndex index,
|
|
305
313
|
int256 netPtToAccount,
|
|
306
314
|
int256 netScyToAccount,
|
|
315
|
+
int256 netScyToReserve,
|
|
307
316
|
uint256 blockTime
|
|
308
317
|
) internal pure {
|
|
309
318
|
uint256 timeToExpiry = market.expiry - blockTime;
|
|
@@ -311,7 +320,7 @@ library MarketMathCore {
|
|
|
311
320
|
market.lastTradeTime = blockTime;
|
|
312
321
|
|
|
313
322
|
market.totalPt = market.totalPt.subNoNeg(netPtToAccount);
|
|
314
|
-
market.totalScy = market.totalScy.subNoNeg(netScyToAccount);
|
|
323
|
+
market.totalScy = market.totalScy.subNoNeg(netScyToAccount + netScyToReserve);
|
|
315
324
|
|
|
316
325
|
market.lastLnImpliedRate = _getLnImpliedRate(
|
|
317
326
|
market.totalPt,
|
|
@@ -59,6 +59,20 @@ library Math {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// @author Uniswap
|
|
63
|
+
function sqrt(uint256 y) internal pure returns (uint256 z) {
|
|
64
|
+
if (y > 3) {
|
|
65
|
+
z = y;
|
|
66
|
+
uint256 x = y / 2 + 1;
|
|
67
|
+
while (x < z) {
|
|
68
|
+
z = x;
|
|
69
|
+
x = (y / x + x) / 2;
|
|
70
|
+
}
|
|
71
|
+
} else if (y != 0) {
|
|
72
|
+
z = 1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
function abs(int256 x) internal pure returns (uint256) {
|
|
63
77
|
return uint256(x > 0 ? x : -x);
|
|
64
78
|
}
|