@pendle/core-v2 2.13.3-mainnet → 2.14.1-mainnet
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/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/CheckpointHelper.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSeller.sol/BulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/core/BulkSeller/BulkSellerMathCore.sol/BulkSellerMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/RewardManager/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/core/RewardManager/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBase.sol/SYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithRewards.sol/SYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ape/sAPE.sol/sAPE.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethAnkrethSYV2.sol/PendleAuraWethAnkrethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethRocketEthSYV2.sol/PendleAuraWethRocketEthSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethStafiEthSY.sol/PendleAuraWethStafiEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/PendleAuraWethWstethSYV2.sol/PendleAuraWethWstethSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BalancerStable/base/PendleAuraBalancerStableLPSYV2.sol/PendleAuraBalancerStableLPSYV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/BenQi/PendleQiTokenSY.sol/PendleQiTokenSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol/CamelotRewardHelper.json +6 -6
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileCommon.sol/CamelotV1VolatileCommon.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol/CamelotV1VolatileLpHelper.json +0 -26
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatilePreview.sol/CamelotV1VolatilePreview.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol/PendleCamelotV1VolatileSY.json +10 -41
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveFraxUsdcSY.sol/PendleCurveFraxUsdcSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/PendleCurveUsdd3CrvSY.sol/PendleCurveUsdd3CrvSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/Curve3CrvPoolHelper.sol/Curve3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveFraxUsdcPoolHelper.sol/CurveFraxUsdcPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/CurveUsdd3CrvPoolHelper.sol/CurveUsdd3CrvPoolHelper.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Convex/base/PendleConvexLPSY.sol/PendleConvexLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleLooksStakingSY.sol/PendleLooksStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleStargateLPSY.sol/PendleStargateLPSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleWstEthSY.sol/PendleWstEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/InterestManagerYTV2.sol/InterestManagerYTV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldContractFactoryV2.sol/PendleYieldContractFactoryV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContractsV2/PendleYieldTokenV2.sol/PendleYieldTokenV2.dbg.json +1 -1
- package/build/artifacts/contracts/core/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNFTPool.sol/ICamelotNFTPool.json +48 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPool.sol/ICamelotNitroPool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPoolFactory.sol/ICamelotNitroPoolFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotNitroPoolFactory.sol/ICamelotNitroPoolFactory.json +638 -0
- package/build/artifacts/contracts/interfaces/Camelot/ICamelotPair.sol/ICamelotPair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPBulkSeller.sol/IPBulkSeller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrowMainchain.sol/IPVotingEscrowMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BoringPtSeller.sol/BoringPtSeller.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BulkSellerOffchain.sol/BulkSellerOffchain.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracle.sol/PendlePtOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtGlpOracle.sol/PendlePtGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/PendlePtUsdChainlinkOracle.sol/PendlePtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseCallback.sol/ActionBaseCallback.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol +18 -10
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotV1VolatileLpHelper.sol +2 -10
- package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/PendleCamelotV1VolatileSY.sol +42 -34
- package/contracts/interfaces/Camelot/ICamelotNFTPool.sol +14 -0
- package/contracts/interfaces/Camelot/ICamelotNitroPoolFactory.sol +95 -0
- package/deployments/42161-markets/CAMELOT-ARBETH-27JUNE2024-ARBITRUM.json +8 -0
- package/package.json +1 -1
- package/typechain-types/CamelotV1LpHelper.ts +203 -0
- package/typechain-types/CamelotV1Preview.ts +431 -0
- package/typechain-types/CamelotV1VolatileLpHelper.ts +0 -32
- package/typechain-types/ICamelotNFTPool.ts +85 -0
- package/typechain-types/ICamelotNitroPoolFactory.ts +1053 -0
- package/typechain-types/ICamelotSY.ts +100 -0
- package/typechain-types/IPendlePreviewHelper.ts +147 -0
- package/typechain-types/PendleCamelotV1SY.ts +2011 -0
- package/typechain-types/PendleCamelotV1VolatileSY.ts +14 -46
- package/typechain-types/factories/CamelotRewardHelper__factory.ts +24 -13
- package/typechain-types/factories/CamelotV1LpHelper__factory.ts +143 -0
- package/typechain-types/factories/CamelotV1Preview__factory.ts +309 -0
- package/typechain-types/factories/CamelotV1VolatileLpHelper__factory.ts +0 -26
- package/typechain-types/factories/ICamelotNFTPool__factory.ts +48 -0
- package/typechain-types/factories/ICamelotNitroPoolFactory__factory.ts +657 -0
- package/typechain-types/factories/ICamelotSY__factory.ts +49 -0
- package/typechain-types/factories/IPendlePreviewHelper__factory.ts +78 -0
- package/typechain-types/factories/PendleCamelotV1SY__factory.ts +1621 -0
- package/typechain-types/factories/PendleCamelotV1VolatileSY__factory.ts +25 -53
- package/typechain-types/hardhat.d.ts +54 -0
- package/typechain-types/index.ts +12 -0
package/contracts/core/StandardizedYield/implementations/CamelotV1Volatile/CamelotRewardHelper.sol
CHANGED
|
@@ -4,6 +4,7 @@ pragma solidity 0.8.17;
|
|
|
4
4
|
|
|
5
5
|
import "../../../libraries/TokenHelper.sol";
|
|
6
6
|
import "../../../../interfaces/Camelot/ICamelotNFTFactory.sol";
|
|
7
|
+
import "../../../../interfaces/Camelot/ICamelotNitroPoolFactory.sol";
|
|
7
8
|
import "../../../../interfaces/Camelot/ICamelotNFTPool.sol";
|
|
8
9
|
import "../../../../interfaces/Camelot/ICamelotNitroPool.sol";
|
|
9
10
|
import "../../../../interfaces/Camelot/ICamelotNFTHandler.sol";
|
|
@@ -19,12 +20,14 @@ import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
|
|
|
19
20
|
* will be forced to occur and take away fees from our xGRAIL boosting
|
|
20
21
|
*/
|
|
21
22
|
contract CamelotRewardHelper is TokenHelper, ICamelotNFTHandler {
|
|
23
|
+
ICamelotNitroPoolFactory internal constant NITRO_POOL_FACTORY =
|
|
24
|
+
ICamelotNitroPoolFactory(0xe0a6b372Ac6AF4B37c7F3a989Fe5d5b194c24569);
|
|
22
25
|
uint256 internal constant POSITION_UNINITIALIZED = type(uint256).max;
|
|
23
26
|
uint256 internal constant MINIMUM_LIQUIDITY = 10 ** 3;
|
|
24
27
|
bytes4 internal constant _ERC721_RECEIVED = 0x150b7a02;
|
|
25
28
|
|
|
29
|
+
address public nitroPool;
|
|
26
30
|
address public immutable nftPool;
|
|
27
|
-
address public immutable nitroPool;
|
|
28
31
|
address public immutable GRAIL;
|
|
29
32
|
address public immutable xGRAIL;
|
|
30
33
|
uint256 public positionId = POSITION_UNINITIALIZED;
|
|
@@ -41,14 +44,18 @@ contract CamelotRewardHelper is TokenHelper, ICamelotNFTHandler {
|
|
|
41
44
|
_;
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
constructor(address
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
constructor(address _nftPool, uint256 _nitroPoolIndex) {
|
|
48
|
+
nftPool = _nftPool;
|
|
49
|
+
if (_nitroPoolIndex != type(uint256).max) {
|
|
50
|
+
nitroPool = NITRO_POOL_FACTORY.getNitroPool(_nitroPoolIndex);
|
|
51
|
+
require(ICamelotNitroPool(nitroPool).nftPool() == nftPool);
|
|
52
|
+
}
|
|
50
53
|
|
|
54
|
+
address lp;
|
|
55
|
+
(lp, GRAIL, xGRAIL, , , , , ) = ICamelotNFTPool(nftPool).getPoolInfo();
|
|
51
56
|
yieldBooster = ICamelotNFTPool(nftPool).yieldBooster();
|
|
57
|
+
|
|
58
|
+
_safeApproveInf(lp, nftPool);
|
|
52
59
|
IXGrail(xGRAIL).approveUsage(yieldBooster, type(uint256).max);
|
|
53
60
|
}
|
|
54
61
|
|
|
@@ -104,7 +111,6 @@ contract CamelotRewardHelper is TokenHelper, ICamelotNFTHandler {
|
|
|
104
111
|
positionId = ICamelotNFTPool(nftPool).lastTokenId() + 1;
|
|
105
112
|
ICamelotNFTPool(nftPool).createPosition(amountLp, 0);
|
|
106
113
|
|
|
107
|
-
// deposit nft to nitro pool (first time)
|
|
108
114
|
_depositToNitroPool();
|
|
109
115
|
|
|
110
116
|
return amountLp - MINIMUM_LIQUIDITY;
|
|
@@ -121,12 +127,14 @@ contract CamelotRewardHelper is TokenHelper, ICamelotNFTHandler {
|
|
|
121
127
|
_depositToNitroPool();
|
|
122
128
|
}
|
|
123
129
|
|
|
124
|
-
function _depositToNitroPool()
|
|
130
|
+
function _depositToNitroPool() internal {
|
|
125
131
|
// Nitro pool's on receive callback will execute the accounting logic
|
|
132
|
+
if (nitroPool == address(0) || positionId == POSITION_UNINITIALIZED) return;
|
|
126
133
|
IERC721(nftPool).safeTransferFrom(address(this), nitroPool, positionId);
|
|
127
134
|
}
|
|
128
135
|
|
|
129
|
-
function _withdrawFromNitroPool()
|
|
136
|
+
function _withdrawFromNitroPool() internal {
|
|
137
|
+
if (nitroPool == address(0) || positionId == POSITION_UNINITIALIZED) return;
|
|
130
138
|
ICamelotNitroPool(nitroPool).withdraw(positionId);
|
|
131
139
|
}
|
|
132
140
|
|
|
@@ -22,26 +22,18 @@ abstract contract CamelotV1VolatileLpHelper is TokenHelper, CamelotV1VolatileCom
|
|
|
22
22
|
address public immutable token0;
|
|
23
23
|
address public immutable token1;
|
|
24
24
|
address public immutable pair;
|
|
25
|
-
address public immutable factory;
|
|
26
25
|
address public immutable router;
|
|
27
26
|
|
|
28
|
-
address public referrerForSwap;
|
|
29
27
|
|
|
30
28
|
constructor(
|
|
31
29
|
address _pair,
|
|
32
|
-
address
|
|
33
|
-
address _router,
|
|
34
|
-
address _referrerForSwap
|
|
30
|
+
address _router
|
|
35
31
|
) {
|
|
36
32
|
assert(ICamelotPair(_pair).stableSwap() == false);
|
|
37
|
-
|
|
38
33
|
pair = _pair;
|
|
39
|
-
factory = _factory;
|
|
40
34
|
router = _router;
|
|
41
35
|
token0 = ICamelotPair(pair).token0();
|
|
42
36
|
token1 = ICamelotPair(pair).token1();
|
|
43
|
-
referrerForSwap = _referrerForSwap;
|
|
44
|
-
|
|
45
37
|
_safeApproveInf(token0, router);
|
|
46
38
|
_safeApproveInf(token1, router);
|
|
47
39
|
_safeApproveInf(pair, router);
|
|
@@ -137,7 +129,7 @@ abstract contract CamelotV1VolatileLpHelper is TokenHelper, CamelotV1VolatileCom
|
|
|
137
129
|
0,
|
|
138
130
|
path,
|
|
139
131
|
address(this),
|
|
140
|
-
|
|
132
|
+
address(0),
|
|
141
133
|
block.timestamp
|
|
142
134
|
);
|
|
143
135
|
|
|
@@ -19,19 +19,19 @@ contract PendleCamelotV1VolatileSY is
|
|
|
19
19
|
CamelotV1VolatilePreview public immutable previewHelper;
|
|
20
20
|
bool public isRewardDisabled;
|
|
21
21
|
|
|
22
|
+
/// @notice _nitroPoolIndex set to uint256(max) to indicate that this SY is not using Nitro Pool
|
|
22
23
|
constructor(
|
|
23
24
|
string memory _name,
|
|
24
25
|
string memory _symbol,
|
|
25
26
|
address _pair,
|
|
26
|
-
address _factory,
|
|
27
27
|
address _router,
|
|
28
|
-
address
|
|
29
|
-
|
|
28
|
+
address _nftPool,
|
|
29
|
+
uint256 _nitroPoolIndex,
|
|
30
30
|
CamelotV1VolatilePreview _previewHelper
|
|
31
31
|
)
|
|
32
|
-
CamelotV1VolatileLpHelper(_pair,
|
|
32
|
+
CamelotV1VolatileLpHelper(_pair, _router)
|
|
33
33
|
SYBaseWithRewards(_name, _symbol, _pair)
|
|
34
|
-
CamelotRewardHelper(
|
|
34
|
+
CamelotRewardHelper(_nftPool, _nitroPoolIndex)
|
|
35
35
|
{
|
|
36
36
|
rewardTokens.push(GRAIL);
|
|
37
37
|
updateRewardTokensList();
|
|
@@ -41,12 +41,10 @@ contract PendleCamelotV1VolatileSY is
|
|
|
41
41
|
/**
|
|
42
42
|
* @dev See {SYBase-_deposit}
|
|
43
43
|
*/
|
|
44
|
-
function _deposit(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
returns (uint256)
|
|
49
|
-
{
|
|
44
|
+
function _deposit(
|
|
45
|
+
address tokenIn,
|
|
46
|
+
uint256 amountDeposited
|
|
47
|
+
) internal virtual override returns (uint256) {
|
|
50
48
|
uint256 amountLpDeposited;
|
|
51
49
|
if (tokenIn == pair) {
|
|
52
50
|
amountLpDeposited = amountDeposited;
|
|
@@ -103,11 +101,15 @@ contract PendleCamelotV1VolatileSY is
|
|
|
103
101
|
|
|
104
102
|
/// @notice allows anyone to add new rewardTokens to this SY if a new rewardToken is added to the Nitro pool
|
|
105
103
|
function updateRewardTokensList() public virtual {
|
|
104
|
+
if (nitroPool == address(0)) return; // if nitroPool is not set, we don't need to update rewardTokens list
|
|
105
|
+
|
|
106
106
|
address token1 = ICamelotNitroPool(nitroPool).rewardsToken1().token;
|
|
107
107
|
address token2 = ICamelotNitroPool(nitroPool).rewardsToken2().token;
|
|
108
108
|
|
|
109
|
-
if (token1 != address(0) && !rewardTokens.contains(token1))
|
|
110
|
-
|
|
109
|
+
if (token1 != address(0) && token1 != xGRAIL && !rewardTokens.contains(token1))
|
|
110
|
+
rewardTokens.push(token1);
|
|
111
|
+
if (token2 != address(0) && token2 != xGRAIL && !rewardTokens.contains(token2))
|
|
112
|
+
rewardTokens.push(token2);
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
function _redeemExternalReward() internal override {
|
|
@@ -115,7 +117,9 @@ contract PendleCamelotV1VolatileSY is
|
|
|
115
117
|
return;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
if (nitroPool != address(0)) {
|
|
121
|
+
ICamelotNitroPool(nitroPool).harvest();
|
|
122
|
+
}
|
|
119
123
|
ICamelotNFTPool(nftPool).harvestPosition(positionId);
|
|
120
124
|
_allocateXGrail();
|
|
121
125
|
}
|
|
@@ -124,12 +128,10 @@ contract PendleCamelotV1VolatileSY is
|
|
|
124
128
|
PREVIEW-RELATED
|
|
125
129
|
//////////////////////////////////////////////////////////////*/
|
|
126
130
|
|
|
127
|
-
function _previewDeposit(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
returns (uint256)
|
|
132
|
-
{
|
|
131
|
+
function _previewDeposit(
|
|
132
|
+
address tokenIn,
|
|
133
|
+
uint256 amountTokenToDeposit
|
|
134
|
+
) internal view override returns (uint256) {
|
|
133
135
|
if (tokenIn == pair) {
|
|
134
136
|
return amountTokenToDeposit;
|
|
135
137
|
} else {
|
|
@@ -137,12 +139,10 @@ contract PendleCamelotV1VolatileSY is
|
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
function _previewRedeem(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
returns (uint256)
|
|
145
|
-
{
|
|
142
|
+
function _previewRedeem(
|
|
143
|
+
address tokenOut,
|
|
144
|
+
uint256 amountSharesToRedeem
|
|
145
|
+
) internal view override returns (uint256) {
|
|
146
146
|
if (tokenOut == pair) {
|
|
147
147
|
return amountSharesToRedeem;
|
|
148
148
|
} else {
|
|
@@ -186,11 +186,7 @@ contract PendleCamelotV1VolatileSY is
|
|
|
186
186
|
function assetInfo()
|
|
187
187
|
external
|
|
188
188
|
view
|
|
189
|
-
returns (
|
|
190
|
-
AssetType assetType,
|
|
191
|
-
address assetAddress,
|
|
192
|
-
uint8 assetDecimals
|
|
193
|
-
)
|
|
189
|
+
returns (AssetType assetType, address assetAddress, uint8 assetDecimals)
|
|
194
190
|
{
|
|
195
191
|
return (AssetType.LIQUIDITY, pair, IERC20Metadata(pair).decimals());
|
|
196
192
|
}
|
|
@@ -204,7 +200,9 @@ contract PendleCamelotV1VolatileSY is
|
|
|
204
200
|
if (doRewardIndexUpdate) _updateRewardIndex();
|
|
205
201
|
|
|
206
202
|
if (positionId != POSITION_UNINITIALIZED) {
|
|
207
|
-
|
|
203
|
+
if (nitroPool != address(0)) {
|
|
204
|
+
ICamelotNitroPool(nitroPool).emergencyWithdraw(positionId);
|
|
205
|
+
}
|
|
208
206
|
ICamelotNFTPool(nftPool).emergencyWithdraw(positionId);
|
|
209
207
|
positionId = POSITION_UNINITIALIZED;
|
|
210
208
|
}
|
|
@@ -212,8 +210,18 @@ contract PendleCamelotV1VolatileSY is
|
|
|
212
210
|
isRewardDisabled = true;
|
|
213
211
|
}
|
|
214
212
|
|
|
215
|
-
function
|
|
216
|
-
|
|
213
|
+
function setNewNitroPool(uint256 newPoolIndex) external onlyOwner {
|
|
214
|
+
assert(!isRewardDisabled);
|
|
215
|
+
|
|
216
|
+
_updateRewardIndex();
|
|
217
|
+
_withdrawFromNitroPool();
|
|
218
|
+
|
|
219
|
+
nitroPool = NITRO_POOL_FACTORY.getNitroPool(newPoolIndex);
|
|
220
|
+
require(ICamelotNitroPool(nitroPool).nftPool() == nftPool, "invalid nitro pool");
|
|
221
|
+
|
|
222
|
+
_depositToNitroPool();
|
|
223
|
+
|
|
224
|
+
updateRewardTokensList();
|
|
217
225
|
}
|
|
218
226
|
|
|
219
227
|
// XGRAIL related, to be used only when this SY is deprecated
|
|
@@ -16,4 +16,18 @@ interface ICamelotNFTPool is IERC721 {
|
|
|
16
16
|
function yieldBooster() external view returns (address);
|
|
17
17
|
|
|
18
18
|
function emergencyWithdraw(uint256 tokenId) external;
|
|
19
|
+
|
|
20
|
+
function getPoolInfo()
|
|
21
|
+
external
|
|
22
|
+
view
|
|
23
|
+
returns (
|
|
24
|
+
address lpToken,
|
|
25
|
+
address grailToken,
|
|
26
|
+
address xGrailToken,
|
|
27
|
+
uint256 lastRewardTime,
|
|
28
|
+
uint256 accRewardsPerShare,
|
|
29
|
+
uint256 lpSupply,
|
|
30
|
+
uint256 lpSupplyWithMultiplier,
|
|
31
|
+
uint256 allocPoint
|
|
32
|
+
);
|
|
19
33
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
interface ICamelotNitroPoolFactory {
|
|
5
|
+
event CreateNitroPool(address nitroAddress);
|
|
6
|
+
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
7
|
+
event PublishNitroPool(address nitroAddress);
|
|
8
|
+
event SetDefaultFee(uint256 fee);
|
|
9
|
+
event SetEmergencyRecoveryAddress(address emergencyRecoveryAddress);
|
|
10
|
+
event SetExemptedAddress(address exemptedAddress, bool isExempted);
|
|
11
|
+
event SetFeeAddress(address feeAddress);
|
|
12
|
+
event SetNitroPoolOwner(address previousOwner, address newOwner);
|
|
13
|
+
|
|
14
|
+
struct Settings {
|
|
15
|
+
uint256 startTime;
|
|
16
|
+
uint256 endTime;
|
|
17
|
+
uint256 harvestStartTime;
|
|
18
|
+
uint256 depositEndTime;
|
|
19
|
+
uint256 lockDurationReq;
|
|
20
|
+
uint256 lockEndReq;
|
|
21
|
+
uint256 depositAmountReq;
|
|
22
|
+
bool whitelist;
|
|
23
|
+
string description;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function MAX_DEFAULT_FEE() external view returns (uint256);
|
|
27
|
+
|
|
28
|
+
function createNitroPool(
|
|
29
|
+
address nftPoolAddress,
|
|
30
|
+
address rewardsToken1,
|
|
31
|
+
address rewardsToken2,
|
|
32
|
+
Settings memory settings
|
|
33
|
+
) external returns (address nitroPool);
|
|
34
|
+
|
|
35
|
+
function defaultFee() external view returns (uint256);
|
|
36
|
+
|
|
37
|
+
function emergencyRecoveryAddress() external view returns (address);
|
|
38
|
+
|
|
39
|
+
function exemptedAddressesLength() external view returns (uint256);
|
|
40
|
+
|
|
41
|
+
function feeAddress() external view returns (address);
|
|
42
|
+
|
|
43
|
+
function getExemptedAddress(uint256 index) external view returns (address);
|
|
44
|
+
|
|
45
|
+
function getNftPoolPublishedNitroPool(address nftPoolAddress, uint256 index)
|
|
46
|
+
external
|
|
47
|
+
view
|
|
48
|
+
returns (address);
|
|
49
|
+
|
|
50
|
+
function getNitroPool(uint256 index) external view returns (address);
|
|
51
|
+
|
|
52
|
+
function getNitroPoolFee(address nitroPoolAddress, address ownerAddress)
|
|
53
|
+
external
|
|
54
|
+
view
|
|
55
|
+
returns (uint256);
|
|
56
|
+
|
|
57
|
+
function getOwnerNitroPool(address userAddress, uint256 index) external view returns (address);
|
|
58
|
+
|
|
59
|
+
function getPublishedNitroPool(uint256 index) external view returns (address);
|
|
60
|
+
|
|
61
|
+
function grailToken() external view returns (address);
|
|
62
|
+
|
|
63
|
+
function isExemptedAddress(address checkedAddress) external view returns (bool);
|
|
64
|
+
|
|
65
|
+
function nftPoolPublishedNitroPoolsLength(address nftPoolAddress)
|
|
66
|
+
external
|
|
67
|
+
view
|
|
68
|
+
returns (uint256);
|
|
69
|
+
|
|
70
|
+
function nitroPoolsLength() external view returns (uint256);
|
|
71
|
+
|
|
72
|
+
function owner() external view returns (address);
|
|
73
|
+
|
|
74
|
+
function ownerNitroPoolsLength(address userAddress) external view returns (uint256);
|
|
75
|
+
|
|
76
|
+
function publishNitroPool(address nftAddress) external;
|
|
77
|
+
|
|
78
|
+
function publishedNitroPoolsLength() external view returns (uint256);
|
|
79
|
+
|
|
80
|
+
function renounceOwnership() external;
|
|
81
|
+
|
|
82
|
+
function setDefaultFee(uint256 newFee) external;
|
|
83
|
+
|
|
84
|
+
function setEmergencyRecoveryAddress(address emergencyRecoveryAddress_) external;
|
|
85
|
+
|
|
86
|
+
function setExemptedAddress(address exemptedAddress, bool isExempted) external;
|
|
87
|
+
|
|
88
|
+
function setFeeAddress(address feeAddress_) external;
|
|
89
|
+
|
|
90
|
+
function setNitroPoolOwner(address previousOwner, address newOwner) external;
|
|
91
|
+
|
|
92
|
+
function transferOwnership(address newOwner) external;
|
|
93
|
+
|
|
94
|
+
function xGrailToken() external view returns (address);
|
|
95
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY ARB-ETH_Camelot",
|
|
3
|
+
"SY": "0x318EEC91f653cA72fAFB038f9AD792A6bC0d644C",
|
|
4
|
+
"YT": "0x69ddf9Ce5568EfA913f1eA601Ed298ccfeBfC811",
|
|
5
|
+
"PT": "0xa3BeDB2885Bf23E9b8f72e38Bbd9fdDD1b50E1d6",
|
|
6
|
+
"market": "0x3803D89c31dE8B7DEf55C86f2469A5ea4Db41B92",
|
|
7
|
+
"expiry": 1719446400
|
|
8
|
+
}
|
package/package.json
CHANGED