@pendle/core-v2 0.6.9 → 0.7.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +714 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +4 -0
- package/build/artifacts/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol/WadRayMath.json +3 -3
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.json +27 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.json +737 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol/PendleBtrflyScy.json +635 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.json +609 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol/PendleJoeLpSCY.json +653 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.json +622 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.json +622 -0
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/{ISuperComposableYield.sol/ISuperComposableYield.json → base-implementations/SCYBase.sol/SCYBase.json} +221 -141
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +4 -0
- package/build/artifacts/contracts/SuperComposableYield/{implementations → base-implementations}/SCYBaseWithRewards.sol/SCYBaseWithRewards.json +225 -225
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.json +128 -0
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/RewardManager.sol/RewardManager.json → core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.json} +34 -38
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.json +193 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.json +255 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.json +318 -0
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +4 -0
- package/build/artifacts/contracts/{interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.json → core/LiquidityMining/PendleGauge.sol/PendleGauge.json} +40 -72
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +776 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +309 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +519 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +353 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +4 -0
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.json +138 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.json +898 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.json +351 -0
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.json +254 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +4 -0
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.json +329 -0
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -20
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.json +35 -0
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.json +378 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +352 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +4 -0
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +732 -0
- 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 +123 -77
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +39 -42
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.json +163 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.json +0 -13
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.json +1 -14
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +4 -0
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.json +10 -0
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.json +39 -0
- 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/IBenQiComptroller.sol/IBenQiComptroller.json +13 -0
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.json +74 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IVePToken.sol/IVePToken.json → ICelerMessageBus.sol/ICelerMessageBus.json} +21 -11
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.json +45 -0
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +4 -0
- package/build/artifacts/contracts/{core/PendleBaseToken.sol/PendleBaseToken.json → interfaces/IERC4626.sol/IERC4626.json} +53 -68
- 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 +4 -0
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.json +962 -0
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.json +122 -58
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.json +36 -21
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +116 -81
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.json +135 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.json +158 -0
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.json +35 -0
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.json +35 -54
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketAddRemoveCallback.sol/IPMarketAddRemoveCallback.json +2 -2
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.json +37 -0
- 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/IPPrincipalToken.sol/IPPrincipalToken.json +13 -0
- 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/IPVeToken.sol/IPVeToken.json +61 -5
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.json +167 -0
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.json +70 -89
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.json +156 -106
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/{IPBaseToken.sol/IPBaseToken.json → IQiAvax.sol/IQiAvax.json} +106 -15
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.json +117 -0
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.json +117 -0
- package/build/artifacts/contracts/interfaces/IREDACTEDStaking.sol/IREDACTEDStaking.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.json +40 -0
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/SCYBase.sol/SCYBase.json → interfaces/ISuperComposableYield.sol/ISuperComposableYield.json} +183 -181
- 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/IWXBTRFLY.sol/IWXBTRFLY.json +13 -0
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.json +13 -0
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.json +13 -0
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.json → libraries/RewardManager.sol/RewardManager.json} +30 -30
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.json +40 -0
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol}/SCYIndexLib.json +3 -3
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +4 -0
- package/build/artifacts/contracts/{SuperComposableYield → libraries/SCY}/SCYUtils.sol/SCYUtils.json +3 -3
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{math/MarketMathAux.sol/MarketMathAux.json → VeBalanceLib.sol/VeBalanceLib.json} +4 -4
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.json +10 -0
- 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 +4 -0
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.json +10 -0
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +4 -0
- package/build/artifacts/contracts/{core/actions/base/ActionType.sol/ActionType.json → libraries/helpers/TokenHelper.sol/TokenHelper.json} +2 -2
- 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 +4 -0
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/Bytes32AddressLib.sol/Bytes32AddressLib.json +10 -0
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.json +10 -0
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +4 -0
- package/build/artifacts/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol}/JoeLibrary.json +3 -3
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +4 -0
- package/build/artifacts/contracts/{periphery → libraries/traderjoe}/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.json +1 -14
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +862 -0
- 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 +147 -0
- package/contracts/{core/PendleSCYImpl → SuperComposableYield/SCY-implementations}/AaveV3/WadRayMath.sol +1 -1
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol +74 -0
- package/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol +187 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleBtrflySCY.sol +123 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol +99 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleJoeLpSCY.sol +245 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol +107 -0
- package/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol +120 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBase.sol +197 -0
- package/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol +131 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol +53 -0
- package/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol +59 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +146 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol +33 -0
- package/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol +26 -0
- package/contracts/core/LiquidityMining/PendleGauge.sol +118 -0
- package/contracts/core/LiquidityMining/README.md +63 -0
- package/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +336 -0
- package/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +228 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +245 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +73 -0
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol +52 -0
- package/contracts/core/{PendleMarket.sol → Market/PendleMarket.sol} +135 -100
- package/contracts/core/{PendleMarketFactory.sol → Market/PendleMarketFactory.sol} +60 -20
- package/contracts/core/PendleERC20.sol +358 -0
- package/contracts/core/PendleERC20Permit.sol +84 -0
- package/contracts/core/PendleRouter.sol +6 -12
- package/contracts/core/YieldContracts/InterestManagerYT.sol +87 -0
- package/contracts/core/YieldContracts/PendlePrincipalToken.sol +60 -0
- package/contracts/core/{PendleYieldContractFactory.sol → YieldContracts/PendleYieldContractFactory.sol} +43 -23
- package/contracts/core/YieldContracts/PendleYieldToken.sol +349 -0
- package/contracts/core/actions/ActionCallback.sol +63 -43
- package/contracts/core/actions/ActionCore.sol +95 -78
- package/contracts/core/actions/ActionYT.sol +35 -86
- package/contracts/core/actions/base/ActionSCYAndPTBase.sol +133 -78
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +31 -46
- package/contracts/core/actions/base/ActionSCYAndYTBase.sol +127 -45
- package/contracts/core/actions/base/CallbackHelper.sol +81 -0
- package/contracts/interfaces/IAToken.sol +11 -1
- package/contracts/interfaces/IAavePool.sol +1 -1
- package/contracts/interfaces/IAaveRewardsController.sol +1 -1
- package/contracts/interfaces/IBenQiComptroller.sol +3 -1
- package/contracts/interfaces/IBenQiInterestRateModel.sol +16 -0
- package/contracts/interfaces/ICelerMessageBus.sol +28 -0
- package/contracts/interfaces/ICelerMessageReceiverApp.sol +25 -0
- package/contracts/interfaces/IERC4626.sol +39 -0
- package/contracts/interfaces/IJoeRouter01.sol +1 -1
- package/contracts/interfaces/IJoeRouter02.sol +52 -0
- package/contracts/interfaces/IPActionCore.sol +44 -27
- package/contracts/interfaces/IPActionYT.sol +12 -9
- package/contracts/interfaces/IPAllAction.sol +2 -3
- package/contracts/interfaces/IPGaugeController.sol +28 -0
- package/contracts/interfaces/IPGaugeControllerMainchain.sol +12 -0
- package/contracts/interfaces/IPGovernanceManager.sol +1 -1
- package/contracts/interfaces/IPInterestManagerYT.sol +9 -0
- package/contracts/interfaces/IPMarket.sol +13 -13
- package/contracts/interfaces/IPMarketAddRemoveCallback.sol +3 -3
- package/contracts/interfaces/IPMarketFactory.sol +14 -2
- package/contracts/interfaces/IPMarketSwapCallback.sol +1 -1
- package/contracts/interfaces/IPPermissionsV2Upg.sol +1 -1
- package/contracts/interfaces/IPPrincipalToken.sol +11 -5
- package/contracts/interfaces/IPRouterStatic.sol +1 -1
- package/contracts/interfaces/IPVeToken.sol +9 -4
- package/contracts/interfaces/IPVotingController.sol +21 -0
- package/contracts/interfaces/IPVotingEscrow.sol +14 -22
- package/contracts/interfaces/IPYieldContractFactory.sol +1 -1
- package/contracts/interfaces/IPYieldToken.sol +28 -18
- package/contracts/interfaces/IQiAvax.sol +31 -0
- package/contracts/interfaces/IQiErc20.sol +1 -1
- package/contracts/interfaces/IQiToken.sol +22 -1
- package/contracts/interfaces/IREDACTEDStaking.sol +1 -1
- package/contracts/interfaces/IRewardManager.sol +9 -0
- package/contracts/interfaces/ISuperComposableYield.sol +182 -0
- package/contracts/interfaces/IWETH.sol +1 -1
- package/contracts/interfaces/IWXBTRFLY.sol +3 -1
- package/contracts/interfaces/IWstETH.sol +3 -1
- package/contracts/interfaces/IYearnVault.sol +3 -1
- package/contracts/libraries/RewardManager.sol +78 -0
- package/contracts/libraries/RewardManagerAbstract.sol +85 -0
- package/contracts/libraries/{SCYIndex.sol → SCY/SCYIndex.sol} +8 -8
- package/contracts/libraries/SCY/SCYUtils.sol +18 -0
- package/contracts/libraries/VeBalanceLib.sol +80 -0
- package/contracts/libraries/VeHistoryLib.sol +60 -0
- package/contracts/libraries/helpers/ArrayLib.sol +65 -0
- package/contracts/libraries/helpers/ExpiryUtilsLib.sol +1 -1
- package/contracts/libraries/helpers/MiniHelpers.sol +15 -0
- package/contracts/libraries/helpers/SSTORE2Deployer.sol +30 -0
- package/contracts/libraries/helpers/TokenHelper.sol +105 -0
- package/contracts/libraries/math/LogExpMath.sol +59 -1
- package/contracts/libraries/math/MarketApproxLib.sol +167 -164
- package/contracts/libraries/math/MarketMathCore.sol +106 -25
- package/contracts/libraries/math/Math.sol +28 -21
- package/contracts/libraries/math/WeekMath.sol +19 -0
- package/contracts/libraries/solmate/Bytes32AddressLib.sol +14 -0
- package/contracts/libraries/solmate/SSTORE2.sol +99 -0
- package/contracts/libraries/{JoeLibrary.sol → traderjoe/JoeLibrary.sol} +3 -2
- package/contracts/{periphery → libraries/traderjoe}/PendleJoeSwapHelperUpg.sol +8 -10
- package/contracts/{core → offchain-helpers}/RouterStatic.sol +25 -20
- package/contracts/periphery/PendleGovernanceManager.sol +1 -1
- package/contracts/periphery/PermissionsV2Upg.sol +7 -1
- package/deployments/43113-benqi.json +6 -0
- package/deployments/43113-core.json +14 -0
- package/deployments/43113-markets/benqi-market.json +7 -0
- package/deployments/80001-benqi.json +6 -0
- package/deployments/80001-core.json +13 -0
- package/deployments/80001-markets/benqi-market.json +7 -0
- package/package.json +2 -2
- package/typechain-types/ActionCore.ts +169 -96
- package/typechain-types/{ActionSCYAndYOBase.ts → ActionSCYAndPTBase.ts} +54 -67
- package/typechain-types/ActionSCYAndPYBase.ts +0 -13
- package/typechain-types/ActionSCYAndYTBase.ts +8 -21
- package/typechain-types/ActionYT.ts +73 -64
- package/typechain-types/CelerReceiverUpg.ts +267 -0
- package/typechain-types/CelerSenderUpg.ts +216 -0
- package/typechain-types/{ERC20Burnable.ts → ERC20Permit.ts} +116 -68
- package/typechain-types/IAToken.ts +55 -0
- package/typechain-types/IBenQiComptroller.ts +13 -0
- package/typechain-types/{InterestRateModel.ts → IBenQiInterestRateModel.ts} +12 -28
- package/typechain-types/ICelerMessageBus.ts +134 -0
- package/typechain-types/{IMessageReceiverApp.ts → ICelerMessageReceiverApp.ts} +19 -9
- package/typechain-types/IERC20Permit.ts +175 -0
- package/typechain-types/{ERC20Premined.ts → IERC4626.ts} +103 -113
- package/typechain-types/IJoeRouter02.ts +1420 -0
- package/typechain-types/IPActionCore.ts +169 -83
- package/typechain-types/IPActionYT.ts +65 -43
- package/typechain-types/IPAllAction.ts +190 -137
- package/typechain-types/IPGaugeController.ts +254 -0
- package/typechain-types/IPGaugeControllerMainchain.ts +298 -0
- package/typechain-types/{IVePToken.ts → IPInterestManagerYT.ts} +38 -27
- package/typechain-types/IPMarket.ts +73 -74
- package/typechain-types/IPMarketAddRemoveCallback.ts +10 -10
- package/typechain-types/IPMarketFactory.ts +38 -4
- package/typechain-types/IPPrincipalToken.ts +13 -0
- package/typechain-types/IPVeToken.ts +103 -8
- package/typechain-types/IPVotingController.ts +179 -0
- package/typechain-types/IPVotingEscrow.ts +100 -180
- package/typechain-types/IPYieldToken.ts +227 -264
- package/typechain-types/{PendleBaseToken.ts → IQiAvax.ts} +183 -107
- package/typechain-types/IQiErc20.ts +171 -0
- package/typechain-types/IQiToken.ts +171 -0
- package/typechain-types/IRewardManager.ts +16 -86
- package/typechain-types/ISuperComposableYield.ts +283 -269
- package/typechain-types/IWXBTRFLY.ts +13 -0
- package/typechain-types/IWstETH.ts +13 -0
- package/typechain-types/IYearnVault.ts +13 -0
- package/typechain-types/{PermissionsV2.ts → InterestManagerYT.ts} +30 -14
- package/typechain-types/PendleAaveV3SCY.ts +331 -496
- package/typechain-types/PendleBtrflyScy.ts +287 -348
- package/typechain-types/{IPBaseToken.ts → PendleERC20.ts} +5 -31
- package/typechain-types/{ERC20PresetFixedSupply.ts → PendleERC20Permit.ts} +100 -130
- package/typechain-types/{LYTBaseWithRewards.ts → PendleERC4626SCY.ts} +311 -316
- package/typechain-types/PendleGauge.ts +83 -315
- package/typechain-types/PendleGaugeControllerBaseUpg.ts +346 -0
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +410 -0
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +524 -0
- package/typechain-types/{PendleYTLYTBenqi.ts → PendleJoeLpSCY.ts} +336 -362
- package/typechain-types/PendleJoeSwapHelperUpg.ts +0 -13
- package/typechain-types/PendleMarket.ts +229 -154
- package/typechain-types/PendleMarketFactory.ts +127 -20
- package/typechain-types/PendlePrincipalToken.ts +0 -106
- package/typechain-types/{PermlessAbstract.ts → PendleQiTokenHelper.ts} +5 -5
- package/typechain-types/{PendleBenQiErc20LYT.ts → PendleQiTokenSCY.ts} +359 -308
- package/typechain-types/PendleRouter.ts +0 -19
- package/typechain-types/PendleVotingControllerUpg.ts +1145 -0
- package/typechain-types/{PendleAaveV3LYT.ts → PendleWstEthSCY.ts} +325 -320
- package/typechain-types/{ILiquidYieldTokenWrap.ts → PendleYearnVaultSCY.ts} +314 -290
- package/typechain-types/PendleYieldContractFactory.ts +74 -27
- package/typechain-types/PendleYieldToken.ts +272 -496
- package/typechain-types/RewardManager.ts +44 -82
- package/typechain-types/{IGaugeController.ts → RewardManagerAbstract.ts} +41 -32
- package/typechain-types/RouterStatic.ts +5 -11
- package/typechain-types/SCYBase.ts +276 -335
- package/typechain-types/SCYBaseWithRewards.ts +337 -433
- package/typechain-types/VotingControllerStorageUpg.ts +467 -0
- package/typechain-types/VotingEscrowPendleMainchain.ts +819 -0
- package/typechain-types/VotingEscrowPendleSidechain.ts +546 -0
- package/typechain-types/VotingEscrowTokenBase.ts +251 -0
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +122 -80
- package/typechain-types/factories/{ActionSCYAndYOBase__factory.ts → ActionSCYAndPTBase__factory.ts} +20 -33
- package/typechain-types/factories/ActionSCYAndPYBase__factory.ts +0 -13
- package/typechain-types/factories/ActionSCYAndYTBase__factory.ts +1 -14
- package/typechain-types/factories/ActionYT__factory.ts +39 -48
- package/typechain-types/factories/{CrosschainReceiver__factory.ts → CelerReceiverUpg__factory.ts} +39 -83
- package/typechain-types/factories/{CrosschainSender__factory.ts → CelerSenderUpg__factory.ts} +34 -37
- package/typechain-types/factories/{PendleBaseToken__factory.ts → ERC20Permit__factory.ts} +72 -52
- package/typechain-types/factories/ERC20__factory.ts +1 -1
- package/typechain-types/factories/IAToken__factory.ts +39 -0
- package/typechain-types/factories/IBenQiComptroller__factory.ts +13 -0
- package/typechain-types/factories/{InterestRateModel__factory.ts → IBenQiInterestRateModel__factory.ts} +12 -27
- package/typechain-types/factories/{PendleRouterBase__factory.ts → ICelerMessageBus__factory.ts} +29 -29
- package/typechain-types/factories/{IMessageReceiverApp__factory.ts → ICelerMessageReceiverApp__factory.ts} +19 -10
- package/typechain-types/factories/IERC20Permit__factory.ts +98 -0
- package/typechain-types/factories/{ERC20Burnable__factory.ts → IERC4626__factory.ts} +55 -49
- package/typechain-types/factories/IJoeRouter02__factory.ts +974 -0
- package/typechain-types/factories/IPActionCore__factory.ts +122 -58
- package/typechain-types/factories/IPActionYT__factory.ts +36 -21
- package/typechain-types/factories/IPAllAction__factory.ts +116 -81
- package/typechain-types/factories/IPGaugeControllerMainchain__factory.ts +177 -0
- package/typechain-types/factories/{IPGauge__factory.ts → IPGaugeController__factory.ts} +77 -52
- package/typechain-types/factories/IPInterestManagerYT__factory.ts +50 -0
- package/typechain-types/factories/IPMarketAddRemoveCallback__factory.ts +2 -2
- package/typechain-types/factories/IPMarketFactory__factory.ts +37 -0
- package/typechain-types/factories/IPMarket__factory.ts +35 -54
- package/typechain-types/factories/IPPrincipalToken__factory.ts +13 -0
- package/typechain-types/factories/IPVeToken__factory.ts +61 -5
- package/typechain-types/factories/IPVotingController__factory.ts +182 -0
- package/typechain-types/factories/IPVotingEscrow__factory.ts +68 -87
- package/typechain-types/factories/IPYieldToken__factory.ts +156 -106
- package/typechain-types/factories/{IPOwnershipToken__factory.ts → IQiAvax__factory.ts} +73 -60
- package/typechain-types/factories/IQiErc20__factory.ts +117 -0
- package/typechain-types/factories/IQiToken__factory.ts +117 -0
- package/typechain-types/factories/IRewardManager__factory.ts +8 -45
- package/typechain-types/factories/ISuperComposableYield__factory.ts +201 -138
- package/typechain-types/factories/IWXBTRFLY__factory.ts +13 -0
- package/typechain-types/factories/IWstETH__factory.ts +13 -0
- package/typechain-types/factories/IYearnVault__factory.ts +13 -0
- package/typechain-types/factories/InterestManagerYT__factory.ts +50 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +212 -318
- package/typechain-types/factories/PendleBtrflyScy__factory.ts +200 -234
- package/typechain-types/factories/PendleERC20Permit__factory.ts +405 -0
- package/typechain-types/factories/PendleERC20__factory.ts +327 -0
- package/typechain-types/factories/PendleERC4626SCY__factory.ts +678 -0
- package/typechain-types/factories/{EIP20NonStandardInterface__factory.ts → PendleGaugeControllerBaseUpg__factory.ts} +90 -91
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +334 -0
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +393 -0
- package/typechain-types/factories/PendleGauge__factory.ts +32 -268
- package/typechain-types/factories/PendleGovernanceManager__factory.ts +1 -1
- package/typechain-types/factories/PendleJoeLpSCY__factory.ts +726 -0
- package/typechain-types/factories/PendleJoeSwapHelperUpg__factory.ts +0 -13
- package/typechain-types/factories/PendleMarketFactory__factory.ts +91 -5
- package/typechain-types/factories/PendleMarket__factory.ts +158 -94
- package/typechain-types/factories/PendlePrincipalToken__factory.ts +1 -75
- package/typechain-types/factories/PendleQiTokenHelper__factory.ts +99 -0
- package/typechain-types/factories/PendleQiTokenSCY__factory.ts +821 -0
- package/typechain-types/factories/PendleRouter__factory.ts +1 -23
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +845 -0
- package/typechain-types/factories/PendleWstEthSCY__factory.ts +686 -0
- package/typechain-types/factories/PendleYearnVaultSCY__factory.ts +691 -0
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +42 -29
- package/typechain-types/factories/PendleYieldToken__factory.ts +165 -241
- package/typechain-types/factories/{PendleRouterSCYAndForgeBaseUpg__factory.ts → RewardManagerAbstract__factory.ts} +22 -19
- package/typechain-types/factories/RewardManager__factory.ts +28 -41
- package/typechain-types/factories/RouterStatic__factory.ts +2 -2
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +220 -220
- package/typechain-types/factories/SCYBase__factory.ts +195 -176
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +328 -0
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +588 -0
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +415 -0
- package/typechain-types/factories/VotingEscrowTokenBase__factory.ts +157 -0
- package/typechain-types/hardhat.d.ts +308 -155
- package/typechain-types/index.ts +84 -50
- package/build/artifacts/contracts/SuperComposableYield/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/SCYUtils.sol/SCYUtils.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/IRewardManager.sol/IRewardManager.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/RewardManager.sol/RewardManager.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBase.sol/SCYBase.dbg.json +0 -4
- package/build/artifacts/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleBaseToken.sol/PendleBaseToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarket.sol/PendleMarket.json +0 -842
- package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleMarketFactory.sol/PendleMarketFactory.json +0 -265
- package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendlePrincipalToken.sol/PendlePrincipalToken.json +0 -452
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.json +0 -783
- package/build/artifacts/contracts/core/PendleSCYImpl/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol/PendleBenQiErc20SCY.json +0 -766
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol/PendleBtrflyScy.json +0 -641
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleStETHSCY.sol/PendleStEthSCY.json +0 -623
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol/PendleYearnVaultScy.json +0 -623
- package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +0 -339
- package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.dbg.json +0 -4
- package/build/artifacts/contracts/core/PendleYieldToken.sol/PendleYieldToken.json +0 -808
- package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.dbg.json +0 -4
- package/build/artifacts/contracts/core/RouterStatic.sol/RouterStatic.json +0 -862
- package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/core/actions/ActionRedeem.sol/ActionRedeem.json +0 -55
- package/build/artifacts/contracts/core/actions/base/ActionType.sol/ActionType.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPActionRedeem.sol/IPActionRedeem.json +0 -55
- package/build/artifacts/contracts/interfaces/IPBaseToken.sol/IPBaseToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPGauge.sol/IPGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPVotingEscrowController.sol/IPVotingEscrowController.json +0 -61
- package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IPendleGauge.sol/IPendleGauge.json +0 -113
- package/build/artifacts/contracts/interfaces/IVePToken.sol/IVePToken.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/IVotingEscrowController.sol/VotingEscrowController.json +0 -61
- package/build/artifacts/contracts/interfaces/IVotingEscrowPendle.sol/IVotingEscrowPendle.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/JoeLibrary.sol/JoeLibrary.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/SCYIndex.sol/SCYIndexLib.dbg.json +0 -4
- package/build/artifacts/contracts/libraries/math/MarketMathAux.sol/MarketMathAux.dbg.json +0 -4
- package/build/artifacts/contracts/periphery/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +0 -4
- package/contracts/SuperComposableYield/ISuperComposableYield.sol +0 -80
- package/contracts/SuperComposableYield/SCYUtils.sol +0 -14
- package/contracts/SuperComposableYield/implementations/IRewardManager.sol +0 -16
- package/contracts/SuperComposableYield/implementations/RewardManager.sol +0 -151
- package/contracts/SuperComposableYield/implementations/SCYBase.sol +0 -166
- package/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol +0 -88
- package/contracts/core/PendleBaseToken.sol +0 -35
- package/contracts/core/PendlePrincipalToken.sol +0 -54
- package/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol +0 -140
- package/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol +0 -133
- package/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol +0 -120
- package/contracts/core/PendleSCYImpl/PendleStETHSCY.sol +0 -107
- package/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol +0 -109
- package/contracts/core/PendleYieldToken.sol +0 -340
- package/contracts/core/actions/ActionRedeem.sol +0 -36
- package/contracts/core/actions/base/ActionType.sol +0 -11
- package/contracts/interfaces/IPActionRedeem.sol +0 -17
- package/contracts/interfaces/IPBaseToken.sol +0 -9
- package/contracts/interfaces/IPGauge.sol +0 -32
- package/contracts/interfaces/IPVotingEscrowController.sol +0 -14
- package/contracts/interfaces/IPendleGauge.sol +0 -32
- package/contracts/interfaces/IVePToken.sol +0 -14
- package/contracts/interfaces/IVotingEscrowController.sol +0 -14
- package/contracts/interfaces/IVotingEscrowPendle.sol +0 -32
- package/contracts/libraries/math/MarketMathAux.sol +0 -101
- package/deployments/kovan.json +0 -31
- package/typechain-types/ActionRedeem.ts +0 -125
- package/typechain-types/AggregatorV2V3Interface.ts +0 -380
- package/typechain-types/BenqiChainlinkOracle.ts +0 -362
- package/typechain-types/BoringOwnable.ts +0 -194
- package/typechain-types/BoringOwnableData.ts +0 -100
- package/typechain-types/BoringOwnableUpg.ts +0 -194
- package/typechain-types/BoringOwnableUpgData.ts +0 -100
- package/typechain-types/Comptroller.ts +0 -2860
- package/typechain-types/ComptrollerErrorReporter.ts +0 -70
- package/typechain-types/ComptrollerInterface.ts +0 -881
- package/typechain-types/ComptrollerVXStorage.ts +0 -781
- package/typechain-types/CrosschainContract.ts +0 -113
- package/typechain-types/CrosschainReceiver.ts +0 -347
- package/typechain-types/CrosschainSender.ts +0 -210
- package/typechain-types/EIP20Interface.ts +0 -337
- package/typechain-types/EIP20NonStandardInterface.ts +0 -298
- package/typechain-types/ERC20Locker.ts +0 -91
- package/typechain-types/EpochController.ts +0 -195
- package/typechain-types/FundKeeper.ts +0 -347
- package/typechain-types/GaugeTypeControllerAbstract.ts +0 -546
- package/typechain-types/GaugeTypeControllerCrosschain.ts +0 -733
- package/typechain-types/GaugeTypeControllerMainchain.ts +0 -604
- package/typechain-types/ILiquidYieldToken.ts +0 -639
- package/typechain-types/IMessageBus.ts +0 -543
- package/typechain-types/IPActionRedeem.ts +0 -125
- package/typechain-types/IPFlashCallback.ts +0 -115
- package/typechain-types/IPGauge.ts +0 -241
- package/typechain-types/IPLiquidYieldToken.ts +0 -641
- package/typechain-types/IPMarketCallback.ts +0 -107
- package/typechain-types/IPOwnershipToken.ts +0 -488
- package/typechain-types/IPRouterCore.ts +0 -769
- package/typechain-types/IPRouterRedeem.ts +0 -155
- package/typechain-types/IPRouterYT.ts +0 -489
- package/typechain-types/IPVotingEscrowController.ts +0 -154
- package/typechain-types/IPendleGauge.ts +0 -241
- package/typechain-types/IPermissionsV2.ts +0 -87
- package/typechain-types/IRainbowBridge.ts +0 -91
- package/typechain-types/ISCYRewardIndex.ts +0 -695
- package/typechain-types/IVEPendleToken.ts +0 -121
- package/typechain-types/IVotingEscrowPendle.ts +0 -297
- package/typechain-types/IXPendle.ts +0 -114
- package/typechain-types/JumpRateModel.ts +0 -347
- package/typechain-types/LYTBase.ts +0 -721
- package/typechain-types/LYTWrap.ts +0 -872
- package/typechain-types/LYTWrapWithRewards.ts +0 -979
- package/typechain-types/LiquidityMining.ts +0 -468
- package/typechain-types/Maximillion.ts +0 -145
- package/typechain-types/Ownable.ts +0 -160
- package/typechain-types/PendleBenQiErc20SCY.ts +0 -1050
- package/typechain-types/PendleBenqiLiquidYieldToken.ts +0 -1013
- package/typechain-types/PendleBtrflyLYT.ts +0 -781
- package/typechain-types/PendleJoeSwapHelper.ts +0 -92
- package/typechain-types/PendleLYTMockYT.ts +0 -894
- package/typechain-types/PendleLiquidYieldToken.ts +0 -814
- package/typechain-types/PendleLiquidYieldTokenBase.ts +0 -941
- package/typechain-types/PendleOwnershipToken.ts +0 -598
- package/typechain-types/PendleRouter01.ts +0 -184
- package/typechain-types/PendleRouter02.ts +0 -564
- package/typechain-types/PendleRouter03.ts +0 -224
- package/typechain-types/PendleRouterBase.ts +0 -126
- package/typechain-types/PendleRouterCore.ts +0 -328
- package/typechain-types/PendleRouterCoreUpg.ts +0 -798
- package/typechain-types/PendleRouterLytAndForge.ts +0 -331
- package/typechain-types/PendleRouterMarketBase.ts +0 -82
- package/typechain-types/PendleRouterOT.ts +0 -463
- package/typechain-types/PendleRouterProxy.ts +0 -335
- package/typechain-types/PendleRouterRawTokenOT.ts +0 -865
- package/typechain-types/PendleRouterRawTokenYT.ts +0 -520
- package/typechain-types/PendleRouterRedeemUpg.ts +0 -125
- package/typechain-types/PendleRouterSCYAndForgeBaseUpg.ts +0 -98
- package/typechain-types/PendleRouterStaticUpg.ts +0 -399
- package/typechain-types/PendleRouterYT.ts +0 -227
- package/typechain-types/PendleRouterYTBaseUpg.ts +0 -134
- package/typechain-types/PendleRouterYTUpg.ts +0 -537
- package/typechain-types/PendleStEthSCY.ts +0 -872
- package/typechain-types/PendleYearnVaultLYT.ts +0 -723
- package/typechain-types/PendleYearnVaultScy.ts +0 -875
- package/typechain-types/PglStakingContract.ts +0 -662
- package/typechain-types/PglStakingContractProxy.ts +0 -256
- package/typechain-types/PglStakingContractProxyStorage.ts +0 -136
- package/typechain-types/PglStakingContractStorage.ts +0 -397
- package/typechain-types/PriceOracle.ts +0 -116
- package/typechain-types/ProtocolFakeUser.ts +0 -105
- package/typechain-types/Qi.ts +0 -760
- package/typechain-types/QiAvax.ts +0 -1720
- package/typechain-types/QiDelegateInterface.ts +0 -145
- package/typechain-types/QiDelegationStorage.ts +0 -82
- package/typechain-types/QiDelegatorInterface.ts +0 -149
- package/typechain-types/QiErc20.ts +0 -1846
- package/typechain-types/QiErc20Delegate.ts +0 -1926
- package/typechain-types/QiErc20Delegator.ts +0 -1885
- package/typechain-types/QiErc20Interface.ts +0 -382
- package/typechain-types/QiErc20Storage.ts +0 -79
- package/typechain-types/QiToken.ts +0 -1475
- package/typechain-types/QiTokenInterface.ts +0 -1419
- package/typechain-types/QiTokenSaleDistributor.ts +0 -771
- package/typechain-types/QiTokenSaleDistributorProxy.ts +0 -256
- package/typechain-types/QiTokenSaleDistributorProxyStorage.ts +0 -136
- package/typechain-types/QiTokenSaleDistributorStorage.ts +0 -401
- package/typechain-types/QiTokenStorage.ts +0 -311
- package/typechain-types/ReentrancyGuard.ts +0 -52
- package/typechain-types/SingleGaugeTypeController.ts +0 -478
- package/typechain-types/TokenErrorReporter.ts +0 -70
- package/typechain-types/Unitroller.ts +0 -356
- package/typechain-types/UnitrollerAdminStorage.ts +0 -143
- package/typechain-types/VePendle.ts +0 -1156
- package/typechain-types/VePendleCrosschain.ts +0 -969
- package/typechain-types/VePendleToken.ts +0 -688
- package/typechain-types/VotingController.ts +0 -883
- package/typechain-types/VotingEscrowController.ts +0 -154
- package/typechain-types/WETH9.ts +0 -414
- package/typechain-types/WhitePaperInterestRateModel.ts +0 -304
- package/typechain-types/XPendle.ts +0 -618
- package/typechain-types/factories/ActionRedeem__factory.ts +0 -105
- package/typechain-types/factories/AggregatorV2V3Interface__factory.ts +0 -288
- package/typechain-types/factories/BenqiChainlinkOracle__factory.ts +0 -311
- package/typechain-types/factories/BoringOwnableData__factory.ts +0 -90
- package/typechain-types/factories/BoringOwnableUpgData__factory.ts +0 -94
- package/typechain-types/factories/BoringOwnableUpg__factory.ts +0 -139
- package/typechain-types/factories/BoringOwnable__factory.ts +0 -149
- package/typechain-types/factories/ComptrollerErrorReporter__factory.ts +0 -93
- package/typechain-types/factories/ComptrollerInterface__factory.ts +0 -595
- package/typechain-types/factories/ComptrollerVXStorage__factory.ts +0 -610
- package/typechain-types/factories/Comptroller__factory.ts +0 -2189
- package/typechain-types/factories/CrosschainContract__factory.ts +0 -52
- package/typechain-types/factories/EIP20Interface__factory.ts +0 -248
- package/typechain-types/factories/ERC20Locker__factory.ts +0 -73
- package/typechain-types/factories/ERC20Premined__factory.ts +0 -393
- package/typechain-types/factories/ERC20PresetFixedSupply__factory.ts +0 -422
- package/typechain-types/factories/EpochController__factory.ts +0 -170
- package/typechain-types/factories/FundKeeper__factory.ts +0 -212
- package/typechain-types/factories/GaugeTypeControllerAbstract__factory.ts +0 -387
- package/typechain-types/factories/GaugeTypeControllerCrosschain__factory.ts +0 -522
- package/typechain-types/factories/GaugeTypeControllerMainchain__factory.ts +0 -431
- package/typechain-types/factories/IGaugeController__factory.ts +0 -45
- package/typechain-types/factories/ILiquidYieldTokenWrap__factory.ts +0 -533
- package/typechain-types/factories/ILiquidYieldToken__factory.ts +0 -429
- package/typechain-types/factories/IMessageBus__factory.ts +0 -396
- package/typechain-types/factories/IPActionRedeem__factory.ts +0 -70
- package/typechain-types/factories/IPBaseToken__factory.ts +0 -271
- package/typechain-types/factories/IPFlashCallback__factory.ts +0 -49
- package/typechain-types/factories/IPLiquidYieldToken__factory.ts +0 -433
- package/typechain-types/factories/IPMarketCallback__factory.ts +0 -55
- package/typechain-types/factories/IPRouterCore__factory.ts +0 -531
- package/typechain-types/factories/IPRouterRedeem__factory.ts +0 -72
- package/typechain-types/factories/IPRouterYT__factory.ts +0 -305
- package/typechain-types/factories/IPVotingEscrowController__factory.ts +0 -80
- package/typechain-types/factories/IPendleGauge__factory.ts +0 -125
- package/typechain-types/factories/IPermissionsV2__factory.ts +0 -39
- package/typechain-types/factories/IRainbowBridge__factory.ts +0 -76
- package/typechain-types/factories/ISCYRewardIndex__factory.ts +0 -465
- package/typechain-types/factories/IVEPendleToken__factory.ts +0 -71
- package/typechain-types/factories/IVePToken__factory.ts +0 -55
- package/typechain-types/factories/IVotingEscrowPendle__factory.ts +0 -182
- package/typechain-types/factories/IXPendle__factory.ts +0 -61
- package/typechain-types/factories/JumpRateModel__factory.ts +0 -334
- package/typechain-types/factories/LYTBaseWithRewards__factory.ts +0 -530
- package/typechain-types/factories/LYTBase__factory.ts +0 -474
- package/typechain-types/factories/LYTWrapWithRewards__factory.ts +0 -643
- package/typechain-types/factories/LYTWrap__factory.ts +0 -574
- package/typechain-types/factories/LiquidityMining__factory.ts +0 -367
- package/typechain-types/factories/Maximillion__factory.ts +0 -125
- package/typechain-types/factories/Ownable__factory.ts +0 -75
- package/typechain-types/factories/PendleAaveV3LYT__factory.ts +0 -657
- package/typechain-types/factories/PendleBenQiErc20LYT__factory.ts +0 -748
- package/typechain-types/factories/PendleBenQiErc20SCY__factory.ts +0 -871
- package/typechain-types/factories/PendleBenqiLiquidYieldToken__factory.ts +0 -785
- package/typechain-types/factories/PendleBtrflyLYT__factory.ts +0 -647
- package/typechain-types/factories/PendleJoeSwapHelper__factory.ts +0 -52
- package/typechain-types/factories/PendleLYTMockYT__factory.ts +0 -732
- package/typechain-types/factories/PendleLiquidYieldTokenBase__factory.ts +0 -603
- package/typechain-types/factories/PendleLiquidYieldToken__factory.ts +0 -510
- package/typechain-types/factories/PendleOwnershipToken__factory.ts +0 -527
- package/typechain-types/factories/PendleRouter01__factory.ts +0 -152
- package/typechain-types/factories/PendleRouter02__factory.ts +0 -438
- package/typechain-types/factories/PendleRouter03__factory.ts +0 -190
- package/typechain-types/factories/PendleRouterCoreUpg__factory.ts +0 -635
- package/typechain-types/factories/PendleRouterCore__factory.ts +0 -268
- package/typechain-types/factories/PendleRouterLytAndForge__factory.ts +0 -294
- package/typechain-types/factories/PendleRouterMarketBase__factory.ts +0 -43
- package/typechain-types/factories/PendleRouterOT__factory.ts +0 -372
- package/typechain-types/factories/PendleRouterProxy__factory.ts +0 -285
- package/typechain-types/factories/PendleRouterRawTokenOT__factory.ts +0 -697
- package/typechain-types/factories/PendleRouterRawTokenYT__factory.ts +0 -431
- package/typechain-types/factories/PendleRouterRedeemUpg__factory.ts +0 -112
- package/typechain-types/factories/PendleRouterStaticUpg__factory.ts +0 -315
- package/typechain-types/factories/PendleRouterYTBaseUpg__factory.ts +0 -66
- package/typechain-types/factories/PendleRouterYTUpg__factory.ts +0 -422
- package/typechain-types/factories/PendleRouterYT__factory.ts +0 -184
- package/typechain-types/factories/PendleStEthSCY__factory.ts +0 -716
- package/typechain-types/factories/PendleYTLYTBenqi__factory.ts +0 -713
- package/typechain-types/factories/PendleYearnVaultLYT__factory.ts +0 -586
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +0 -716
- package/typechain-types/factories/PermissionsV2__factory.ts +0 -36
- package/typechain-types/factories/PermlessAbstract__factory.ts +0 -30
- package/typechain-types/factories/PglStakingContractProxyStorage__factory.ts +0 -130
- package/typechain-types/factories/PglStakingContractProxy__factory.ts +0 -187
- package/typechain-types/factories/PglStakingContractStorage__factory.ts +0 -309
- package/typechain-types/factories/PglStakingContract__factory.ts +0 -446
- package/typechain-types/factories/PriceOracle__factory.ts +0 -59
- package/typechain-types/factories/ProtocolFakeUser__factory.ts +0 -87
- package/typechain-types/factories/QiAvax__factory.ts +0 -1471
- package/typechain-types/factories/QiDelegateInterface__factory.ts +0 -65
- package/typechain-types/factories/QiDelegationStorage__factory.ts +0 -79
- package/typechain-types/factories/QiDelegatorInterface__factory.ts +0 -89
- package/typechain-types/factories/QiErc20Delegate__factory.ts +0 -1563
- package/typechain-types/factories/QiErc20Delegator__factory.ts +0 -1648
- package/typechain-types/factories/QiErc20Interface__factory.ts +0 -239
- package/typechain-types/factories/QiErc20Storage__factory.ts +0 -79
- package/typechain-types/factories/QiErc20__factory.ts +0 -1515
- package/typechain-types/factories/QiTokenInterface__factory.ts +0 -1182
- package/typechain-types/factories/QiTokenSaleDistributorProxyStorage__factory.ts +0 -124
- package/typechain-types/factories/QiTokenSaleDistributorProxy__factory.ts +0 -171
- package/typechain-types/factories/QiTokenSaleDistributorStorage__factory.ts +0 -289
- package/typechain-types/factories/QiTokenSaleDistributor__factory.ts +0 -480
- package/typechain-types/factories/QiTokenStorage__factory.ts +0 -274
- package/typechain-types/factories/QiToken__factory.ts +0 -1219
- package/typechain-types/factories/Qi__factory.ts +0 -648
- package/typechain-types/factories/ReentrancyGuard__factory.ts +0 -69
- package/typechain-types/factories/SingleGaugeTypeController__factory.ts +0 -341
- package/typechain-types/factories/TokenErrorReporter__factory.ts +0 -89
- package/typechain-types/factories/UnitrollerAdminStorage__factory.ts +0 -128
- package/typechain-types/factories/Unitroller__factory.ts +0 -305
- package/typechain-types/factories/VePendleCrosschain__factory.ts +0 -727
- package/typechain-types/factories/VePendleToken__factory.ts +0 -494
- package/typechain-types/factories/VePendle__factory.ts +0 -800
- package/typechain-types/factories/VotingController__factory.ts +0 -610
- package/typechain-types/factories/VotingEscrowController__factory.ts +0 -80
- package/typechain-types/factories/WETH9__factory.ts +0 -342
- package/typechain-types/factories/WhitePaperInterestRateModel__factory.ts +0 -281
- package/typechain-types/factories/XPendle__factory.ts +0 -473
|
@@ -21,9 +21,30 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
pragma solidity 0.8.
|
|
24
|
+
pragma solidity 0.8.15;
|
|
25
25
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
26
|
+
import "./IBenQiInterestRateModel.sol";
|
|
26
27
|
|
|
27
28
|
interface IQiToken is IERC20 {
|
|
28
29
|
function exchangeRateCurrent() external returns (uint256);
|
|
30
|
+
|
|
31
|
+
function exchangeRateStored() external view returns (uint256);
|
|
32
|
+
|
|
33
|
+
function comptroller() external view returns (address);
|
|
34
|
+
|
|
35
|
+
function accrualBlockTimestamp() external view returns (uint256);
|
|
36
|
+
|
|
37
|
+
function getCash() external view returns (uint256);
|
|
38
|
+
|
|
39
|
+
function totalBorrows() external view returns (uint256);
|
|
40
|
+
|
|
41
|
+
function totalReserves() external view returns (uint256);
|
|
42
|
+
|
|
43
|
+
function borrowIndex() external view returns (uint256);
|
|
44
|
+
|
|
45
|
+
function interestRateModel() external view returns (IBenQiInterestRateModel);
|
|
46
|
+
|
|
47
|
+
function totalSupply() external view returns (uint256);
|
|
48
|
+
|
|
49
|
+
function reserveFactorMantissa() external view returns (uint256);
|
|
29
50
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
|
-
pragma solidity 0.8.
|
|
23
|
+
pragma solidity 0.8.15;
|
|
24
24
|
|
|
25
25
|
interface IREDACTEDStaking {
|
|
26
26
|
function stake(uint256 _amount, address _receiver) external returns (bool);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.15;
|
|
25
|
+
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
|
26
|
+
|
|
27
|
+
interface ISuperComposableYield is IERC20Metadata {
|
|
28
|
+
/// @dev Emitted when any base tokens is deposited to mint shares
|
|
29
|
+
event Deposit(
|
|
30
|
+
address indexed caller,
|
|
31
|
+
address indexed receiver,
|
|
32
|
+
address indexed tokenIn,
|
|
33
|
+
uint256 amountDeposited,
|
|
34
|
+
uint256 amountScyOut
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
/// @dev Emitted when any shares are redeemed for base tokens
|
|
38
|
+
event Redeem(
|
|
39
|
+
address indexed caller,
|
|
40
|
+
address indexed receiver,
|
|
41
|
+
address indexed tokenOut,
|
|
42
|
+
uint256 amountScyToRedeem,
|
|
43
|
+
uint256 amountTokenOut
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
/// @dev check assetInfo for more information
|
|
47
|
+
enum AssetType {
|
|
48
|
+
TOKEN,
|
|
49
|
+
LIQUIDITY
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// @dev Emitted when (`user`) claims their rewards
|
|
53
|
+
event ClaimRewards(address indexed user, address[] rewardTokens, uint256[] rewardAmounts);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @notice mints an amount of shares by depositing a base token.
|
|
57
|
+
* @param receiver shares recipient address
|
|
58
|
+
* @param tokenIn address of the base tokens to mint shares
|
|
59
|
+
* @param amountTokenToPull amount of base tokens to be transferred from (`msg.sender`)
|
|
60
|
+
* @param minSharesOut reverts if amount of shares minted is lower than this
|
|
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
|
|
72
|
+
*
|
|
73
|
+
* Requirements:
|
|
74
|
+
* - (`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
|
+
*/
|
|
78
|
+
function deposit(
|
|
79
|
+
address receiver,
|
|
80
|
+
address tokenIn,
|
|
81
|
+
uint256 amountTokenToPull,
|
|
82
|
+
uint256 minSharesOut
|
|
83
|
+
) external payable returns (uint256 amountSharesOut);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @notice redeems an amount of base tokens by burning some shares
|
|
87
|
+
* @param receiver recipient address
|
|
88
|
+
* @param amountSharesToPull amount of shares to be transferred from (`msg.sender`)
|
|
89
|
+
* @param tokenOut address of the base token to be redeemed
|
|
90
|
+
* @param minTokenOut reverts if amount of base token redeemed is lower than this
|
|
91
|
+
* @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
|
|
102
|
+
*
|
|
103
|
+
* Requirements:
|
|
104
|
+
* - (`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
|
+
*/
|
|
108
|
+
function redeem(
|
|
109
|
+
address receiver,
|
|
110
|
+
uint256 amountSharesToPull,
|
|
111
|
+
address tokenOut,
|
|
112
|
+
uint256 minTokenOut
|
|
113
|
+
) external returns (uint256 amountTokenOut);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @notice exchangeRate * scyBalance / 1e18 must return the asset balance of the account
|
|
117
|
+
* @notice vice-versa, if a user uses some amount of tokens equivalent to X asset, the amount of scy
|
|
118
|
+
he can mint must be X * exchangeRate / 1e18
|
|
119
|
+
* @dev SCYUtils's assetToScy & scyToAsset should be used instead of raw multiplication
|
|
120
|
+
& division
|
|
121
|
+
*/
|
|
122
|
+
function exchangeRate() external view returns (uint256 res);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @notice claims reward for (`user`)
|
|
126
|
+
* @param user the user receiving their rewards
|
|
127
|
+
* @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
|
|
128
|
+
* @dev
|
|
129
|
+
* Emits a `ClaimRewardss` event
|
|
130
|
+
* See {getRewardTokens} for list of reward tokens
|
|
131
|
+
*/
|
|
132
|
+
function claimRewards(address user) external returns (uint256[] memory rewardAmounts);
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @notice get the amount of unclaimed rewards for (`user`)
|
|
136
|
+
* @param user the user to check for
|
|
137
|
+
* @return rewardAmounts an array of reward amounts in the same order as `getRewardTokens`
|
|
138
|
+
*/
|
|
139
|
+
function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts);
|
|
140
|
+
|
|
141
|
+
function rewardIndexesCurrent() external returns (uint256[] memory indexes);
|
|
142
|
+
|
|
143
|
+
function rewardIndexesStored() external view returns (uint256[] memory indexes);
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @notice returns the list of reward token addresses
|
|
147
|
+
*/
|
|
148
|
+
function getRewardTokens() external view returns (address[] memory);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @notice returns the address of the underlying yield token
|
|
152
|
+
*/
|
|
153
|
+
function yieldToken() external view returns (address);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @notice returns a list of all the base tokens that can be deposited to mint shares
|
|
157
|
+
*/
|
|
158
|
+
function getBaseTokens() external view returns (address[] memory res);
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @notice checks whether a token is a valid base token
|
|
162
|
+
* @notice returns a boolean indicating whether this is a valid token
|
|
163
|
+
*/
|
|
164
|
+
function isValidBaseToken(address token) external view returns (bool);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @notice This function contains information to interpret what the asset is
|
|
168
|
+
* @notice decimals is the decimals to format asset balances
|
|
169
|
+
* @notice if asset is an ERC20 token, assetType = 0, assetAddress is the address of the token
|
|
170
|
+
* @notice if asset is liquidity of an AMM (like sqrt(k) in UniswapV2 forks), assetType = 1,
|
|
171
|
+
assetAddress is the address of the LP token
|
|
172
|
+
* @notice assetDecimals is the decimals of the asset
|
|
173
|
+
*/
|
|
174
|
+
function assetInfo()
|
|
175
|
+
external
|
|
176
|
+
view
|
|
177
|
+
returns (
|
|
178
|
+
AssetType assetType,
|
|
179
|
+
address assetAddress,
|
|
180
|
+
uint8 assetDecimals
|
|
181
|
+
);
|
|
182
|
+
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
|
-
pragma solidity 0.8.
|
|
23
|
+
pragma solidity 0.8.15;
|
|
24
24
|
|
|
25
25
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
26
26
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
|
-
pragma solidity 0.8.
|
|
23
|
+
pragma solidity 0.8.15;
|
|
24
24
|
|
|
25
25
|
interface IWXBTRFLY {
|
|
26
26
|
function wrapFromBTRFLY(uint256 _amount) external returns (uint256);
|
|
@@ -31,6 +31,8 @@ interface IWXBTRFLY {
|
|
|
31
31
|
|
|
32
32
|
function unwrapToxBTRFLY(uint256 _amount) external returns (uint256);
|
|
33
33
|
|
|
34
|
+
function BTRFLY() external view returns (address);
|
|
35
|
+
|
|
34
36
|
function xBTRFLY() external view returns (address);
|
|
35
37
|
|
|
36
38
|
function xBTRFLYValue(uint256 _amount) external view returns (uint256);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
3
|
|
|
4
4
|
interface IWstETH {
|
|
5
5
|
function wrap(uint256 _stETHAmount) external returns (uint256);
|
|
6
6
|
|
|
7
7
|
function unwrap(uint256 _wstETHAmount) external returns (uint256);
|
|
8
8
|
|
|
9
|
+
function stETH() external view returns (address);
|
|
10
|
+
|
|
9
11
|
function stEthPerToken() external view returns (uint256);
|
|
10
12
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
pragma solidity 0.8.
|
|
24
|
+
pragma solidity 0.8.15;
|
|
25
25
|
|
|
26
26
|
interface IYearnVault {
|
|
27
27
|
function deposit(uint256 amount) external returns (uint256);
|
|
@@ -29,4 +29,6 @@ interface IYearnVault {
|
|
|
29
29
|
function withdraw(uint256 maxShares) external returns (uint256);
|
|
30
30
|
|
|
31
31
|
function pricePerShare() external view returns (uint256);
|
|
32
|
+
|
|
33
|
+
function token() external view returns (address);
|
|
32
34
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
import "../interfaces/IRewardManager.sol";
|
|
4
|
+
import "./RewardManagerAbstract.sol";
|
|
5
|
+
import "./math/Math.sol";
|
|
6
|
+
import "../libraries/helpers/ArrayLib.sol";
|
|
7
|
+
|
|
8
|
+
/// * This RewardManager can be used with any contracts, regardless of what tokens that contract stores
|
|
9
|
+
/// since the RewardManager will maintain its own internal balance
|
|
10
|
+
/// * Use with SCY + PendleMarket. For YT, it has its own native implementation for gas saving
|
|
11
|
+
abstract contract RewardManager is RewardManagerAbstract {
|
|
12
|
+
using Math for uint256;
|
|
13
|
+
using ArrayLib for uint256[];
|
|
14
|
+
|
|
15
|
+
uint256 public lastRewardBlock;
|
|
16
|
+
|
|
17
|
+
mapping(address => RewardState) public rewardState;
|
|
18
|
+
|
|
19
|
+
uint256 internal constant INITIAL_REWARD_INDEX = 1;
|
|
20
|
+
|
|
21
|
+
function _updateRewardIndex()
|
|
22
|
+
internal
|
|
23
|
+
virtual
|
|
24
|
+
override
|
|
25
|
+
returns (address[] memory tokens, uint256[] memory indexes)
|
|
26
|
+
{
|
|
27
|
+
tokens = _getRewardTokens();
|
|
28
|
+
indexes = new uint256[](tokens.length);
|
|
29
|
+
|
|
30
|
+
if (tokens.length == 0) return (tokens, indexes);
|
|
31
|
+
|
|
32
|
+
if (lastRewardBlock != block.number) {
|
|
33
|
+
// if we have not yet update the index for this block
|
|
34
|
+
lastRewardBlock = block.number;
|
|
35
|
+
|
|
36
|
+
uint256 totalShares = _rewardSharesTotal();
|
|
37
|
+
|
|
38
|
+
uint256[] memory preBalances = _selfBalances(tokens);
|
|
39
|
+
|
|
40
|
+
_redeemExternalReward();
|
|
41
|
+
|
|
42
|
+
uint256[] memory accrued = _selfBalances(tokens).sub(preBalances);
|
|
43
|
+
|
|
44
|
+
for (uint256 i = 0; i < tokens.length; ++i) {
|
|
45
|
+
address token = tokens[i];
|
|
46
|
+
uint256 index = rewardState[token].index;
|
|
47
|
+
|
|
48
|
+
if (index == 0) index = INITIAL_REWARD_INDEX;
|
|
49
|
+
if (totalShares != 0) index += accrued[i].divDown(totalShares);
|
|
50
|
+
|
|
51
|
+
rewardState[token].index = index.Uint128();
|
|
52
|
+
rewardState[token].lastBalance += accrued[i].Uint128();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for (uint256 i = 0; i < tokens.length; i++) indexes[i] = rewardState[tokens[i]].index;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// @dev this function doesn't need redeemExternal since redeemExternal is bundled in updateRewardIndex
|
|
60
|
+
/// @dev this function also has to update rewardState.lastBalance
|
|
61
|
+
function _doTransferOutRewards(address user, address receiver)
|
|
62
|
+
internal
|
|
63
|
+
virtual
|
|
64
|
+
override
|
|
65
|
+
returns (uint256[] memory rewardAmounts)
|
|
66
|
+
{
|
|
67
|
+
address[] memory tokens = _getRewardTokens();
|
|
68
|
+
rewardAmounts = new uint256[](tokens.length);
|
|
69
|
+
for (uint256 i = 0; i < tokens.length; i++) {
|
|
70
|
+
rewardAmounts[i] = userReward[tokens[i]][user].accrued;
|
|
71
|
+
if (rewardAmounts[i] != 0) {
|
|
72
|
+
userReward[tokens[i]][user].accrued = 0;
|
|
73
|
+
rewardState[tokens[i]].lastBalance -= rewardAmounts[i].Uint128();
|
|
74
|
+
_transferOut(tokens[i], receiver, rewardAmounts[i]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
import "../interfaces/IRewardManager.sol";
|
|
4
|
+
import "./helpers/TokenHelper.sol";
|
|
5
|
+
import "./math/Math.sol";
|
|
6
|
+
|
|
7
|
+
abstract contract RewardManagerAbstract is IRewardManager, TokenHelper {
|
|
8
|
+
using Math for uint256;
|
|
9
|
+
|
|
10
|
+
struct RewardState {
|
|
11
|
+
uint128 index;
|
|
12
|
+
uint128 lastBalance;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
struct UserReward {
|
|
16
|
+
uint128 index;
|
|
17
|
+
uint128 accrued;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// [token] => [user] => (index,accured)
|
|
21
|
+
mapping(address => mapping(address => UserReward)) public userReward;
|
|
22
|
+
|
|
23
|
+
function _updateAndDistributeRewards(address user) internal virtual {
|
|
24
|
+
_updateAndDistributeRewardsForTwo(user, address(0));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _updateAndDistributeRewardsForTwo(address user1, address user2) internal virtual {
|
|
28
|
+
(address[] memory tokens, uint256[] memory indexes) = _updateRewardIndex();
|
|
29
|
+
if (tokens.length == 0) return;
|
|
30
|
+
|
|
31
|
+
if (user1 != address(0) && user1 != address(this))
|
|
32
|
+
_distributeRewards(user1, tokens, indexes);
|
|
33
|
+
if (user2 != address(0) && user2 != address(this))
|
|
34
|
+
_distributeRewards(user2, tokens, indexes);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// @dev private function
|
|
38
|
+
function _distributeRewards(
|
|
39
|
+
address user,
|
|
40
|
+
address[] memory tokens,
|
|
41
|
+
uint256[] memory indexes
|
|
42
|
+
) private {
|
|
43
|
+
uint256 userShares = _rewardSharesUser(user);
|
|
44
|
+
|
|
45
|
+
for (uint256 i = 0; i < tokens.length; ++i) {
|
|
46
|
+
address token = tokens[i];
|
|
47
|
+
uint256 index = indexes[i];
|
|
48
|
+
uint256 userIndex = userReward[token][user].index;
|
|
49
|
+
|
|
50
|
+
if (userIndex == 0) {
|
|
51
|
+
userReward[token][user].index = index.Uint128();
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (userIndex == index) continue;
|
|
56
|
+
|
|
57
|
+
uint256 deltaIndex = index - userIndex;
|
|
58
|
+
uint256 rewardDelta = userShares.mulDown(deltaIndex);
|
|
59
|
+
uint256 rewardAccrued = userReward[token][user].accrued + rewardDelta;
|
|
60
|
+
|
|
61
|
+
userReward[token][user] = UserReward({
|
|
62
|
+
index: index.Uint128(),
|
|
63
|
+
accrued: rewardAccrued.Uint128()
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function _updateRewardIndex()
|
|
69
|
+
internal
|
|
70
|
+
virtual
|
|
71
|
+
returns (address[] memory tokens, uint256[] memory indexes);
|
|
72
|
+
|
|
73
|
+
function _redeemExternalReward() internal virtual;
|
|
74
|
+
|
|
75
|
+
function _doTransferOutRewards(address user, address receiver)
|
|
76
|
+
internal
|
|
77
|
+
virtual
|
|
78
|
+
returns (uint256[] memory rewardAmounts);
|
|
79
|
+
|
|
80
|
+
function _getRewardTokens() internal view virtual returns (address[] memory);
|
|
81
|
+
|
|
82
|
+
function _rewardSharesUser(address user) internal view virtual returns (uint256);
|
|
83
|
+
|
|
84
|
+
function _rewardSharesTotal() internal view virtual returns (uint256);
|
|
85
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity 0.8.
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
import "../../interfaces/ISuperComposableYield.sol";
|
|
4
|
+
import "./SCYUtils.sol";
|
|
5
|
+
import "../math/Math.sol";
|
|
6
6
|
|
|
7
7
|
type SCYIndex is uint256;
|
|
8
8
|
|
|
@@ -10,12 +10,12 @@ library SCYIndexLib {
|
|
|
10
10
|
using Math for uint256;
|
|
11
11
|
using Math for int256;
|
|
12
12
|
|
|
13
|
-
function newIndex(ISuperComposableYield SCY) internal returns (SCYIndex) {
|
|
14
|
-
return SCYIndex.wrap(SCY.
|
|
13
|
+
function newIndex(ISuperComposableYield SCY) internal view returns (SCYIndex) {
|
|
14
|
+
return SCYIndex.wrap(SCY.exchangeRate());
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function newIndex(address SCY) internal returns (SCYIndex) {
|
|
18
|
-
return SCYIndex.wrap(ISuperComposableYield(SCY).
|
|
17
|
+
function newIndex(address SCY) internal view returns (SCYIndex) {
|
|
18
|
+
return SCYIndex.wrap(ISuperComposableYield(SCY).exchangeRate());
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function scyToAsset(SCYIndex index, uint256 scyAmount)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
|
|
4
|
+
library SCYUtils {
|
|
5
|
+
uint256 internal constant ONE = 1e18;
|
|
6
|
+
|
|
7
|
+
function scyToAsset(uint256 exchangeRate, uint256 scyAmount) internal pure returns (uint256) {
|
|
8
|
+
return (scyAmount * exchangeRate) / ONE;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function assetToScy(uint256 exchangeRate, uint256 assetAmount)
|
|
12
|
+
internal
|
|
13
|
+
pure
|
|
14
|
+
returns (uint256)
|
|
15
|
+
{
|
|
16
|
+
return (assetAmount * ONE) / exchangeRate;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.15;
|
|
3
|
+
|
|
4
|
+
struct VeBalance {
|
|
5
|
+
uint128 bias;
|
|
6
|
+
uint128 slope;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
struct LockedPosition {
|
|
10
|
+
uint128 amount;
|
|
11
|
+
uint128 expiry;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
library VeBalanceLib {
|
|
15
|
+
uint128 internal constant MAX_LOCK_TIME = 104 weeks;
|
|
16
|
+
|
|
17
|
+
function add(VeBalance memory a, VeBalance memory b)
|
|
18
|
+
internal
|
|
19
|
+
pure
|
|
20
|
+
returns (VeBalance memory res)
|
|
21
|
+
{
|
|
22
|
+
res.bias = a.bias + b.bias;
|
|
23
|
+
res.slope = a.slope + b.slope;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function sub(VeBalance memory a, VeBalance memory b)
|
|
27
|
+
internal
|
|
28
|
+
pure
|
|
29
|
+
returns (VeBalance memory res)
|
|
30
|
+
{
|
|
31
|
+
res.bias = a.bias - b.bias;
|
|
32
|
+
res.slope = a.slope - b.slope;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function sub(
|
|
36
|
+
VeBalance memory a,
|
|
37
|
+
uint128 slope,
|
|
38
|
+
uint128 expiry
|
|
39
|
+
) internal pure returns (VeBalance memory res) {
|
|
40
|
+
res.slope = a.slope - slope;
|
|
41
|
+
res.bias = a.bias - slope * expiry;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isExpired(VeBalance memory a) internal view returns (bool) {
|
|
45
|
+
return a.slope * uint128(block.timestamp) >= a.bias;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getCurrentValue(VeBalance memory a) internal view returns (uint128) {
|
|
49
|
+
if (isExpired(a)) return 0;
|
|
50
|
+
return getValueAt(a, uint128(block.timestamp));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getValueAt(VeBalance memory a, uint128 t) internal pure returns (uint128) {
|
|
54
|
+
return a.bias - a.slope * t;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getExpiry(VeBalance memory a) internal pure returns (uint128) {
|
|
58
|
+
require(a.slope != 0, "zero slope");
|
|
59
|
+
return a.bias / a.slope;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function convertToVeBalance(LockedPosition memory position)
|
|
63
|
+
internal
|
|
64
|
+
pure
|
|
65
|
+
returns (VeBalance memory res)
|
|
66
|
+
{
|
|
67
|
+
res.slope = position.amount / MAX_LOCK_TIME;
|
|
68
|
+
require(res.slope > 0, "zero slope");
|
|
69
|
+
res.bias = res.slope * position.expiry;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function convertToVeBalance(uint128 amount, uint128 expiry)
|
|
73
|
+
internal
|
|
74
|
+
pure
|
|
75
|
+
returns (uint128, uint128)
|
|
76
|
+
{
|
|
77
|
+
VeBalance memory balance = convertToVeBalance(LockedPosition(amount, expiry));
|
|
78
|
+
return (balance.bias, balance.slope);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Forked from OpenZeppelin (v4.5.0) (utils/Checkpoints.sol)
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
import "./math/Math.sol";
|
|
6
|
+
import "./VeBalanceLib.sol";
|
|
7
|
+
|
|
8
|
+
library Checkpoints {
|
|
9
|
+
struct Checkpoint {
|
|
10
|
+
uint32 _timestamp;
|
|
11
|
+
VeBalance _value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
struct History {
|
|
15
|
+
Checkpoint[] _checkpoints;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one
|
|
20
|
+
* before it is returned, or zero otherwise.
|
|
21
|
+
*/
|
|
22
|
+
function getAtTimestamp(History storage self, uint256 timestamp)
|
|
23
|
+
internal
|
|
24
|
+
view
|
|
25
|
+
returns (uint128)
|
|
26
|
+
{
|
|
27
|
+
require(timestamp < block.timestamp, "Checkpoints: block not yet mined");
|
|
28
|
+
|
|
29
|
+
uint256 high = self._checkpoints.length;
|
|
30
|
+
uint256 low = 0;
|
|
31
|
+
while (low < high) {
|
|
32
|
+
uint256 mid = (low + high) / 2;
|
|
33
|
+
if (self._checkpoints[mid]._timestamp > timestamp) {
|
|
34
|
+
high = mid;
|
|
35
|
+
} else {
|
|
36
|
+
low = mid + 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return
|
|
40
|
+
high == 0
|
|
41
|
+
? 0
|
|
42
|
+
: VeBalanceLib.getValueAt(self._checkpoints[high - 1]._value, uint128(timestamp));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @dev Pushes a value onto a History so that it is stored as the checkpoint for the current block.
|
|
47
|
+
*
|
|
48
|
+
* Returns previous value and new value.
|
|
49
|
+
*/
|
|
50
|
+
function push(History storage self, VeBalance memory value) internal {
|
|
51
|
+
uint256 pos = self._checkpoints.length;
|
|
52
|
+
if (pos > 0 && self._checkpoints[pos - 1]._timestamp == block.timestamp) {
|
|
53
|
+
self._checkpoints[pos - 1]._value = value;
|
|
54
|
+
} else {
|
|
55
|
+
self._checkpoints.push(
|
|
56
|
+
Checkpoint({ _timestamp: uint32(block.timestamp), _value: value })
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|