@pendle/core-v2 0.7.1-beta-2 → 0.8.0-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 +33 -17
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.json +2 -2
- 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 +33 -17
- 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 +33 -17
- 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 +33 -17
- 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 +33 -17
- 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 +31 -15
- 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 +31 -15
- 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/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.json +0 -26
- 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 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- 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 +125 -111
- 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 +77 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +51 -20
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +72 -93
- 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 +3 -3
- 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/IPActionCore.sol/IPActionCore.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/IPAllAction.sol/IPAllAction.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 +48 -83
- 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/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/IPYieldContractFactory.sol/IPYieldContractFactory.json +30 -4
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +8 -92
- 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/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.json +31 -2
- 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/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/SCY/SCYUtils.sol/SCYUtils.json +2 -2
- 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/ExpiryUtilsLib.sol/ExpiryUtils.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.json +2 -2
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.json +2 -2
- 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/math/WeekMath.sol/WeekMath.json +2 -2
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.json +2 -2
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.json +2 -2
- 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 +2 -2
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/periphery/PendleGovernanceManager.sol/PendleGovernanceManager.json +2 -2
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol +16 -12
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +3 -3
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +20 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +29 -2
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +63 -41
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +0 -7
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +1 -1
- package/contracts/core/LiquidityMining/PendleGauge.sol +24 -8
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +47 -96
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +86 -73
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +17 -16
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +1 -1
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +3 -4
- package/contracts/core/Market/PendleMarket.sol +32 -62
- package/contracts/core/PendleRouter.sol +1 -1
- package/contracts/core/YieldContracts/InterestManagerYT.sol +11 -8
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +18 -12
- package/contracts/core/YieldContracts/PendleYieldToken.sol +167 -140
- package/contracts/core/actions/ActionCallback.sol +11 -10
- package/contracts/core/actions/ActionCore.sol +84 -22
- package/contracts/core/actions/ActionYT.sol +33 -15
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +4 -15
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +20 -50
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +2 -12
- package/contracts/interfaces/IPActionCore.sol +72 -1
- package/contracts/interfaces/IPActionYT.sol +15 -0
- package/contracts/interfaces/IPMarket.sol +7 -26
- package/contracts/interfaces/IPVeToken.sol +0 -2
- package/contracts/interfaces/IPVotingEscrow.sol +1 -1
- package/contracts/interfaces/IPYieldContractFactory.sol +6 -2
- package/contracts/interfaces/IPYieldToken.sol +21 -11
- package/contracts/interfaces/ISuperComposableYield.sol +22 -28
- package/contracts/interfaces/IYearnVault.sol +8 -0
- package/contracts/libraries/RewardManager.sol +9 -6
- package/contracts/libraries/RewardManagerAbstract.sol +6 -8
- package/contracts/libraries/SCY/SCYIndex.sol +10 -0
- package/contracts/libraries/VeBalanceLib.sol +0 -1
- package/contracts/libraries/helpers/ArrayLib.sol +11 -0
- package/contracts/libraries/helpers/TokenHelper.sol +6 -5
- package/contracts/libraries/math/MarketApproxLib.sol +91 -36
- package/contracts/libraries/math/Math.sol +2 -4
- package/contracts/offchain-helpers/RouterStatic.sol +2 -2
- package/deployments/43113-core.json +11 -11
- package/deployments/43113-markets/benqi-market-0xF3150c14F776c50C9D397054d38979c7B77FC41D.json +7 -0
- package/deployments/80001-core.json +10 -10
- package/deployments/80001-markets/benqi-market-0x150b6eb90Bf636eC0c4328d13d1e1d4adDBAF904.json +7 -0
- package/package.json +2 -2
- package/typechain-types/ActionCore.ts +8 -8
- package/typechain-types/CelerReceiver.ts +267 -0
- package/typechain-types/CelerSender.ts +164 -0
- package/typechain-types/IPActionCore.ts +8 -8
- package/typechain-types/IPAllAction.ts +8 -8
- package/typechain-types/IPMarket.ts +66 -109
- package/typechain-types/IPVotingEscrowController.ts +154 -0
- package/typechain-types/IPYieldContractFactory.ts +34 -0
- package/typechain-types/IPYieldToken.ts +12 -112
- package/typechain-types/ISuperComposableYield.ts +54 -10
- package/typechain-types/PendleAaveV3SCY.ts +54 -29
- package/typechain-types/PendleBtrflyScy.ts +56 -58
- package/typechain-types/PendleERC4626SCY.ts +54 -29
- package/typechain-types/PendleGauge.ts +0 -32
- package/typechain-types/PendleGaugeController.ts +282 -0
- package/typechain-types/PendleGaugeControllerMainchain.ts +346 -0
- package/typechain-types/PendleGaugeControllerSidechain.ts +460 -0
- package/typechain-types/PendleJoeLpSCY.ts +56 -58
- package/typechain-types/PendleMarket.ts +169 -140
- package/typechain-types/PendlePrincipalToken.ts +104 -0
- package/typechain-types/PendleQiTokenSCY.ts +54 -29
- package/typechain-types/PendleVotingController.ts +865 -0
- package/typechain-types/PendleWstEthSCY.ts +54 -29
- package/typechain-types/PendleYearnVaultSCY.ts +54 -29
- package/typechain-types/PendleYieldContractFactory.ts +66 -19
- package/typechain-types/PendleYieldToken.ts +122 -158
- package/typechain-types/SCYBase.ts +54 -29
- package/typechain-types/SCYBaseWithRewards.ts +54 -29
- package/typechain-types/VotingControllerStorage.ts +410 -0
- package/typechain-types/VotingEscrowController.ts +154 -0
- package/typechain-types/VotingEscrowToken.ts +335 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +2 -2
- package/typechain-types/factories/ActionYT__factory.ts +1 -1
- package/typechain-types/factories/CelerReceiver__factory.ts +140 -0
- package/typechain-types/factories/CelerSender__factory.ts +67 -0
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IPActionCore__factory.ts +1 -1
- package/typechain-types/factories/IPAllAction__factory.ts +1 -1
- package/typechain-types/factories/IPMarket__factory.ts +48 -83
- package/typechain-types/factories/IPVotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +30 -4
- package/typechain-types/factories/IPYieldToken__factory.ts +6 -90
- package/typechain-types/factories/ISuperComposableYield__factory.ts +31 -2
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +32 -16
- package/typechain-types/factories/PendleBtrflyScy__factory.ts +52 -28
- 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 +32 -16
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerMainchain__factory.ts +269 -0
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleGaugeControllerSidechain__factory.ts +328 -0
- package/typechain-types/factories/PendleGaugeController__factory.ts +149 -0
- package/typechain-types/factories/PendleGauge__factory.ts +0 -26
- package/typechain-types/factories/PendleGovernanceManager__factory.ts +1 -1
- package/typechain-types/factories/PendleJoeLpSCY__factory.ts +34 -28
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMarket__factory.ts +124 -110
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +76 -1
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingController__factory.ts +584 -0
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleYearnVaultSCY__factory.ts +32 -16
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +54 -19
- package/typechain-types/factories/PendleYieldToken__factory.ts +70 -91
- package/typechain-types/factories/RouterStatic__factory.ts +1 -1
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +31 -15
- package/typechain-types/factories/SCYBase__factory.ts +31 -15
- package/typechain-types/factories/VotingControllerStorage__factory.ts +298 -0
- package/typechain-types/factories/VotingEscrowController__factory.ts +80 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowToken__factory.ts +225 -0
- package/typechain-types/hardhat.d.ts +0 -27
- package/typechain-types/index.ts +0 -6
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.json +0 -635
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.json +0 -653
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.json +0 -67
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.json +0 -10
- package/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol +0 -123
- package/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol +0 -245
- package/contracts/interfaces/IPMarketAddRemoveCallback.sol +0 -18
- package/contracts/libraries/solmate/Bytes32AddressLib.sol +0 -14
- package/deployments/43113-markets/benqi-market.json +0 -7
- package/deployments/80001-markets/benqi-market.json +0 -7
|
@@ -30,15 +30,19 @@ interface IPYieldContractFactory {
|
|
|
30
30
|
|
|
31
31
|
event SetInterestFeeRate(uint256 newInterestFeeRate);
|
|
32
32
|
|
|
33
|
+
event SetRewardFeeRate(uint256 newInterestFeeRate);
|
|
34
|
+
|
|
33
35
|
event SetTreasury(address indexed treasury);
|
|
34
36
|
|
|
35
37
|
function getPT(address SCY, uint256 expiry) external view returns (address);
|
|
36
38
|
|
|
37
39
|
function getYT(address SCY, uint256 expiry) external view returns (address);
|
|
38
40
|
|
|
39
|
-
function expiryDivisor() external view returns (
|
|
41
|
+
function expiryDivisor() external view returns (uint96);
|
|
42
|
+
|
|
43
|
+
function interestFeeRate() external view returns (uint128);
|
|
40
44
|
|
|
41
|
-
function
|
|
45
|
+
function rewardFeeRate() external view returns (uint128);
|
|
42
46
|
|
|
43
47
|
function treasury() external view returns (address);
|
|
44
48
|
|
|
@@ -5,15 +5,27 @@ import "./IRewardManager.sol";
|
|
|
5
5
|
import "./IPInterestManagerYT.sol";
|
|
6
6
|
|
|
7
7
|
interface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT {
|
|
8
|
+
event NewInterestIndex(
|
|
9
|
+
uint256 indexed newIndex
|
|
10
|
+
);
|
|
11
|
+
|
|
8
12
|
event Mint(
|
|
9
13
|
address indexed caller,
|
|
10
14
|
address indexed receiverPT,
|
|
11
15
|
address indexed receiverYT,
|
|
12
|
-
uint256
|
|
16
|
+
uint256 amountScyToMint,
|
|
17
|
+
uint256 amountPYOut
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
event Burn(
|
|
21
|
+
address indexed caller,
|
|
22
|
+
address indexed receiver,
|
|
23
|
+
uint256 amountPYToRedeem,
|
|
24
|
+
uint256 amountScyOut
|
|
13
25
|
);
|
|
14
|
-
event Redeem(address indexed caller, address indexed receiver, uint256 amount);
|
|
15
26
|
|
|
16
27
|
event RedeemRewards(address indexed user, uint256[] amountRewardsOut);
|
|
28
|
+
|
|
17
29
|
event RedeemInterest(address indexed user, uint256 interestOut);
|
|
18
30
|
|
|
19
31
|
event WithdrawFeeToTreasury(uint256[] amountRewardsOut, uint256 scyOut);
|
|
@@ -22,17 +34,15 @@ interface IPYieldToken is IERC20Metadata, IRewardManager, IPInterestManagerYT {
|
|
|
22
34
|
|
|
23
35
|
function redeemPY(address receiver) external returns (uint256 amountScyOut);
|
|
24
36
|
|
|
25
|
-
function
|
|
26
|
-
external
|
|
27
|
-
returns (uint256 totalAmountScyOut);
|
|
28
|
-
|
|
29
|
-
function redeemDueInterestAndRewards(address user)
|
|
37
|
+
function redeemPYMulti(address[] calldata receivers, uint256[] calldata amountPYToRedeems)
|
|
30
38
|
external
|
|
31
|
-
returns (uint256
|
|
32
|
-
|
|
33
|
-
function redeemDueInterest(address user) external returns (uint256 interestOut);
|
|
39
|
+
returns (uint256[] memory amountScyOuts);
|
|
34
40
|
|
|
35
|
-
function
|
|
41
|
+
function redeemDueInterestAndRewards(
|
|
42
|
+
address user,
|
|
43
|
+
bool redeemInterest,
|
|
44
|
+
bool redeemRewards
|
|
45
|
+
) external returns (uint256 interestOut, uint256[] memory rewardsOut);
|
|
36
46
|
|
|
37
47
|
function rewardIndexesCurrent() external returns (uint256[] memory);
|
|
38
48
|
|
|
@@ -56,58 +56,42 @@ interface ISuperComposableYield is IERC20Metadata {
|
|
|
56
56
|
* @notice mints an amount of shares by depositing a base token.
|
|
57
57
|
* @param receiver shares recipient address
|
|
58
58
|
* @param tokenIn address of the base tokens to mint shares
|
|
59
|
-
* @param
|
|
59
|
+
* @param amountTokenToDeposit amount of base tokens to be transferred from (`msg.sender`)
|
|
60
60
|
* @param minSharesOut reverts if amount of shares minted is lower than this
|
|
61
61
|
* @return amountSharesOut amount of shares minted
|
|
62
|
-
* @dev
|
|
63
|
-
*
|
|
64
|
-
* This contract receives base tokens using these two (possibly both) methods:
|
|
65
|
-
* - The tokens have been transferred directly to this contract prior to calling deposit().
|
|
66
|
-
* - Exactly `amountTokenToPull` are transferred to this contract using `transferFrom()` upon calling deposit().
|
|
67
|
-
*
|
|
68
|
-
* The amount of shares minted will be based on the combined amount of base tokens deposited
|
|
69
|
-
* using the given two methods.
|
|
70
|
-
*
|
|
71
|
-
* Emits a {Deposit} event
|
|
62
|
+
* @dev Emits a {Deposit} event
|
|
72
63
|
*
|
|
73
64
|
* Requirements:
|
|
74
65
|
* - (`baseTokenIn`) must be a valid base token.
|
|
75
|
-
* - There must be an ongoing approval from (`msg.sender`) for this contract with
|
|
76
|
-
* at least `amountTokenToPull` base tokens.
|
|
77
66
|
*/
|
|
78
67
|
function deposit(
|
|
79
68
|
address receiver,
|
|
80
69
|
address tokenIn,
|
|
81
|
-
uint256
|
|
70
|
+
uint256 amountTokenToDeposit,
|
|
82
71
|
uint256 minSharesOut
|
|
83
72
|
) external payable returns (uint256 amountSharesOut);
|
|
84
73
|
|
|
85
74
|
/**
|
|
86
75
|
* @notice redeems an amount of base tokens by burning some shares
|
|
87
76
|
* @param receiver recipient address
|
|
88
|
-
* @param
|
|
77
|
+
* @param amountSharesToRedeem amount of shares to be burned from (`msg.sender`)
|
|
89
78
|
* @param tokenOut address of the base token to be redeemed
|
|
90
79
|
* @param minTokenOut reverts if amount of base token redeemed is lower than this
|
|
91
80
|
* @return amountTokenOut amount of base tokens redeemed
|
|
92
|
-
* @dev
|
|
93
|
-
*
|
|
94
|
-
* This contract receives shares using these two (possibly both) methods:
|
|
95
|
-
* - The shares have been transferred directly to this contract prior to calling redeem().
|
|
96
|
-
* - Exactly `amountSharesToPull` are transferred to this contract using `transferFrom()` upon calling redeem().
|
|
97
|
-
*
|
|
98
|
-
* The amount of base tokens redeemed based on the combined amount of shares deposited
|
|
99
|
-
* using the given two methods
|
|
100
|
-
*
|
|
101
|
-
* Emits a {Redeem} event
|
|
81
|
+
* @dev Emits a {Redeem} event
|
|
102
82
|
*
|
|
103
83
|
* Requirements:
|
|
104
84
|
* - (`tokenOut`) must be a valid base token.
|
|
105
|
-
* - There must be an ongoing approval from (`msg.sender`) for this contract with
|
|
106
|
-
* at least `amountSharesToPull` shares.
|
|
107
85
|
*/
|
|
108
86
|
function redeem(
|
|
109
87
|
address receiver,
|
|
110
|
-
uint256
|
|
88
|
+
uint256 amountSharesToRedeem,
|
|
89
|
+
address tokenOut,
|
|
90
|
+
uint256 minTokenOut
|
|
91
|
+
) external returns (uint256 amountTokenOut);
|
|
92
|
+
|
|
93
|
+
function redeemAfterTransfer(
|
|
94
|
+
address receiver,
|
|
111
95
|
address tokenOut,
|
|
112
96
|
uint256 minTokenOut
|
|
113
97
|
) external returns (uint256 amountTokenOut);
|
|
@@ -163,6 +147,16 @@ interface ISuperComposableYield is IERC20Metadata {
|
|
|
163
147
|
*/
|
|
164
148
|
function isValidBaseToken(address token) external view returns (bool);
|
|
165
149
|
|
|
150
|
+
function previewDeposit(address tokenIn, uint256 amountTokenToDeposit)
|
|
151
|
+
external
|
|
152
|
+
view
|
|
153
|
+
returns (uint256 amountSharesOut);
|
|
154
|
+
|
|
155
|
+
function previewRedeem(address tokenOut, uint256 amountSharesToRedeem)
|
|
156
|
+
external
|
|
157
|
+
view
|
|
158
|
+
returns (uint256 amountTokenOut);
|
|
159
|
+
|
|
166
160
|
/**
|
|
167
161
|
* @notice This function contains information to interpret what the asset is
|
|
168
162
|
* @notice decimals is the decimals to format asset balances
|
|
@@ -26,9 +26,17 @@ pragma solidity 0.8.15;
|
|
|
26
26
|
interface IYearnVault {
|
|
27
27
|
function deposit(uint256 amount) external returns (uint256);
|
|
28
28
|
|
|
29
|
+
function deposit(uint256 amount, address recipient) external returns (uint256);
|
|
30
|
+
|
|
29
31
|
function withdraw(uint256 maxShares) external returns (uint256);
|
|
30
32
|
|
|
31
33
|
function pricePerShare() external view returns (uint256);
|
|
32
34
|
|
|
33
35
|
function token() external view returns (address);
|
|
36
|
+
|
|
37
|
+
function depositLimit() external view returns (uint256);
|
|
38
|
+
|
|
39
|
+
function totalAssets() external view returns (uint256);
|
|
40
|
+
|
|
41
|
+
function decimals() external view returns (uint256);
|
|
34
42
|
}
|
|
@@ -35,21 +35,20 @@ abstract contract RewardManager is RewardManagerAbstract {
|
|
|
35
35
|
|
|
36
36
|
uint256 totalShares = _rewardSharesTotal();
|
|
37
37
|
|
|
38
|
-
uint256[] memory preBalances = _selfBalances(tokens);
|
|
39
|
-
|
|
40
38
|
_redeemExternalReward();
|
|
41
39
|
|
|
42
|
-
uint256[] memory accrued = _selfBalances(tokens).sub(preBalances);
|
|
43
|
-
|
|
44
40
|
for (uint256 i = 0; i < tokens.length; ++i) {
|
|
45
41
|
address token = tokens[i];
|
|
42
|
+
|
|
43
|
+
// the entire token balance of the contract must be the rewards of the contract
|
|
44
|
+
uint256 accrued = _selfBalance(tokens[i]) - rewardState[token].lastBalance;
|
|
46
45
|
uint256 index = rewardState[token].index;
|
|
47
46
|
|
|
48
47
|
if (index == 0) index = INITIAL_REWARD_INDEX;
|
|
49
|
-
if (totalShares != 0) index += accrued
|
|
48
|
+
if (totalShares != 0) index += accrued.divDown(totalShares);
|
|
50
49
|
|
|
51
50
|
rewardState[token].index = index.Uint128();
|
|
52
|
-
rewardState[token].lastBalance += accrued
|
|
51
|
+
rewardState[token].lastBalance += accrued.Uint128();
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -75,4 +74,8 @@ abstract contract RewardManager is RewardManagerAbstract {
|
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
}
|
|
77
|
+
|
|
78
|
+
function _getRewardTokens() internal view virtual returns (address[] memory);
|
|
79
|
+
|
|
80
|
+
function _rewardSharesTotal() internal view virtual returns (uint256);
|
|
78
81
|
}
|
|
@@ -29,17 +29,19 @@ abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
|
|
|
29
29
|
if (tokens.length == 0) return;
|
|
30
30
|
|
|
31
31
|
if (user1 != address(0) && user1 != address(this))
|
|
32
|
-
|
|
32
|
+
_distributeRewardsPrivate(user1, tokens, indexes);
|
|
33
33
|
if (user2 != address(0) && user2 != address(this))
|
|
34
|
-
|
|
34
|
+
_distributeRewardsPrivate(user2, tokens, indexes);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
function
|
|
37
|
+
// should only be callable from `_updateAndDistributeRewardsForTwo` to guarantee user != address(0) && user != address(this)
|
|
38
|
+
function _distributeRewardsPrivate(
|
|
39
39
|
address user,
|
|
40
40
|
address[] memory tokens,
|
|
41
41
|
uint256[] memory indexes
|
|
42
42
|
) private {
|
|
43
|
+
assert(user != address(0) && user != address(this));
|
|
44
|
+
|
|
43
45
|
uint256 userShares = _rewardSharesUser(user);
|
|
44
46
|
|
|
45
47
|
for (uint256 i = 0; i < tokens.length; ++i) {
|
|
@@ -77,9 +79,5 @@ abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
|
|
|
77
79
|
virtual
|
|
78
80
|
returns (uint256[] memory rewardAmounts);
|
|
79
81
|
|
|
80
|
-
function _getRewardTokens() internal view virtual returns (address[] memory);
|
|
81
|
-
|
|
82
82
|
function _rewardSharesUser(address user) internal view virtual returns (uint256);
|
|
83
|
-
|
|
84
|
-
function _rewardSharesTotal() internal view virtual returns (uint256);
|
|
85
83
|
}
|
|
@@ -34,6 +34,16 @@ library SCYIndexLib {
|
|
|
34
34
|
return SCYUtils.assetToScy(SCYIndex.unwrap(index), assetAmount);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
|
|
38
|
+
function scyToAssetUp(SCYIndex index, uint256 scyAmount)
|
|
39
|
+
internal
|
|
40
|
+
pure
|
|
41
|
+
returns (uint256)
|
|
42
|
+
{
|
|
43
|
+
uint256 _index = SCYIndex.unwrap(index);
|
|
44
|
+
return SCYUtils.scyToAsset(_index, scyAmount)+ _index.rawDivUp(SCYUtils.ONE);
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
function scyToAsset(SCYIndex index, int256 scyAmount)
|
|
38
48
|
internal
|
|
39
49
|
pure
|
|
@@ -19,6 +19,17 @@ library ArrayLib {
|
|
|
19
19
|
return output;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
function sum(uint256[] memory input) internal pure returns (uint256) {
|
|
23
|
+
uint256 value = 0;
|
|
24
|
+
for (uint256 i = 0; i < input.length; ) {
|
|
25
|
+
value += input[i];
|
|
26
|
+
unchecked {
|
|
27
|
+
i++;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
function contains(address[] memory array, address element) internal pure returns (bool) {
|
|
23
34
|
uint256 length = array.length;
|
|
24
35
|
for (uint256 i = 0; i < length; ) {
|
|
@@ -50,19 +50,20 @@ abstract contract TokenHelper {
|
|
|
50
50
|
uint256 totalAmount,
|
|
51
51
|
address[] memory tos,
|
|
52
52
|
uint256[] memory maxAmounts
|
|
53
|
-
) internal {
|
|
53
|
+
) internal returns (uint256 leftover) {
|
|
54
54
|
uint256 numTos = tos.length;
|
|
55
55
|
require(numTos == maxAmounts.length, "invalid length");
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
leftover = totalAmount;
|
|
58
58
|
for (uint256 i = 0; i < numTos; ) {
|
|
59
59
|
uint256 maxAmount = maxAmounts[i];
|
|
60
|
-
if (maxAmount >
|
|
61
|
-
maxAmount =
|
|
60
|
+
if (maxAmount > leftover) {
|
|
61
|
+
maxAmount = leftover;
|
|
62
62
|
}
|
|
63
63
|
_transferOut(token, tos[i], maxAmount);
|
|
64
64
|
unchecked {
|
|
65
|
-
|
|
65
|
+
leftover -= maxAmount;
|
|
66
|
+
if (leftover == 0) break;
|
|
66
67
|
i++;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -39,6 +39,7 @@ library MarketApproxLib {
|
|
|
39
39
|
struct VarsSwapPtForExactScy {
|
|
40
40
|
uint256 netPtInGuess;
|
|
41
41
|
int256 assetToAccount;
|
|
42
|
+
int256 assetToReserve;
|
|
42
43
|
uint256 netAssetOut;
|
|
43
44
|
uint256 minAssetOut;
|
|
44
45
|
uint256 largestGoodSlope;
|
|
@@ -58,7 +59,8 @@ library MarketApproxLib {
|
|
|
58
59
|
pure
|
|
59
60
|
returns (
|
|
60
61
|
uint256, /*netPtIn*/
|
|
61
|
-
uint256 /*netScyOut*/
|
|
62
|
+
uint256, /*netScyOut*/
|
|
63
|
+
uint256 /*netScyToReserve*/
|
|
62
64
|
)
|
|
63
65
|
{
|
|
64
66
|
/*
|
|
@@ -81,9 +83,8 @@ library MarketApproxLib {
|
|
|
81
83
|
VarsSwapPtForExactScy memory vars;
|
|
82
84
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
83
85
|
|
|
84
|
-
if (approx.guessMax == type(uint256).max)
|
|
85
|
-
|
|
86
|
-
}
|
|
86
|
+
if (approx.guessMax == type(uint256).max) approx.guessMax = calcMaxPtIn(comp.totalAsset);
|
|
87
|
+
|
|
87
88
|
vars.minAssetOut = index.scyToAsset(minScyOut);
|
|
88
89
|
|
|
89
90
|
for (uint256 iter = 0; iter < approx.maxIteration; ) {
|
|
@@ -100,7 +101,10 @@ library MarketApproxLib {
|
|
|
100
101
|
continue;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
(vars.assetToAccount, ) = market.calcTrade(
|
|
104
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
105
|
+
comp,
|
|
106
|
+
vars.netPtInGuess.neg()
|
|
107
|
+
);
|
|
104
108
|
vars.netAssetOut = vars.assetToAccount.Uint();
|
|
105
109
|
|
|
106
110
|
if (vars.netAssetOut >= vars.minAssetOut) {
|
|
@@ -111,7 +115,11 @@ library MarketApproxLib {
|
|
|
111
115
|
approx.eps
|
|
112
116
|
);
|
|
113
117
|
if (isAnswerAccepted)
|
|
114
|
-
return (
|
|
118
|
+
return (
|
|
119
|
+
vars.netPtInGuess,
|
|
120
|
+
index.assetToScy(vars.netAssetOut),
|
|
121
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
122
|
+
);
|
|
115
123
|
} else {
|
|
116
124
|
approx.guessMin = vars.netPtInGuess;
|
|
117
125
|
}
|
|
@@ -126,6 +134,7 @@ library MarketApproxLib {
|
|
|
126
134
|
struct VarsSwapExactScyForYt {
|
|
127
135
|
uint256 ptInGuess;
|
|
128
136
|
int256 assetToAccount;
|
|
137
|
+
int256 assetToReserve;
|
|
129
138
|
uint256 netAssetOut;
|
|
130
139
|
uint256 amountAssetNeedMore;
|
|
131
140
|
uint256 largestGoodSlope;
|
|
@@ -145,7 +154,8 @@ library MarketApproxLib {
|
|
|
145
154
|
pure
|
|
146
155
|
returns (
|
|
147
156
|
uint256, /*netYtOut*/
|
|
148
|
-
uint256 /*netScyIn*/
|
|
157
|
+
uint256, /*netScyIn*/
|
|
158
|
+
uint256
|
|
149
159
|
)
|
|
150
160
|
{
|
|
151
161
|
/*
|
|
@@ -174,9 +184,7 @@ library MarketApproxLib {
|
|
|
174
184
|
VarsSwapExactScyForYt memory vars;
|
|
175
185
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
176
186
|
|
|
177
|
-
if (approx.guessMax == type(uint256).max)
|
|
178
|
-
approx.guessMax = calcMaxPtIn(market.totalPt, comp.totalAsset);
|
|
179
|
-
}
|
|
187
|
+
if (approx.guessMax == type(uint256).max) approx.guessMax = calcMaxPtIn(comp.totalAsset);
|
|
180
188
|
|
|
181
189
|
vars.maxAssetIn = index.scyToAsset(maxScyIn);
|
|
182
190
|
|
|
@@ -195,7 +203,10 @@ library MarketApproxLib {
|
|
|
195
203
|
continue;
|
|
196
204
|
}
|
|
197
205
|
|
|
198
|
-
(vars.assetToAccount, ) = market.calcTrade(
|
|
206
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
207
|
+
comp,
|
|
208
|
+
vars.ptInGuess.neg()
|
|
209
|
+
);
|
|
199
210
|
vars.netAssetOut = vars.assetToAccount.Uint();
|
|
200
211
|
vars.amountAssetNeedMore = vars.ptInGuess - vars.netAssetOut;
|
|
201
212
|
|
|
@@ -207,7 +218,11 @@ library MarketApproxLib {
|
|
|
207
218
|
approx.eps
|
|
208
219
|
);
|
|
209
220
|
if (isAnswerAccepted)
|
|
210
|
-
return (
|
|
221
|
+
return (
|
|
222
|
+
vars.ptInGuess,
|
|
223
|
+
index.assetToScy(vars.amountAssetNeedMore),
|
|
224
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
225
|
+
);
|
|
211
226
|
} else {
|
|
212
227
|
approx.guessMax = vars.ptInGuess - 1;
|
|
213
228
|
}
|
|
@@ -219,6 +234,14 @@ library MarketApproxLib {
|
|
|
219
234
|
revert("approx fail");
|
|
220
235
|
}
|
|
221
236
|
|
|
237
|
+
struct VarsSwapExactScyForPt {
|
|
238
|
+
uint256 maxAssetIn;
|
|
239
|
+
uint256 ptOutGuess;
|
|
240
|
+
int256 assetToAccount;
|
|
241
|
+
int256 assetToReserve;
|
|
242
|
+
uint256 netAssetIn;
|
|
243
|
+
}
|
|
244
|
+
|
|
222
245
|
function approxSwapExactScyForPt(
|
|
223
246
|
MarketState memory market,
|
|
224
247
|
SCYIndex index,
|
|
@@ -230,7 +253,8 @@ library MarketApproxLib {
|
|
|
230
253
|
pure
|
|
231
254
|
returns (
|
|
232
255
|
uint256, /*netPtOut*/
|
|
233
|
-
uint256 /*netScyIn*/
|
|
256
|
+
uint256, /*netScyIn*/
|
|
257
|
+
uint256
|
|
234
258
|
)
|
|
235
259
|
{
|
|
236
260
|
/*
|
|
@@ -251,24 +275,37 @@ library MarketApproxLib {
|
|
|
251
275
|
|
|
252
276
|
require(isValidApproxParams(approx), "invalid approx approx");
|
|
253
277
|
|
|
278
|
+
VarsSwapExactScyForPt memory vars;
|
|
254
279
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
255
280
|
if (approx.guessMax == type(uint256).max) {
|
|
256
281
|
approx.guessMax = calcMaxPtOut(market.totalPt, comp);
|
|
257
282
|
}
|
|
258
283
|
|
|
259
|
-
|
|
284
|
+
vars.maxAssetIn = index.scyToAsset(maxScyIn);
|
|
260
285
|
|
|
261
286
|
for (uint256 iter = 0; iter < approx.maxIteration; ) {
|
|
262
|
-
|
|
263
|
-
(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
287
|
+
vars.ptOutGuess = getCurrentGuess(iter, approx);
|
|
288
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
289
|
+
comp,
|
|
290
|
+
vars.ptOutGuess.Int()
|
|
291
|
+
);
|
|
292
|
+
vars.netAssetIn = vars.assetToAccount.abs();
|
|
293
|
+
|
|
294
|
+
if (vars.netAssetIn <= vars.maxAssetIn) {
|
|
295
|
+
approx.guessMin = vars.ptOutGuess;
|
|
296
|
+
bool isAnswerAccepted = Math.isASmallerApproxB(
|
|
297
|
+
vars.netAssetIn,
|
|
298
|
+
vars.maxAssetIn,
|
|
299
|
+
approx.eps
|
|
300
|
+
);
|
|
301
|
+
if (isAnswerAccepted)
|
|
302
|
+
return (
|
|
303
|
+
vars.ptOutGuess,
|
|
304
|
+
index.assetToScy(vars.netAssetIn),
|
|
305
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
306
|
+
);
|
|
270
307
|
} else {
|
|
271
|
-
approx.guessMax = ptOutGuess;
|
|
308
|
+
approx.guessMax = vars.ptOutGuess;
|
|
272
309
|
}
|
|
273
310
|
|
|
274
311
|
unchecked {
|
|
@@ -278,6 +315,15 @@ library MarketApproxLib {
|
|
|
278
315
|
revert("approx fail");
|
|
279
316
|
}
|
|
280
317
|
|
|
318
|
+
struct VarsSwapYtForExactScy {
|
|
319
|
+
uint256 minAssetOut;
|
|
320
|
+
uint256 ptOutGuess;
|
|
321
|
+
int256 assetToAccount;
|
|
322
|
+
int256 assetToReserve;
|
|
323
|
+
uint256 netAssetOwed;
|
|
324
|
+
uint256 netAssetOut;
|
|
325
|
+
}
|
|
326
|
+
|
|
281
327
|
function approxSwapYtForExactScy(
|
|
282
328
|
MarketState memory market,
|
|
283
329
|
SCYIndex index,
|
|
@@ -289,7 +335,8 @@ library MarketApproxLib {
|
|
|
289
335
|
pure
|
|
290
336
|
returns (
|
|
291
337
|
uint256, /*netYtIn*/
|
|
292
|
-
uint256 /*netScyOut*/
|
|
338
|
+
uint256, /*netScyOut*/
|
|
339
|
+
uint256
|
|
293
340
|
)
|
|
294
341
|
{
|
|
295
342
|
/*
|
|
@@ -315,32 +362,40 @@ library MarketApproxLib {
|
|
|
315
362
|
|
|
316
363
|
require(isValidApproxParams(approx), "invalid approx approx");
|
|
317
364
|
|
|
365
|
+
VarsSwapYtForExactScy memory vars;
|
|
318
366
|
MarketPreCompute memory comp = market.getMarketPreCompute(index, blockTime);
|
|
319
367
|
if (approx.guessMax == type(uint256).max) {
|
|
320
368
|
approx.guessMax = calcMaxPtOut(market.totalPt, comp);
|
|
321
369
|
}
|
|
322
370
|
|
|
323
|
-
|
|
371
|
+
vars.minAssetOut = index.scyToAsset(minScyOut);
|
|
324
372
|
|
|
325
373
|
for (uint256 iter = 0; iter < approx.maxIteration; ) {
|
|
326
374
|
// ytInGuess = ptOutGuess
|
|
327
|
-
|
|
375
|
+
vars.ptOutGuess = getCurrentGuess(iter, approx);
|
|
328
376
|
|
|
329
|
-
(
|
|
330
|
-
|
|
377
|
+
(vars.assetToAccount, vars.assetToReserve) = market.calcTrade(
|
|
378
|
+
comp,
|
|
379
|
+
vars.ptOutGuess.Int()
|
|
380
|
+
);
|
|
381
|
+
vars.netAssetOwed = vars.assetToAccount.abs();
|
|
331
382
|
|
|
332
383
|
// since ptOutGuess is between guessMin & guessMax, it's guaranteed that
|
|
333
384
|
// there are enough Yt to pair with ptOut
|
|
334
385
|
|
|
335
|
-
|
|
386
|
+
vars.netAssetOut = vars.ptOutGuess - vars.netAssetOwed;
|
|
336
387
|
|
|
337
|
-
if (netAssetOut >= minAssetOut) {
|
|
338
|
-
approx.guessMax = ptOutGuess;
|
|
339
|
-
if (Math.isAGreaterApproxB(netAssetOut, minAssetOut, approx.eps)) {
|
|
340
|
-
return (
|
|
388
|
+
if (vars.netAssetOut >= vars.minAssetOut) {
|
|
389
|
+
approx.guessMax = vars.ptOutGuess;
|
|
390
|
+
if (Math.isAGreaterApproxB(vars.netAssetOut, vars.minAssetOut, approx.eps)) {
|
|
391
|
+
return (
|
|
392
|
+
vars.ptOutGuess,
|
|
393
|
+
index.assetToScy(vars.netAssetOut),
|
|
394
|
+
index.assetToScy(vars.assetToReserve.Uint())
|
|
395
|
+
);
|
|
341
396
|
}
|
|
342
397
|
} else {
|
|
343
|
-
approx.guessMin = ptOutGuess + 1;
|
|
398
|
+
approx.guessMin = vars.ptOutGuess + 1;
|
|
344
399
|
}
|
|
345
400
|
|
|
346
401
|
unchecked {
|
|
@@ -403,8 +458,8 @@ library MarketApproxLib {
|
|
|
403
458
|
return (maxPtOut.Uint() * 999) / 1000;
|
|
404
459
|
}
|
|
405
460
|
|
|
406
|
-
function calcMaxPtIn(int256
|
|
407
|
-
return
|
|
461
|
+
function calcMaxPtIn(int256 totalAsset) internal pure returns (uint256) {
|
|
462
|
+
return totalAsset.Uint() - 1;
|
|
408
463
|
}
|
|
409
464
|
|
|
410
465
|
function isValidApproxParams(ApproxParams memory approx) internal pure returns (bool) {
|
|
@@ -60,10 +60,8 @@ library Math {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function rawDivUp(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return (a + b - 1) / b;
|
|
66
|
-
}
|
|
63
|
+
require(b != 0, "divide by zero");
|
|
64
|
+
return (a + b - 1) / b;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
function abs(int256 x) internal pure returns (uint256) {
|
|
@@ -43,7 +43,7 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
43
43
|
RewardIndex[] memory rewardIndexes
|
|
44
44
|
)
|
|
45
45
|
{
|
|
46
|
-
(address yt
|
|
46
|
+
(, address yt) = getPY(py);
|
|
47
47
|
IPYieldToken YT = IPYieldToken(yt);
|
|
48
48
|
exchangeRate = YT.scyIndexCurrent();
|
|
49
49
|
totalSupply = YT.totalSupply();
|
|
@@ -220,7 +220,7 @@ contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, Ownable
|
|
|
220
220
|
view
|
|
221
221
|
returns (UserPYInfo memory userPYInfo)
|
|
222
222
|
{
|
|
223
|
-
(userPYInfo.
|
|
223
|
+
(userPYInfo.pt, userPYInfo.yt) = getPY(py);
|
|
224
224
|
IPYieldToken YT = IPYieldToken(userPYInfo.yt);
|
|
225
225
|
userPYInfo.ytBalance = YT.balanceOf(user);
|
|
226
226
|
userPYInfo.ptBalance = IPPrincipalToken(userPYInfo.pt).balanceOf(user);
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"deployer": "0x1FcCC097db89A86Bfc474A1028F93958295b1Fb7",
|
|
3
3
|
"network": 43113,
|
|
4
4
|
"celerBus": "0xE9533976C590200E32d95C53f06AE12d292cFc47",
|
|
5
|
-
"treasury": "
|
|
6
|
-
"governanceManager": "
|
|
7
|
-
"PENDLE": "
|
|
8
|
-
"yieldContractFactory": "
|
|
9
|
-
"marketFactory": "
|
|
10
|
-
"router": "
|
|
11
|
-
"routerStatic": "
|
|
12
|
-
"startTime":
|
|
13
|
-
"vePendle": "
|
|
14
|
-
"votingController": "
|
|
15
|
-
"gaugeController": "
|
|
5
|
+
"treasury": "0xeEb65778Aa8866163d28ea0fF6Dc68826C722aeD",
|
|
6
|
+
"governanceManager": "0x8C7e949dDFA8549ddBC418Bf66135367Ec33e230",
|
|
7
|
+
"PENDLE": "0x49a61480e7C8E08EF6e5c52411396310B9257b11",
|
|
8
|
+
"yieldContractFactory": "0xa611Ecc96c2E59406a58115F08AaCeD05b60bB6b",
|
|
9
|
+
"marketFactory": "0xbb1aD0bd2A7cC4d1eB08A563670d2aC819b39d83",
|
|
10
|
+
"router": "0xc443267dC61Fda10f523795f70dB505E624caC82",
|
|
11
|
+
"routerStatic": "0xEE3cE0bFC2b0175Dd9CCC788E39f4952463b8b7a",
|
|
12
|
+
"startTime": 1657756800,
|
|
13
|
+
"vePendle": "0x47797F05f96532070E6A3D0125b2242FA869F8a9",
|
|
14
|
+
"votingController": "0xF89b549dF09ee805FC59F80bD333D8145e14480a",
|
|
15
|
+
"gaugeController": "0x7F21fa9108Ef12CDd7bFF026f26a95D6e17C5dA8"
|
|
16
16
|
}
|