@pendle/core-v2 0.7.1-beta-2 → 0.8.0-beta-2
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 +36 -5
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +64 -42
- 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 +34 -64
- 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 +191 -138
- package/contracts/core/actions/ActionCallback.sol +12 -13
- package/contracts/core/actions/ActionCore.sol +84 -22
- package/contracts/core/actions/ActionYT.sol +33 -15
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +6 -17
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +20 -50
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +6 -13
- 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 +7 -2
- 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 +13 -1
- package/contracts/libraries/RewardManager.sol +9 -6
- package/contracts/libraries/RewardManagerAbstract.sol +6 -8
- package/contracts/libraries/SCY/SCYIndex.sol +17 -0
- package/contracts/libraries/SCY/SCYUtils.sol +16 -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/MarketMathCore.sol +21 -25
- package/contracts/libraries/math/Math.sol +0 -7
- package/contracts/offchain-helpers/RouterStatic.sol +139 -7
- package/deployments/43113-core.json +11 -11
- package/deployments/43113-markets/benqi-market-0x9f080Af83E84099ED92b1b9b4B4BbE4400f2A3CB.json +7 -0
- package/deployments/80001-core.json +10 -10
- package/deployments/80001-markets/benqi-market-0x78699fa58C484e9867B8047A12E959ccB8BaD90E.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
|
@@ -7,17 +7,12 @@ import "./IPYieldToken.sol";
|
|
|
7
7
|
import "../libraries/math/MarketMathCore.sol";
|
|
8
8
|
|
|
9
9
|
interface IPMarket is IERC20Metadata {
|
|
10
|
-
event
|
|
11
|
-
address indexed receiver,
|
|
12
|
-
uint256 lpToAccount,
|
|
13
|
-
uint256 scyUsed,
|
|
14
|
-
uint256 ptUsed
|
|
15
|
-
);
|
|
10
|
+
event Mint(address indexed receiver, uint256 lpMinted, uint256 scyUsed, uint256 ptUsed);
|
|
16
11
|
|
|
17
|
-
event
|
|
12
|
+
event Burn(
|
|
18
13
|
address indexed receiverScy,
|
|
19
14
|
address indexed receiverPt,
|
|
20
|
-
uint256
|
|
15
|
+
uint256 lpBurned,
|
|
21
16
|
uint256 scyToAccount,
|
|
22
17
|
uint256 ptToAccount
|
|
23
18
|
);
|
|
@@ -31,25 +26,11 @@ interface IPMarket is IERC20Metadata {
|
|
|
31
26
|
|
|
32
27
|
event UpdateImpliedRate(uint256 indexed timestamp, uint256 lnLastImpliedRate);
|
|
33
28
|
|
|
34
|
-
function
|
|
35
|
-
address receiver,
|
|
36
|
-
uint256 scyDesired,
|
|
37
|
-
uint256 ptDesired,
|
|
38
|
-
bytes calldata data
|
|
39
|
-
)
|
|
40
|
-
external
|
|
41
|
-
returns (
|
|
42
|
-
uint256 lpToAccount,
|
|
43
|
-
uint256 scyUsed,
|
|
44
|
-
uint256 ptUsed
|
|
45
|
-
);
|
|
29
|
+
function mint(address receiver) external returns (uint256);
|
|
46
30
|
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
uint256 lpToRemove,
|
|
51
|
-
bytes calldata data
|
|
52
|
-
) external returns (uint256 scyToAccount, uint256 ptToAccount);
|
|
31
|
+
function burn(address receiverScy, address receiverPt)
|
|
32
|
+
external
|
|
33
|
+
returns (uint256 scyToAccount, uint256 ptToAccount);
|
|
53
34
|
|
|
54
35
|
function swapExactPtForScy(
|
|
55
36
|
address receiver,
|
|
@@ -104,16 +104,21 @@ interface IPRouterStatic {
|
|
|
104
104
|
view
|
|
105
105
|
returns (uint256 netScyOut, uint256 netPtOut);
|
|
106
106
|
|
|
107
|
-
function
|
|
107
|
+
function swapExactPtForScyStatic(address market, uint256 exactPtIn)
|
|
108
108
|
external
|
|
109
109
|
view
|
|
110
110
|
returns (uint256 netScyOut, uint256 netScyFee);
|
|
111
111
|
|
|
112
|
-
function
|
|
112
|
+
function swapScyForExactPtStatic(address market, uint256 exactPtOut)
|
|
113
113
|
external
|
|
114
114
|
view
|
|
115
115
|
returns (uint256 netScyIn, uint256 netScyFee);
|
|
116
116
|
|
|
117
|
+
function swapExactScyForPtStatic(address market, uint256 exactScyIn)
|
|
118
|
+
external
|
|
119
|
+
view
|
|
120
|
+
returns (uint256 netPtOut, uint256 netScyFee);
|
|
121
|
+
|
|
117
122
|
// ============= OTHER HELPERS =============
|
|
118
123
|
|
|
119
124
|
function scyIndex(address market) external view returns (SCYIndex index);
|
|
@@ -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,21 @@ pragma solidity 0.8.15;
|
|
|
26
26
|
interface IYearnVault {
|
|
27
27
|
function deposit(uint256 amount) external returns (uint256);
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
function deposit(uint256 amount, address recipient) external returns (uint256);
|
|
30
|
+
|
|
31
|
+
function withdraw(
|
|
32
|
+
uint256 maxShares,
|
|
33
|
+
address recipient,
|
|
34
|
+
uint256 maxLoss
|
|
35
|
+
) external returns (uint256 amountTokenRedeemed);
|
|
30
36
|
|
|
31
37
|
function pricePerShare() external view returns (uint256);
|
|
32
38
|
|
|
33
39
|
function token() external view returns (address);
|
|
40
|
+
|
|
41
|
+
function depositLimit() external view returns (uint256);
|
|
42
|
+
|
|
43
|
+
function totalAssets() external view returns (uint256);
|
|
44
|
+
|
|
45
|
+
function decimals() external view returns (uint256);
|
|
34
46
|
}
|
|
@@ -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,23 @@ library SCYIndexLib {
|
|
|
34
34
|
return SCYUtils.assetToScy(SCYIndex.unwrap(index), assetAmount);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
function assetToScyUp(SCYIndex index, uint256 assetAmount)
|
|
38
|
+
internal
|
|
39
|
+
pure
|
|
40
|
+
returns (uint256)
|
|
41
|
+
{
|
|
42
|
+
return SCYUtils.assetToScyUp(SCYIndex.unwrap(index), assetAmount);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function scyToAssetUp(SCYIndex index, uint256 scyAmount)
|
|
46
|
+
internal
|
|
47
|
+
pure
|
|
48
|
+
returns (uint256)
|
|
49
|
+
{
|
|
50
|
+
uint256 _index = SCYIndex.unwrap(index);
|
|
51
|
+
return SCYUtils.scyToAssetUp(_index, scyAmount);
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
function scyToAsset(SCYIndex index, int256 scyAmount)
|
|
38
55
|
internal
|
|
39
56
|
pure
|
|
@@ -8,6 +8,14 @@ library SCYUtils {
|
|
|
8
8
|
return (scyAmount * exchangeRate) / ONE;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
function scyToAssetUp(uint256 exchangeRate, uint256 scyAmount)
|
|
12
|
+
internal
|
|
13
|
+
pure
|
|
14
|
+
returns (uint256)
|
|
15
|
+
{
|
|
16
|
+
return (scyAmount * exchangeRate + ONE - 1) / ONE;
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
function assetToScy(uint256 exchangeRate, uint256 assetAmount)
|
|
12
20
|
internal
|
|
13
21
|
pure
|
|
@@ -15,4 +23,12 @@ library SCYUtils {
|
|
|
15
23
|
{
|
|
16
24
|
return (assetAmount * ONE) / exchangeRate;
|
|
17
25
|
}
|
|
26
|
+
|
|
27
|
+
function assetToScyUp(uint256 exchangeRate, uint256 assetAmount)
|
|
28
|
+
internal
|
|
29
|
+
pure
|
|
30
|
+
returns (uint256)
|
|
31
|
+
{
|
|
32
|
+
return (assetAmount * ONE + exchangeRate - 1) / exchangeRate;
|
|
33
|
+
}
|
|
18
34
|
}
|
|
@@ -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
|
}
|