@pendle/core-v2 0.7.1-beta → 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/IPRouterStatic.sol/IPRouterStatic.json +20 -15
- 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 +166 -13
- 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/IPRouterStatic.sol +67 -47
- 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 +144 -115
- package/deployments/43113-core.json +11 -9
- package/deployments/43113-markets/benqi-market-0xF3150c14F776c50C9D397054d38979c7B77FC41D.json +7 -0
- package/deployments/80001-core.json +10 -8
- 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/IPRouterStatic.ts +64 -41
- 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/RouterStatic.ts +297 -24
- 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/IPRouterStatic__factory.ts +20 -15
- 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 +165 -12
- 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
|
@@ -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) {
|
|
@@ -7,11 +7,12 @@ import "../interfaces/IPRouterStatic.sol";
|
|
|
7
7
|
import "../interfaces/IPMarket.sol";
|
|
8
8
|
import "../interfaces/IPYieldContractFactory.sol";
|
|
9
9
|
import "../interfaces/IPMarketFactory.sol";
|
|
10
|
+
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
10
11
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
|
11
12
|
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
12
13
|
|
|
13
14
|
/// EXCLUDED FROM ALL AUDITS, TO BE CALLED ONLY BY PENDLE's SDK
|
|
14
|
-
contract RouterStatic is IPRouterStatic {
|
|
15
|
+
contract RouterStatic is IPRouterStatic, Initializable, UUPSUpgradeable, OwnableUpgradeable {
|
|
15
16
|
using MarketMathCore for MarketState;
|
|
16
17
|
using Math for uint256;
|
|
17
18
|
using Math for int256;
|
|
@@ -20,17 +21,125 @@ contract RouterStatic is IPRouterStatic {
|
|
|
20
21
|
IPYieldContractFactory public immutable yieldContractFactory;
|
|
21
22
|
IPMarketFactory public immutable marketFactory;
|
|
22
23
|
|
|
23
|
-
constructor(IPYieldContractFactory _yieldContractFactory, IPMarketFactory _marketFactory)
|
|
24
|
+
constructor(IPYieldContractFactory _yieldContractFactory, IPMarketFactory _marketFactory)
|
|
25
|
+
initializer
|
|
26
|
+
{
|
|
24
27
|
yieldContractFactory = _yieldContractFactory;
|
|
25
28
|
marketFactory = _marketFactory;
|
|
26
29
|
}
|
|
27
30
|
|
|
31
|
+
function initialize() external initializer {
|
|
32
|
+
__UUPSUpgradeable_init();
|
|
33
|
+
__Ownable_init();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ============= SYSTEM INFO =============
|
|
37
|
+
|
|
38
|
+
function getPYInfo(address py)
|
|
39
|
+
external
|
|
40
|
+
returns (
|
|
41
|
+
uint256 exchangeRate,
|
|
42
|
+
uint256 totalSupply,
|
|
43
|
+
RewardIndex[] memory rewardIndexes
|
|
44
|
+
)
|
|
45
|
+
{
|
|
46
|
+
(, address yt) = getPY(py);
|
|
47
|
+
IPYieldToken YT = IPYieldToken(yt);
|
|
48
|
+
exchangeRate = YT.scyIndexCurrent();
|
|
49
|
+
totalSupply = YT.totalSupply();
|
|
50
|
+
address[] memory rewardTokens = YT.getRewardTokens();
|
|
51
|
+
rewardIndexes = new RewardIndex[](rewardTokens.length);
|
|
52
|
+
|
|
53
|
+
uint256[] memory indexes = YT.rewardIndexesCurrent();
|
|
54
|
+
for (uint256 i = 0; i < rewardTokens.length; ++i) {
|
|
55
|
+
address rewardToken = rewardTokens[i];
|
|
56
|
+
rewardIndexes[i].rewardToken = rewardToken;
|
|
57
|
+
rewardIndexes[i].index = indexes[i];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getPendleTokenType(address token)
|
|
62
|
+
external
|
|
63
|
+
view
|
|
64
|
+
returns (
|
|
65
|
+
bool isPT,
|
|
66
|
+
bool isYT,
|
|
67
|
+
bool isMarket
|
|
68
|
+
)
|
|
69
|
+
{
|
|
70
|
+
if (yieldContractFactory.isPT(token)) isPT = true;
|
|
71
|
+
else if (yieldContractFactory.isYT(token)) isYT = true;
|
|
72
|
+
else if (marketFactory.isValidMarket(token)) isMarket = true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getMarketInfo(address market)
|
|
76
|
+
external
|
|
77
|
+
view
|
|
78
|
+
returns (
|
|
79
|
+
address pt,
|
|
80
|
+
address scy,
|
|
81
|
+
MarketState memory state,
|
|
82
|
+
int256 impliedYield
|
|
83
|
+
)
|
|
84
|
+
{
|
|
85
|
+
IPMarket _market = IPMarket(market);
|
|
86
|
+
(ISuperComposableYield SCY, IPPrincipalToken PT, ) = IPMarket(market).readTokens();
|
|
87
|
+
|
|
88
|
+
pt = address(PT);
|
|
89
|
+
scy = address(SCY);
|
|
90
|
+
state = _market.readState(true);
|
|
91
|
+
impliedYield = getPtImpliedYield(market);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ============= USER INFO =============
|
|
95
|
+
|
|
96
|
+
function getUserPYPositionsByPYs(address user, address[] calldata pys)
|
|
97
|
+
external
|
|
98
|
+
view
|
|
99
|
+
returns (UserPYInfo[] memory userPYPositions)
|
|
100
|
+
{
|
|
101
|
+
userPYPositions = new UserPYInfo[](pys.length);
|
|
102
|
+
for (uint256 i = 0; i < pys.length; ++i) {
|
|
103
|
+
userPYPositions[i] = getUserPYInfo(pys[i], user);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function getUserMarketPositions(address user, address[] calldata markets)
|
|
108
|
+
external
|
|
109
|
+
view
|
|
110
|
+
returns (UserMarketInfo[] memory userMarketPositions)
|
|
111
|
+
{
|
|
112
|
+
userMarketPositions = new UserMarketInfo[](markets.length);
|
|
113
|
+
for (uint256 i = 0; i < markets.length; ++i) {
|
|
114
|
+
userMarketPositions[i] = getUserMarketInfo(markets[i], user);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function getUserSCYInfo(address scy, address user)
|
|
119
|
+
external
|
|
120
|
+
view
|
|
121
|
+
returns (uint256 balance, TokenAmount[] memory rewards)
|
|
122
|
+
{
|
|
123
|
+
ISuperComposableYield SCY = ISuperComposableYield(scy);
|
|
124
|
+
balance = SCY.balanceOf(scy);
|
|
125
|
+
address[] memory rewardTokens = SCY.getRewardTokens();
|
|
126
|
+
rewards = new TokenAmount[](rewardTokens.length);
|
|
127
|
+
for (uint256 i = 0; i < rewardTokens.length; ++i) {
|
|
128
|
+
address rewardToken = rewardTokens[i];
|
|
129
|
+
rewards[i].token = rewardToken;
|
|
130
|
+
(, rewards[i].amount) = IRewardManager(scy).userReward(rewardToken, user);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ============= MARKET ACTIONS =============
|
|
135
|
+
|
|
28
136
|
function addLiquidityStatic(
|
|
29
137
|
address market,
|
|
30
138
|
uint256 scyDesired,
|
|
31
139
|
uint256 ptDesired
|
|
32
140
|
)
|
|
33
141
|
external
|
|
142
|
+
view
|
|
34
143
|
returns (
|
|
35
144
|
uint256 netLpOut,
|
|
36
145
|
uint256 scyUsed,
|
|
@@ -57,6 +166,7 @@ contract RouterStatic is IPRouterStatic {
|
|
|
57
166
|
|
|
58
167
|
function swapPtForScyStatic(address market, uint256 exactPtIn)
|
|
59
168
|
external
|
|
169
|
+
view
|
|
60
170
|
returns (uint256 netScyOut, uint256 netScyFee)
|
|
61
171
|
{
|
|
62
172
|
MarketState memory state = IPMarket(market).readState(false);
|
|
@@ -69,6 +179,7 @@ contract RouterStatic is IPRouterStatic {
|
|
|
69
179
|
|
|
70
180
|
function swapScyForPtStatic(address market, uint256 exactPtOut)
|
|
71
181
|
external
|
|
182
|
+
view
|
|
72
183
|
returns (uint256 netScyIn, uint256 netScyFee)
|
|
73
184
|
{
|
|
74
185
|
MarketState memory state = IPMarket(market).readState(false);
|
|
@@ -79,12 +190,24 @@ contract RouterStatic is IPRouterStatic {
|
|
|
79
190
|
);
|
|
80
191
|
}
|
|
81
192
|
|
|
193
|
+
// ============= OTHER HELPERS =============
|
|
194
|
+
|
|
82
195
|
function scyIndex(address market) public view returns (SCYIndex index) {
|
|
83
196
|
(ISuperComposableYield SCY, , ) = IPMarket(market).readTokens();
|
|
84
197
|
|
|
85
198
|
return SCYIndexLib.newIndex(SCY);
|
|
86
199
|
}
|
|
87
200
|
|
|
201
|
+
function getPY(address py) public view returns (address pt, address yt) {
|
|
202
|
+
if (yieldContractFactory.isYT(py)) {
|
|
203
|
+
pt = IPYieldToken(py).PT();
|
|
204
|
+
yt = py;
|
|
205
|
+
} else {
|
|
206
|
+
pt = py;
|
|
207
|
+
yt = IPPrincipalToken(py).YT();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
88
211
|
function getPtImpliedYield(address market) public view returns (int256) {
|
|
89
212
|
MarketState memory state = IPMarket(market).readState(false);
|
|
90
213
|
|
|
@@ -92,26 +215,12 @@ contract RouterStatic is IPRouterStatic {
|
|
|
92
215
|
return lnImpliedRate.exp();
|
|
93
216
|
}
|
|
94
217
|
|
|
95
|
-
function getPendleTokenType(address token)
|
|
96
|
-
external
|
|
97
|
-
view
|
|
98
|
-
returns (
|
|
99
|
-
bool isPT,
|
|
100
|
-
bool isYT,
|
|
101
|
-
bool isMarket
|
|
102
|
-
)
|
|
103
|
-
{
|
|
104
|
-
if (yieldContractFactory.isPT(token)) isPT = true;
|
|
105
|
-
else if (yieldContractFactory.isYT(token)) isYT = true;
|
|
106
|
-
else if (marketFactory.isValidMarket(token)) isMarket = true;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
218
|
function getUserPYInfo(address py, address user)
|
|
110
219
|
public
|
|
111
220
|
view
|
|
112
221
|
returns (UserPYInfo memory userPYInfo)
|
|
113
222
|
{
|
|
114
|
-
(userPYInfo.
|
|
223
|
+
(userPYInfo.pt, userPYInfo.yt) = getPY(py);
|
|
115
224
|
IPYieldToken YT = IPYieldToken(userPYInfo.yt);
|
|
116
225
|
userPYInfo.ytBalance = YT.balanceOf(user);
|
|
117
226
|
userPYInfo.ptBalance = IPPrincipalToken(userPYInfo.pt).balanceOf(user);
|
|
@@ -135,119 +244,39 @@ contract RouterStatic is IPRouterStatic {
|
|
|
135
244
|
}
|
|
136
245
|
}
|
|
137
246
|
|
|
138
|
-
function getPYInfo(address py)
|
|
139
|
-
external
|
|
140
|
-
returns (
|
|
141
|
-
uint256 exchangeRate,
|
|
142
|
-
uint256 totalSupply,
|
|
143
|
-
RewardIndex[] memory rewardIndexes
|
|
144
|
-
)
|
|
145
|
-
{
|
|
146
|
-
(address yt, ) = getPY(py);
|
|
147
|
-
IPYieldToken YT = IPYieldToken(yt);
|
|
148
|
-
exchangeRate = YT.scyIndexCurrent();
|
|
149
|
-
totalSupply = YT.totalSupply();
|
|
150
|
-
address[] memory rewardTokens = YT.getRewardTokens();
|
|
151
|
-
rewardIndexes = new RewardIndex[](rewardTokens.length);
|
|
152
|
-
|
|
153
|
-
uint256[] memory indexes = YT.rewardIndexesCurrent();
|
|
154
|
-
for (uint256 i = 0; i < rewardTokens.length; ++i) {
|
|
155
|
-
address rewardToken = rewardTokens[i];
|
|
156
|
-
rewardIndexes[i].rewardToken = rewardToken;
|
|
157
|
-
rewardIndexes[i].index = indexes[i];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function getPY(address py) public view returns (address pt, address yt) {
|
|
162
|
-
if (yieldContractFactory.isYT(py)) {
|
|
163
|
-
yt = py;
|
|
164
|
-
pt = IPYieldToken(py).PT();
|
|
165
|
-
} else {
|
|
166
|
-
yt = IPPrincipalToken(py).YT();
|
|
167
|
-
pt = py;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function getMarketInfo(address market)
|
|
172
|
-
external
|
|
173
|
-
view
|
|
174
|
-
returns (
|
|
175
|
-
address pt,
|
|
176
|
-
address scy,
|
|
177
|
-
MarketState memory state,
|
|
178
|
-
int256 impliedYield,
|
|
179
|
-
uint256 exchangeRate
|
|
180
|
-
)
|
|
181
|
-
{
|
|
182
|
-
IPMarket _market = IPMarket(market);
|
|
183
|
-
(ISuperComposableYield SCY, IPPrincipalToken PT, ) = IPMarket(market).readTokens();
|
|
184
|
-
|
|
185
|
-
pt = address(PT);
|
|
186
|
-
scy = address(SCY);
|
|
187
|
-
state = _market.readState(true);
|
|
188
|
-
impliedYield = getPtImpliedYield(market);
|
|
189
|
-
exchangeRate = 0; // TODO: get the actual exchange rate
|
|
190
|
-
}
|
|
191
|
-
|
|
192
247
|
function getUserMarketInfo(address market, address user)
|
|
193
248
|
public
|
|
194
249
|
view
|
|
195
250
|
returns (UserMarketInfo memory userMarketInfo)
|
|
196
251
|
{
|
|
197
252
|
IPMarket _market = IPMarket(market);
|
|
253
|
+
uint256 userLp = _market.balanceOf(user);
|
|
254
|
+
|
|
198
255
|
userMarketInfo.market = market;
|
|
199
|
-
userMarketInfo.lpBalance =
|
|
200
|
-
// TODO: Is there a way to convert LP to PT and SCY?
|
|
201
|
-
(ISuperComposableYield SCY, IPPrincipalToken PT, ) = IPMarket(market).readTokens();
|
|
256
|
+
userMarketInfo.lpBalance = userLp;
|
|
202
257
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
258
|
+
MarketState memory state = _market.readState(true);
|
|
259
|
+
uint256 totalLp = uint256(state.totalLp);
|
|
260
|
+
uint256 userPt = (userLp * uint256(state.totalPt)) / totalLp;
|
|
261
|
+
uint256 userScy = (userLp * uint256(state.totalScy)) / totalLp;
|
|
208
262
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
for (uint256 i = 0; i < pys.length; ++i) {
|
|
216
|
-
userPYPositions[i] = getUserPYInfo(pys[i], user);
|
|
217
|
-
}
|
|
263
|
+
(ISuperComposableYield SCY, IPPrincipalToken PT, ) = _market.readTokens();
|
|
264
|
+
userMarketInfo.ptBalance = TokenAmount(address(PT), userPt);
|
|
265
|
+
userMarketInfo.scyBalance = TokenAmount(address(SCY), userScy);
|
|
266
|
+
(userMarketInfo.assetBalance.assetType, userMarketInfo.assetBalance.assetAddress, ) = SCY
|
|
267
|
+
.assetInfo();
|
|
268
|
+
userMarketInfo.assetBalance.amount = (userScy * SCY.exchangeRate()) / Math.ONE;
|
|
218
269
|
}
|
|
219
270
|
|
|
220
|
-
function
|
|
221
|
-
external
|
|
222
|
-
view
|
|
223
|
-
returns (UserMarketInfo[] memory userMarketPositions)
|
|
224
|
-
{
|
|
225
|
-
userMarketPositions = new UserMarketInfo[](markets.length);
|
|
226
|
-
for (uint256 i = 0; i < markets.length; ++i) {
|
|
227
|
-
userMarketPositions[i] = getUserMarketInfo(markets[i], user);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function hasPYPosition(UserPYInfo memory userPYInfo) public pure returns (bool hasPosition) {
|
|
271
|
+
function hasPYPosition(UserPYInfo calldata userPYInfo) public pure returns (bool hasPosition) {
|
|
232
272
|
hasPosition = (userPYInfo.ytBalance > 0 ||
|
|
233
273
|
userPYInfo.ptBalance > 0 ||
|
|
234
274
|
userPYInfo.unclaimedInterest.amount > 0 ||
|
|
235
275
|
userPYInfo.unclaimedRewards.length > 0);
|
|
236
276
|
}
|
|
237
277
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
{
|
|
243
|
-
ISuperComposableYield SCY = ISuperComposableYield(scy);
|
|
244
|
-
balance = SCY.balanceOf(scy);
|
|
245
|
-
address[] memory rewardTokens = SCY.getRewardTokens();
|
|
246
|
-
rewards = new TokenAmount[](rewardTokens.length);
|
|
247
|
-
for (uint256 i = 0; i < rewardTokens.length; ++i) {
|
|
248
|
-
address rewardToken = rewardTokens[i];
|
|
249
|
-
rewards[i].token = rewardToken;
|
|
250
|
-
(, rewards[i].amount) = IRewardManager(scy).userReward(rewardToken, user);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
278
|
+
// ============= UPGRADES =============
|
|
279
|
+
|
|
280
|
+
// solhint-disable-next-line no-empty-blocks
|
|
281
|
+
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
|
|
253
282
|
}
|
|
@@ -2,13 +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
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
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"
|
|
14
16
|
}
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
"deployer": "0x1FcCC097db89A86Bfc474A1028F93958295b1Fb7",
|
|
3
3
|
"network": 80001,
|
|
4
4
|
"celerBus": "0x7d43AABC515C356145049227CeE54B608342c0ad",
|
|
5
|
-
"treasury": "
|
|
6
|
-
"governanceManager": "
|
|
7
|
-
"PENDLE": "
|
|
8
|
-
"yieldContractFactory": "
|
|
9
|
-
"marketFactory": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
5
|
+
"treasury": "0x28FcFb63c8ab55E3710e51441d003318eE235FE8",
|
|
6
|
+
"governanceManager": "0x27FaF900007B4cBa7803000251ec96Bc69ff1BEa",
|
|
7
|
+
"PENDLE": "0x8553e57B13aECb9704Be27d7BF0067211dEaed00",
|
|
8
|
+
"yieldContractFactory": "0xE6DD1433d59B2eaf26E7B2107c574d3c3299023e",
|
|
9
|
+
"marketFactory": "0x191c677bc1d2BbcBfa99fd68b34ed4fb2E157eFD",
|
|
10
|
+
"router": "0xCd6fC1E4f430976fB5c20E747f861E6bd14454d4",
|
|
11
|
+
"routerStatic": "0xeb83006b0aADdD15AD8AFbebE2f4e0937f210673",
|
|
12
|
+
"startTime": 1657756800,
|
|
13
|
+
"vePendle": "0xd160cd8eeb79F976d6f08EaeAA3C93612D543c2c",
|
|
14
|
+
"gaugeController": "0x52dFCD0b5DCaa16E697de2cc4A1F404DDC41fC42"
|
|
13
15
|
}
|