@pendle/core-v2 0.8.0-beta-10 → 0.8.0-beta-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenHelper.sol/PendleQiTokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultScy.sol/PendleYearnVaultSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchain.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechain.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20.sol/PendleERC20.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleERC20Permit.sol/PendleERC20Permit.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.json +2 -2
- 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 +486 -2
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionYT.sol/ActionYT.json +2 -2
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPTBase.sol/ActionSCYAndPTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndPYBase.sol/ActionSCYAndPYBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/ActionSCYAndYTBase.sol/ActionSCYAndYTBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/base/CallbackHelper.sol/CallbackHelper.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAToken.sol/IAToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAavePool.sol/IAavePool.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IAaveRewardsController.sol/IAaveRewardsController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiComptroller.sol/IBenQiComptroller.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IBenQiInterestRateModel.sol/IBenQiInterestRateModel.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageBus.sol/ICelerMessageBus.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ICelerMessageReceiverApp.sol/ICelerMessageReceiverApp.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoePair.sol/IJoePair.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter01.sol/IJoeRouter01.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IJoeRouter02.sol/IJoeRouter02.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionCore.sol/IPActionCore.json +484 -0
- package/build/artifacts/contracts/interfaces/IPActionYT.sol/IPActionYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.json +484 -0
- package/build/artifacts/contracts/interfaces/IPGaugeController.sol/IPGaugeController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGaugeControllerMainchain.sol/IPGaugeControllerMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPGovernanceManager.sol/IPGovernanceManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPInterestManagerYT.sol/IPInterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketFactory.sol/IPMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarketSwapCallback.sol/IPMarketSwapCallback.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPermissionsV2Upg.sol/IPermissionsV2Upg.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPPrincipalToken.sol/IPPrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.json +5 -0
- package/build/artifacts/contracts/interfaces/IPVeToken.sol/IPVeToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldContractFactory.sol/IPYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPYieldToken.sol/IPYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiAvax.sol/IQiAvax.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiErc20.sol/IQiErc20.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IQiToken.sol/IQiToken.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IRewardManager.sol/IRewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWETH.sol/IWETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IWstETH.sol/IWstETH.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IYearnVault.sol/IYearnVault.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYIndex.sol/SCYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/SCY/SCYUtils.sol/SCYUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ArrayLib.sol/ArrayLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/ExpiryUtilsLib.sol/ExpiryUtils.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/MiniHelpers.sol/MiniHelpers.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/TokenHelper.sol/TokenHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/LogExpMath.sol/LogExpMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/JoeLibrary.sol/JoeLibrary.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/traderjoe/PendleJoeSwapHelperUpg.sol/PendleJoeSwapHelperUpg.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +161 -2
- package/build/artifacts/contracts/periphery/PermissionsV2Upg.sol/PermissionsV2Upg.dbg.json +1 -1
- package/contracts/core/PendleRouter.sol +8 -0
- package/contracts/core/YieldContracts/PendleYieldToken.sol +13 -5
- package/contracts/core/actions/ActionCore.sol +80 -0
- package/contracts/core/actions/base/ActionSCYAndPYBase.sol +36 -0
- package/contracts/interfaces/IPActionCore.sol +78 -0
- package/contracts/interfaces/IPRouterStatic.sol +2 -1
- package/contracts/offchain-helpers/RouterStatic.sol +47 -1
- package/deployments/43113-core.json +1 -1
- package/deployments/80001-core.json +1 -1
- package/package.json +1 -1
- package/typechain-types/ActionCore.ts +489 -0
- package/typechain-types/IPActionCore.ts +489 -0
- package/typechain-types/IPAllAction.ts +489 -0
- package/typechain-types/IPRouterStatic.ts +6 -3
- package/typechain-types/IStargateLPStaking.ts +143 -0
- package/typechain-types/IStargatePool.ts +129 -0
- package/typechain-types/IStargateRouter.ts +159 -0
- package/typechain-types/PendleStargatePool.ts +1089 -0
- package/typechain-types/RouterStatic.ts +250 -3
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionCore__factory.ts +485 -1
- package/typechain-types/factories/ActionYT__factory.ts +1 -1
- package/typechain-types/factories/IPActionCore__factory.ts +484 -0
- package/typechain-types/factories/IPAllAction__factory.ts +484 -0
- package/typechain-types/factories/IPRouterStatic__factory.ts +5 -0
- package/typechain-types/factories/IStargateLPStaking__factory.ts +62 -0
- package/typechain-types/factories/IStargatePool__factory.ts +68 -0
- package/typechain-types/factories/IStargateRouter__factory.ts +78 -0
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/PendleStargatePool__factory.ts +929 -0
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleYieldToken__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +160 -1
- package/typechain-types/hardhat.d.ts +36 -0
- package/typechain-types/index.ts +8 -0
|
@@ -335,20 +335,21 @@ contract PendleYieldToken is
|
|
|
335
335
|
// hence, we can save users one _redeemExternal here
|
|
336
336
|
for (uint256 i = 0; i < tokens.length; i++)
|
|
337
337
|
postExpiry.userRewardOwed[tokens[i]] -= userReward[tokens[i]][user].accrued;
|
|
338
|
-
rewardAmounts = __doTransferOutRewardsLocal(tokens, user, receiver);
|
|
338
|
+
rewardAmounts = __doTransferOutRewardsLocal(tokens, user, receiver, false);
|
|
339
339
|
} else {
|
|
340
|
-
|
|
341
|
-
rewardAmounts = __doTransferOutRewardsLocal(tokens, user, receiver);
|
|
340
|
+
rewardAmounts = __doTransferOutRewardsLocal(tokens, user, receiver, true);
|
|
342
341
|
}
|
|
343
342
|
}
|
|
344
343
|
|
|
345
344
|
function __doTransferOutRewardsLocal(
|
|
346
345
|
address[] memory tokens,
|
|
347
346
|
address user,
|
|
348
|
-
address receiver
|
|
347
|
+
address receiver,
|
|
348
|
+
bool allowedToRedeemExternalReward
|
|
349
349
|
) internal returns (uint256[] memory rewardAmounts) {
|
|
350
350
|
address treasury = IPYieldContractFactory(factory).treasury();
|
|
351
351
|
uint256 feeRate = IPYieldContractFactory(factory).rewardFeeRate();
|
|
352
|
+
bool redeemExternalThisRound;
|
|
352
353
|
|
|
353
354
|
rewardAmounts = new uint256[](tokens.length);
|
|
354
355
|
for (uint256 i = 0; i < tokens.length; i++) {
|
|
@@ -358,6 +359,13 @@ contract PendleYieldToken is
|
|
|
358
359
|
uint256 feeAmount = rewardPreFee.mulDown(feeRate);
|
|
359
360
|
rewardAmounts[i] = rewardPreFee - feeAmount;
|
|
360
361
|
|
|
362
|
+
if (!redeemExternalThisRound && allowedToRedeemExternalReward) {
|
|
363
|
+
if (_selfBalance(tokens[i]) < rewardPreFee) {
|
|
364
|
+
_redeemExternalReward();
|
|
365
|
+
redeemExternalThisRound = true;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
361
369
|
_transferOut(tokens[i], treasury, feeAmount);
|
|
362
370
|
_transferOut(tokens[i], receiver, rewardAmounts[i]);
|
|
363
371
|
}
|
|
@@ -395,7 +403,7 @@ contract PendleYieldToken is
|
|
|
395
403
|
address to,
|
|
396
404
|
uint256
|
|
397
405
|
) internal override {
|
|
398
|
-
_setPostExpiryData();
|
|
406
|
+
if (isExpired()) _setPostExpiryData();
|
|
399
407
|
_updateAndDistributeRewardsForTwo(from, to);
|
|
400
408
|
_distributeInterestForTwo(from, to);
|
|
401
409
|
}
|
|
@@ -43,6 +43,37 @@ contract ActionCore is IPActionCore, ActionSCYAndPTBase {
|
|
|
43
43
|
emit AddLiquidity(msg.sender, market, receiver, scyUsed, ptUsed, netLpOut);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
function addLiquiditySinglePt(
|
|
47
|
+
address receiver,
|
|
48
|
+
address market,
|
|
49
|
+
uint256 netPtIn,
|
|
50
|
+
uint256 minLpOut,
|
|
51
|
+
ApproxParams memory guessPtSwapToScy
|
|
52
|
+
) external returns (uint256 netLpOut) {
|
|
53
|
+
require(false, "NOT IMPLEMENTED");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function addLiquiditySingleScy(
|
|
57
|
+
address receiver,
|
|
58
|
+
address market,
|
|
59
|
+
uint256 netScyIn,
|
|
60
|
+
uint256 minLpOut,
|
|
61
|
+
ApproxParams memory guessPtReceivedFromScy
|
|
62
|
+
) external returns (uint256 netLpOut) {
|
|
63
|
+
require(false, "NOT IMPLEMENTED");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function addLiquiditySingleRawToken(
|
|
67
|
+
address receiver,
|
|
68
|
+
address market,
|
|
69
|
+
uint256 netRawTokenIn,
|
|
70
|
+
uint256 minLpOut,
|
|
71
|
+
address[] calldata path,
|
|
72
|
+
ApproxParams memory guessPtReceivedFromScy
|
|
73
|
+
) external returns (uint256 netLpOut) {
|
|
74
|
+
require(false, "NOT IMPLEMENTED");
|
|
75
|
+
}
|
|
76
|
+
|
|
46
77
|
/// @dev refer to the internal function
|
|
47
78
|
function removeLiquidity(
|
|
48
79
|
address receiver,
|
|
@@ -62,6 +93,35 @@ contract ActionCore is IPActionCore, ActionSCYAndPTBase {
|
|
|
62
93
|
emit RemoveLiquidity(msg.sender, market, receiver, lpToRemove, netPtOut, netScyOut);
|
|
63
94
|
}
|
|
64
95
|
|
|
96
|
+
function removeLiquiditySinglePt(
|
|
97
|
+
address receiver,
|
|
98
|
+
address market,
|
|
99
|
+
uint256 lpToRemove,
|
|
100
|
+
uint256 minPtOut,
|
|
101
|
+
ApproxParams memory guessPtOut
|
|
102
|
+
) external returns (uint256 netPtOut) {
|
|
103
|
+
require(false, "NOT IMPLEMENTED");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function removeLiquiditySingleScy(
|
|
107
|
+
address receiver,
|
|
108
|
+
address market,
|
|
109
|
+
uint256 lpToRemove,
|
|
110
|
+
uint256 minScyOut
|
|
111
|
+
) external returns (uint256 netScyOut) {
|
|
112
|
+
require(false, "NOT IMPLEMENTED");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function removeLiquiditySingleRawToken(
|
|
116
|
+
address receiver,
|
|
117
|
+
address market,
|
|
118
|
+
uint256 lpToRemove,
|
|
119
|
+
uint256 minRawTokenOut,
|
|
120
|
+
address[] memory path
|
|
121
|
+
) external returns (uint256 netRawTokenOut) {
|
|
122
|
+
require(false, "NOT IMPLEMENTED");
|
|
123
|
+
}
|
|
124
|
+
|
|
65
125
|
/// @dev refer to the internal function
|
|
66
126
|
function swapExactPtForScy(
|
|
67
127
|
address receiver,
|
|
@@ -169,6 +229,26 @@ contract ActionCore is IPActionCore, ActionSCYAndPTBase {
|
|
|
169
229
|
);
|
|
170
230
|
}
|
|
171
231
|
|
|
232
|
+
function mintPyFromScy(
|
|
233
|
+
address receiver,
|
|
234
|
+
address YT,
|
|
235
|
+
uint256 netScyIn,
|
|
236
|
+
uint256 minPyOut
|
|
237
|
+
) external returns (uint256 netPyOut) {
|
|
238
|
+
netPyOut = _mintPyFromScy(receiver, YT, netScyIn, minPyOut, true);
|
|
239
|
+
emit MintPyFromScy(msg.sender, receiver, YT, netScyIn, netPyOut);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function redeemPyToScy(
|
|
243
|
+
address receiver,
|
|
244
|
+
address YT,
|
|
245
|
+
uint256 netPyIn,
|
|
246
|
+
uint256 minScyOut
|
|
247
|
+
) external returns (uint256 netScyOut) {
|
|
248
|
+
netScyOut = _redeemPyToScy(receiver, YT, netPyIn, minScyOut, true);
|
|
249
|
+
emit RedeemPyToScy(msg.sender, receiver, YT, netPyIn, netScyOut);
|
|
250
|
+
}
|
|
251
|
+
|
|
172
252
|
/// @dev refer to the internal function
|
|
173
253
|
function swapExactRawTokenForPt(
|
|
174
254
|
address receiver,
|
|
@@ -129,4 +129,40 @@ abstract contract ActionSCYAndPYBase is PendleJoeSwapHelperUpg, TokenHelper {
|
|
|
129
129
|
|
|
130
130
|
netRawTokenOut = _redeemScyToRawToken(receiver, SCY, 0, minRawTokenOut, path, false);
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
function _mintPyFromScy(
|
|
134
|
+
address receiver,
|
|
135
|
+
address YT,
|
|
136
|
+
uint256 netScyIn,
|
|
137
|
+
uint256 minPyOut,
|
|
138
|
+
bool doPull
|
|
139
|
+
) internal returns (uint256 netPyOut) {
|
|
140
|
+
address SCY = IPYieldToken(YT).SCY();
|
|
141
|
+
|
|
142
|
+
if (doPull) {
|
|
143
|
+
IERC20(SCY).safeTransferFrom(msg.sender, YT, netScyIn);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
netPyOut = IPYieldToken(YT).mintPY(receiver, receiver);
|
|
147
|
+
require(netPyOut >= minPyOut, "insufficient PY out");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function _redeemPyToScy(
|
|
151
|
+
address receiver,
|
|
152
|
+
address YT,
|
|
153
|
+
uint256 netPyIn,
|
|
154
|
+
uint256 minScyOut,
|
|
155
|
+
bool doPull
|
|
156
|
+
) internal returns (uint256 netScyOut) {
|
|
157
|
+
address PT = IPYieldToken(YT).PT();
|
|
158
|
+
|
|
159
|
+
if (doPull) {
|
|
160
|
+
bool needToBurnYt = (!IPYieldToken(YT).isExpired());
|
|
161
|
+
IERC20(PT).safeTransferFrom(msg.sender, YT, netPyIn);
|
|
162
|
+
if (needToBurnYt) IERC20(YT).safeTransferFrom(msg.sender, YT, netPyIn);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
netScyOut = IPYieldToken(YT).redeemPY(receiver);
|
|
166
|
+
require(netScyOut >= minScyOut, "insufficient SCY out");
|
|
167
|
+
}
|
|
132
168
|
}
|
|
@@ -57,6 +57,22 @@ interface IPActionCore {
|
|
|
57
57
|
uint256 netRawTokenOut
|
|
58
58
|
);
|
|
59
59
|
|
|
60
|
+
event MintPyFromScy(
|
|
61
|
+
address indexed caller,
|
|
62
|
+
address indexed receiver,
|
|
63
|
+
address indexed YT,
|
|
64
|
+
uint256 netScyIn,
|
|
65
|
+
uint256 netPyOut
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
event RedeemPyToScy(
|
|
69
|
+
address indexed caller,
|
|
70
|
+
address indexed receiver,
|
|
71
|
+
address indexed YT,
|
|
72
|
+
uint256 netPyIn,
|
|
73
|
+
uint256 netScyOut
|
|
74
|
+
);
|
|
75
|
+
|
|
60
76
|
event MintPyFromRawToken(
|
|
61
77
|
address indexed caller,
|
|
62
78
|
address indexed receiver,
|
|
@@ -89,6 +105,31 @@ interface IPActionCore {
|
|
|
89
105
|
uint256 ptUsed
|
|
90
106
|
);
|
|
91
107
|
|
|
108
|
+
function addLiquiditySinglePt(
|
|
109
|
+
address receiver,
|
|
110
|
+
address market,
|
|
111
|
+
uint256 netPtIn,
|
|
112
|
+
uint256 minLpOut,
|
|
113
|
+
ApproxParams memory guessPtSwapToScy
|
|
114
|
+
) external returns (uint256 netLpOut);
|
|
115
|
+
|
|
116
|
+
function addLiquiditySingleScy(
|
|
117
|
+
address receiver,
|
|
118
|
+
address market,
|
|
119
|
+
uint256 netScyIn,
|
|
120
|
+
uint256 minLpOut,
|
|
121
|
+
ApproxParams memory guessPtReceivedFromScy
|
|
122
|
+
) external returns (uint256 netLpOut);
|
|
123
|
+
|
|
124
|
+
function addLiquiditySingleRawToken(
|
|
125
|
+
address receiver,
|
|
126
|
+
address market,
|
|
127
|
+
uint256 netRawTokenIn,
|
|
128
|
+
uint256 minLpOut,
|
|
129
|
+
address[] calldata path,
|
|
130
|
+
ApproxParams memory guessPtReceivedFromScy
|
|
131
|
+
) external returns (uint256 netLpOut);
|
|
132
|
+
|
|
92
133
|
function removeLiquidity(
|
|
93
134
|
address receiver,
|
|
94
135
|
address market,
|
|
@@ -97,6 +138,29 @@ interface IPActionCore {
|
|
|
97
138
|
uint256 ptOutMin
|
|
98
139
|
) external returns (uint256 netScyOut, uint256 netPtOut);
|
|
99
140
|
|
|
141
|
+
function removeLiquiditySinglePt(
|
|
142
|
+
address receiver,
|
|
143
|
+
address market,
|
|
144
|
+
uint256 lpToRemove,
|
|
145
|
+
uint256 minPtOut,
|
|
146
|
+
ApproxParams memory guessPtOut
|
|
147
|
+
) external returns (uint256 netPtOut);
|
|
148
|
+
|
|
149
|
+
function removeLiquiditySingleScy(
|
|
150
|
+
address receiver,
|
|
151
|
+
address market,
|
|
152
|
+
uint256 lpToRemove,
|
|
153
|
+
uint256 minScyOut
|
|
154
|
+
) external returns (uint256 netScyOut);
|
|
155
|
+
|
|
156
|
+
function removeLiquiditySingleRawToken(
|
|
157
|
+
address receiver,
|
|
158
|
+
address market,
|
|
159
|
+
uint256 lpToRemove,
|
|
160
|
+
uint256 minRawTokenOut,
|
|
161
|
+
address[] memory path
|
|
162
|
+
) external returns (uint256 netRawTokenOut);
|
|
163
|
+
|
|
100
164
|
function swapExactPtForScy(
|
|
101
165
|
address receiver,
|
|
102
166
|
address market,
|
|
@@ -159,6 +223,20 @@ interface IPActionCore {
|
|
|
159
223
|
address[] memory path
|
|
160
224
|
) external returns (uint256 netRawTokenOut);
|
|
161
225
|
|
|
226
|
+
function mintPyFromScy(
|
|
227
|
+
address receiver,
|
|
228
|
+
address YT,
|
|
229
|
+
uint256 netScyIn,
|
|
230
|
+
uint256 minPyOut
|
|
231
|
+
) external returns (uint256 netPyOut);
|
|
232
|
+
|
|
233
|
+
function redeemPyToScy(
|
|
234
|
+
address receiver,
|
|
235
|
+
address YT,
|
|
236
|
+
uint256 netPyIn,
|
|
237
|
+
uint256 minScyOut
|
|
238
|
+
) external returns (uint256 netScyOut);
|
|
239
|
+
|
|
162
240
|
function swapExactRawTokenForPt(
|
|
163
241
|
address receiver,
|
|
164
242
|
address market,
|
|
@@ -83,7 +83,8 @@ contract RouterStatic is IPRouterStatic {
|
|
|
83
83
|
address pt,
|
|
84
84
|
address scy,
|
|
85
85
|
MarketState memory state,
|
|
86
|
-
int256 impliedYield
|
|
86
|
+
int256 impliedYield,
|
|
87
|
+
uint256 exchangeRate
|
|
87
88
|
)
|
|
88
89
|
{
|
|
89
90
|
IPMarket _market = IPMarket(market);
|
|
@@ -93,6 +94,7 @@ contract RouterStatic is IPRouterStatic {
|
|
|
93
94
|
scy = address(SCY);
|
|
94
95
|
state = _market.readState(true);
|
|
95
96
|
impliedYield = getPtImpliedYield(market);
|
|
97
|
+
exchangeRate = getExchangeRate(market);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
// ============= USER INFO =============
|
|
@@ -159,6 +161,28 @@ contract RouterStatic is IPRouterStatic {
|
|
|
159
161
|
);
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
function addLiquiditySinglePtStatic(address market, uint256 netPtIn)
|
|
165
|
+
external
|
|
166
|
+
returns (uint256 netLpOut)
|
|
167
|
+
{
|
|
168
|
+
require(false, "NOT IMPLEMENTED");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function addLiquiditySingleScy(address market, uint256 netScyIn)
|
|
172
|
+
external
|
|
173
|
+
returns (uint256 netLpOut)
|
|
174
|
+
{
|
|
175
|
+
require(false, "NOT IMPLEMENTED");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function addLiquiditySingleBaseToken(
|
|
179
|
+
address market,
|
|
180
|
+
address baseToken,
|
|
181
|
+
uint256 netBaseTokenIn
|
|
182
|
+
) external returns (uint256 netLpOut) {
|
|
183
|
+
require(false, "NOT IMPLEMENTED");
|
|
184
|
+
}
|
|
185
|
+
|
|
162
186
|
function removeLiquidityStatic(address market, uint256 lpToRemove)
|
|
163
187
|
external
|
|
164
188
|
view
|
|
@@ -168,6 +192,28 @@ contract RouterStatic is IPRouterStatic {
|
|
|
168
192
|
(netScyOut, netPtOut) = state.removeLiquidity(lpToRemove);
|
|
169
193
|
}
|
|
170
194
|
|
|
195
|
+
function removeLiquiditySinglePtStatic(address market, uint256 lpToRemove)
|
|
196
|
+
external
|
|
197
|
+
returns (uint256 netPtOut)
|
|
198
|
+
{
|
|
199
|
+
require(false, "NOT IMPLEMENTED");
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function removeLiquiditySingleScy(address market, uint256 lpToRemove)
|
|
203
|
+
external
|
|
204
|
+
returns (uint256 netScyOut)
|
|
205
|
+
{
|
|
206
|
+
require(false, "NOT IMPLEMENTED");
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function removeLiquiditySingleBaseToken(
|
|
210
|
+
address market,
|
|
211
|
+
uint256 lpToRemove,
|
|
212
|
+
address baseToken
|
|
213
|
+
) external returns (uint256 netBaseTokenOut) {
|
|
214
|
+
require(false, "NOT IMPLEMENTED");
|
|
215
|
+
}
|
|
216
|
+
|
|
171
217
|
function swapExactPtForScyStatic(address market, uint256 exactPtIn)
|
|
172
218
|
public
|
|
173
219
|
view
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"yieldContractFactory": "0x2B233F133f3DA67698453F4A251BAF8BAc1E584d",
|
|
9
9
|
"marketFactory": "0xE3a730f28EAe40309A9868Fb5b66B5BaaF531204",
|
|
10
10
|
"router": "0xFEdBED4682D136925d30FFb9B8977CC9b3a6c406",
|
|
11
|
-
"routerStatic": "
|
|
11
|
+
"routerStatic": "0x1436Cb03C753bB9fAc7fcfE5627d08F143D6d8ed",
|
|
12
12
|
"startTime": 1657756800,
|
|
13
13
|
"vePendle": "0xD05B49500F35d879F3Bf220c81BE3ff9d73Ca205",
|
|
14
14
|
"votingController": "0x449f676be160C5C682E1E64934f29641D6096116",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"yieldContractFactory": "0xa8E22cc2E74dACb43E73cFa89172bfa30eFA0A56",
|
|
9
9
|
"marketFactory": "0x5539C4BCcff8d5881eCb1B95D2f6E7Eb47f0f801",
|
|
10
10
|
"router": "0x24d7CEaFBA7c7b32BE200aD6dA38C03797F0611f",
|
|
11
|
-
"routerStatic": "
|
|
11
|
+
"routerStatic": "0xf68aD0dF5E6034A934bE0e3E8b23Ab77f9778315",
|
|
12
12
|
"startTime": 1657756800,
|
|
13
13
|
"vePendle": "0x35d294d0922838b0899Cbf4C35f4945B2b3D20f1",
|
|
14
14
|
"gaugeController": "0x36e65521b2a1AEBA9a009226e75125cEcf00702f"
|
package/package.json
CHANGED