@pendle/core-v2 4.5.1 → 4.6.0
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/core/StandardizedYield/implementations/Ethena/PendleSUSDESY.sol/PendleSUSDESY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ethena/PendleSUSDESY.sol/PendleSUSDESY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultERC20SY.sol/PendleKarakVaultERC20SY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultERC20SY.sol/PendleKarakVaultERC20SY.json +1070 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultEzETHSY.sol/PendleKarakVaultEzETHSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultEzETHSY.sol/PendleKarakVaultEzETHSY.json +1144 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultSUSDESY.sol/PendleKarakVaultSUSDESY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultSUSDESY.sol/PendleKarakVaultSUSDESY.json +1111 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultSYBaseUpg.sol/PendleKarakVaultSYBaseUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultSYBaseUpg.sol/PendleKarakVaultSYBaseUpg.json +1036 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultUSDESY.sol/PendleKarakVaultUSDESY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultUSDESY.sol/PendleKarakVaultUSDESY.json +1096 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultWEETHSY.sol/PendleKarakVaultWEETHSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultWEETHSY.sol/PendleKarakVaultWEETHSY.json +1116 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC20WithSupplyCapSY.sol/PendleERC20WithSupplyCapSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC4626SY.sol/PendleERC4626SY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC4626SY.sol/PendleERC4626SY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC4626UpgSY.sol/PendleERC4626SYUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC4626UpgSY.sol/PendleERC4626SYUpg.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleGdaiSY.sol/PendleGDaiSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleSfrxEthSY.sol/PendleSfrxEthSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PirexETH/PendleApxETHSY.sol/PendleApxETHSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PirexETH/PendleApxETHSY.sol/PendleApxETHSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Puffer/PendlePufStETHSY.sol/PendlePufStETHSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Puffer/PendlePufStETHSY.sol/PendlePufStETHSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Puffer/PendlePufWETHSY.sol/PendlePufWETHSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Puffer/PendlePufWETHSY.sol/PendlePufWETHSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwellRswETHStakingSY.sol/PendleSwellRswETHStakingSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwellRswETHStakingSY.sol/PendleSwellRswETHStakingSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwellStakingERC20SY.sol/PendleSwellStakingERC20SY.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IERC4626.sol/IERC4626.json +19 -0
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.json +1200 -34
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.json +1228 -62
- package/build/artifacts/contracts/interfaces/IPGovernanceProxy.sol/IPGovernanceProxy.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGovernanceProxy.sol/IPGovernanceProxy.json +60 -0
- package/build/artifacts/contracts/interfaces/IPPausingInterface.sol/IPPausingInterface.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPPausingInterface.sol/IPPausingInterface.json +25 -0
- package/build/artifacts/contracts/interfaces/IPPtLpOracle.sol/IPPtLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPReflector.sol/IPReflector.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPReflector.sol/IPReflector.json +30 -0
- package/build/artifacts/contracts/interfaces/IPTokenWithSupplyCap.sol/IPTokenWithSupplyCap.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPTokenWithSupplyCap.sol/IPTokenWithSupplyCap.json +37 -0
- package/build/artifacts/contracts/interfaces/Karak/IKarakVault.sol/IKarakVault.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Karak/IKarakVault.sol/IKarakVault.json +24 -0
- package/build/artifacts/contracts/interfaces/Karak/IKarakVaultSupervisor.sol/IKarakVaultSupervisor.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Karak/IKarakVaultSupervisor.sol/IKarakVaultSupervisor.json +76 -0
- package/build/artifacts/contracts/interfaces/Swell/ISwellSimpleStakingERC20.sol/ISwellSimpleStakingERC20.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleGovernanceProxy.sol/PendleGovernanceProxy.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/PendleGovernanceProxy.sol/PendleGovernanceProxy.json +401 -0
- package/build/artifacts/contracts/offchain-helpers/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.json +25 -2
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/IPossibleSupplyCapInterface.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/IPossibleSupplyCapInterface.json +63 -0
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/SupplyCapReader.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/SupplyCapReader.sol/SupplyCapReader.json +35 -0
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtLpOracle.sol/PendlePtLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/BoringLpGlpOracle.sol/BoringLpGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/BoringPtUsdChainlinkOracle.sol/BoringPtUsdChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.json +2 -2
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.json +1202 -36
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.json +2 -2
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.dbg.json +4 -0
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.json +34 -0
- package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
- package/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultERC20SY.sol +32 -0
- package/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultEzETHSY.sol +80 -0
- package/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultSUSDESY.sol +73 -0
- package/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultSYBaseUpg.sol +141 -0
- package/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultUSDESY.sol +18 -0
- package/contracts/core/StandardizedYield/implementations/Karak/PendleKarakVaultWEETHSY.sol +71 -0
- package/contracts/core/StandardizedYield/implementations/Swell/PendleSwellRswETHStakingSY.sol +0 -1
- package/contracts/interfaces/IERC4626.sol +2 -0
- package/contracts/interfaces/IPActionMiscV3.sol +99 -0
- package/contracts/interfaces/IPGovernanceProxy.sol +14 -0
- package/contracts/interfaces/IPPausingInterface.sol +8 -0
- package/contracts/interfaces/IPReflector.sol +6 -0
- package/contracts/interfaces/IPTokenWithSupplyCap.sol +9 -0
- package/contracts/interfaces/Karak/IKarakVault.sol +6 -0
- package/contracts/interfaces/Karak/IKarakVaultSupervisor.sol +8 -0
- package/contracts/offchain-helpers/PendleGovernanceProxy.sol +84 -0
- package/contracts/offchain-helpers/PendlePoolDeployHelper.sol +5 -0
- package/contracts/offchain-helpers/SupplyCapReader.sol +25 -0
- package/contracts/router/ActionMiscV3.sol +182 -34
- package/contracts/router/ActionSwapYTV3.sol +0 -85
- package/contracts/router/Reflector.sol +70 -0
- package/contracts/router/base/ActionBase.sol +90 -1
- package/deployments/1-core.json +10 -1
- package/deployments/1-markets/KARAK-SUSDE-MAINNET-SEP2024.json +14 -0
- package/deployments/1-markets/KARAK-USDE-MAINNET-SEP2024.json +14 -0
- package/deployments/1-markets/KARAK-WEETH-MAINNET-SEP2024.json +14 -0
- package/deployments/1-markets/PUFETH-MAINNET-SEP2024.json +11 -0
- package/deployments/1-markets/RSETH-MAINNET-SEP2024.json +11 -0
- package/deployments/1-markets/SUSDE-MAINNET-SEP2024.json +13 -0
- package/deployments/1-markets/UNIETH-MAINNET-SEP2024.json +13 -0
- package/deployments/1-offchain-helper.json +2 -1
- package/deployments/10-core.json +10 -1
- package/deployments/10-offchain-helper.json +2 -1
- package/deployments/42161-core.json +10 -1
- package/deployments/42161-markets/RSETH-ARBITRUM-SEP2024-NEW.json +11 -0
- package/deployments/42161-markets/RSETH-ARBITRUM-SEP2024.json +11 -0
- package/deployments/42161-offchain-helper.json +2 -1
- package/deployments/5000-core.json +10 -1
- package/deployments/5000-offchain-helper.json +2 -1
- package/deployments/56-core.json +10 -1
- package/deployments/56-offchain-helper.json +2 -1
- package/package.json +1 -1
- package/typechain-types/ActionMiscV3.ts +628 -16
- package/typechain-types/BoringPYUsdChainlinkAssetOracle.ts +244 -0
- package/typechain-types/BoringPYUsdChainlinkSYOracle.ts +243 -0
- package/typechain-types/IERC4626.ts +34 -0
- package/typechain-types/IKarakVault.ts +84 -0
- package/typechain-types/IKarakVaultSupervisor.ts +190 -0
- package/typechain-types/IPActionMiscV3.ts +628 -16
- package/typechain-types/IPAllActionV3.ts +535 -0
- package/typechain-types/IPGovernanceProxy.ts +142 -0
- package/typechain-types/IPPYLpOracle.ts +379 -0
- package/typechain-types/IPPausingInterface.ts +112 -0
- package/typechain-types/IPReflector.ts +95 -0
- package/typechain-types/IPTokenWithSupplyCap.ts +110 -0
- package/typechain-types/IPossibleSupplyCapInterface.ts +142 -0
- package/typechain-types/PendleGovernanceProxy.ts +603 -0
- package/typechain-types/PendleKarakVaultERC20SY.ts +1324 -0
- package/typechain-types/PendleKarakVaultEzETHSY.ts +1400 -0
- package/typechain-types/PendleKarakVaultSUSDESY.ts +1380 -0
- package/typechain-types/PendleKarakVaultSYBaseUpg.ts +1312 -0
- package/typechain-types/PendleKarakVaultUSDESY.ts +1366 -0
- package/typechain-types/PendleKarakVaultWEETHSY.ts +1370 -0
- package/typechain-types/PendlePYLpOracle.ts +612 -0
- package/typechain-types/PendlePoolDeployHelper.ts +44 -0
- package/typechain-types/Reflector.ts +95 -0
- package/typechain-types/SupplyCapReader.ts +105 -0
- package/typechain-types/factories/ActionAddRemoveLiqV3__factory.ts +1 -1
- package/typechain-types/factories/ActionMiscV3__factory.ts +1201 -35
- package/typechain-types/factories/ActionSwapPTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYTV3__factory.ts +1 -1
- package/typechain-types/factories/BoringPYUsdChainlinkAssetOracle__factory.ts +269 -0
- package/typechain-types/factories/BoringPYUsdChainlinkSYOracle__factory.ts +267 -0
- package/typechain-types/factories/IERC4626__factory.ts +19 -0
- package/typechain-types/factories/IKarakVaultSupervisor__factory.ts +95 -0
- package/typechain-types/factories/IKarakVault__factory.ts +36 -0
- package/typechain-types/factories/IPActionMiscV3__factory.ts +1200 -34
- package/typechain-types/factories/IPAllActionV3__factory.ts +1228 -62
- package/typechain-types/factories/IPGovernanceProxy__factory.ts +75 -0
- package/typechain-types/factories/IPPYLpOracle__factory.ts +214 -0
- package/typechain-types/factories/IPPausingInterface__factory.ts +40 -0
- package/typechain-types/factories/IPReflector__factory.ts +42 -0
- package/typechain-types/factories/IPTokenWithSupplyCap__factory.ts +56 -0
- package/typechain-types/factories/IPossibleSupplyCapInterface__factory.ts +82 -0
- package/typechain-types/factories/PendleApxETHSY__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SYUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleERC4626SY__factory.ts +1 -1
- package/typechain-types/factories/PendleGDaiSY__factory.ts +1 -1
- package/typechain-types/factories/PendleGovernanceProxy__factory.ts +458 -0
- package/typechain-types/factories/PendleKarakVaultERC20SY__factory.ts +1139 -0
- package/typechain-types/factories/PendleKarakVaultEzETHSY__factory.ts +1236 -0
- package/typechain-types/factories/PendleKarakVaultSUSDESY__factory.ts +1180 -0
- package/typechain-types/factories/PendleKarakVaultSYBaseUpg__factory.ts +1055 -0
- package/typechain-types/factories/PendleKarakVaultUSDESY__factory.ts +1165 -0
- package/typechain-types/factories/PendleKarakVaultWEETHSY__factory.ts +1189 -0
- package/typechain-types/factories/PendlePYLpOracle__factory.ts +487 -0
- package/typechain-types/factories/PendlePoolDeployHelper__factory.ts +24 -1
- package/typechain-types/factories/PendlePufStETHSY__factory.ts +1 -1
- package/typechain-types/factories/PendlePufWETHSY__factory.ts +1 -1
- package/typechain-types/factories/PendleSUSDESY__factory.ts +1 -1
- package/typechain-types/factories/PendleSfrxEthSY__factory.ts +1 -1
- package/typechain-types/factories/PendleSwellRswETHStakingSY__factory.ts +1 -1
- package/typechain-types/factories/Reflector__factory.ts +84 -0
- package/typechain-types/factories/SupplyCapReader__factory.ts +88 -0
- package/typechain-types/hardhat.d.ts +144 -0
- package/typechain-types/index.ts +32 -0
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.17;
|
|
|
3
3
|
|
|
4
4
|
import "./base/ActionBase.sol";
|
|
5
5
|
import "../interfaces/IPActionMiscV3.sol";
|
|
6
|
+
import "../interfaces/IPReflector.sol";
|
|
6
7
|
|
|
7
8
|
contract ActionMiscV3 is IPActionMiscV3, ActionBase {
|
|
8
9
|
function mintSyFromToken(
|
|
@@ -79,18 +80,16 @@ contract ActionMiscV3 is IPActionMiscV3, ActionBase {
|
|
|
79
80
|
address[] calldata yts,
|
|
80
81
|
address[] calldata markets
|
|
81
82
|
) external {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
83
|
+
for (uint256 i = 0; i < sys.length; ++i) {
|
|
84
|
+
IStandardizedYield(sys[i]).claimRewards(user);
|
|
85
|
+
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
for (uint256 i = 0; i < yts.length; ++i) {
|
|
88
|
+
IPYieldToken(yts[i]).redeemDueInterestAndRewards(user, true, true);
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
91
|
+
for (uint256 i = 0; i < markets.length; ++i) {
|
|
92
|
+
IPMarket(markets[i]).redeemRewards(user);
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
@@ -118,45 +117,194 @@ contract ActionMiscV3 is IPActionMiscV3, ActionBase {
|
|
|
118
117
|
netTokenOut = IStandardizedYield(SY).redeem(receiver, netSyInterm, tokenRedeemSy, minTokenOut, true);
|
|
119
118
|
}
|
|
120
119
|
|
|
120
|
+
/// @dev The interface might change in the future, check with Pendle team before use
|
|
121
|
+
function exitPreExpToToken(
|
|
122
|
+
address receiver,
|
|
123
|
+
address market,
|
|
124
|
+
uint256 netPtIn,
|
|
125
|
+
uint256 netYtIn,
|
|
126
|
+
uint256 netLpIn,
|
|
127
|
+
TokenOutput calldata output,
|
|
128
|
+
LimitOrderData calldata limit
|
|
129
|
+
) external returns (uint256 totalTokenOut, ExitPreExpReturnParams memory params) {
|
|
130
|
+
IStandardizedYield SY;
|
|
131
|
+
|
|
132
|
+
(SY, params) = _exitPreExpToSy(true, address(0), market, netPtIn, netYtIn, netLpIn, limit);
|
|
133
|
+
totalTokenOut = _redeemSyToToken(receiver, address(SY), params.totalSyOut, output, false);
|
|
134
|
+
|
|
135
|
+
emit ExitPreExpToToken(msg.sender, market, output.tokenOut, receiver, netLpIn, totalTokenOut, params);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// @dev The interface might change in the future, check with Pendle team before use
|
|
139
|
+
function exitPreExpToSy(
|
|
140
|
+
address receiver,
|
|
141
|
+
address market,
|
|
142
|
+
uint256 netPtIn,
|
|
143
|
+
uint256 netYtIn,
|
|
144
|
+
uint256 netLpIn,
|
|
145
|
+
uint256 minSyOut,
|
|
146
|
+
LimitOrderData calldata limit
|
|
147
|
+
) external returns (ExitPreExpReturnParams memory params) {
|
|
148
|
+
(, params) = _exitPreExpToSy(false, receiver, market, netPtIn, netYtIn, netLpIn, limit);
|
|
149
|
+
require(params.totalSyOut >= minSyOut, "Slippage: INSUFFICIENT_SY_OUT");
|
|
150
|
+
|
|
151
|
+
emit ExitPreExpToSy(msg.sender, market, receiver, netLpIn, params);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function _exitPreExpToSy(
|
|
155
|
+
bool setReceiverToSy,
|
|
156
|
+
address receiver,
|
|
157
|
+
address market,
|
|
158
|
+
uint256 netPtIn,
|
|
159
|
+
uint256 netYtIn,
|
|
160
|
+
uint256 netLpIn,
|
|
161
|
+
LimitOrderData calldata limit
|
|
162
|
+
) internal returns (IStandardizedYield SY, ExitPreExpReturnParams memory p) {
|
|
163
|
+
IPPrincipalToken PT;
|
|
164
|
+
IPYieldToken YT;
|
|
165
|
+
(SY, PT, YT) = IPMarket(market).readTokens();
|
|
166
|
+
|
|
167
|
+
if (setReceiverToSy) receiver = address(SY);
|
|
168
|
+
|
|
169
|
+
if (netLpIn > 0) {
|
|
170
|
+
_transferFrom(IERC20(market), msg.sender, market, netLpIn);
|
|
171
|
+
(p.netSyFromRemove, p.netPtFromRemove) = IPMarket(market).burn(receiver, address(this), netLpIn);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (netPtIn > 0) {
|
|
175
|
+
_transferIn(address(PT), msg.sender, netPtIn);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
p.netPyRedeem = PMath.min(p.netPtFromRemove + netPtIn, netYtIn);
|
|
179
|
+
|
|
180
|
+
if (p.netPyRedeem > 0) {
|
|
181
|
+
_transferOut(address(PT), address(YT), p.netPyRedeem);
|
|
182
|
+
_transferFrom(YT, msg.sender, address(YT), p.netPyRedeem);
|
|
183
|
+
p.netSyFromRedeem = IPYieldToken(YT).redeemPY(receiver);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
p.netPtSwap = p.netPtFromRemove + netPtIn - p.netPyRedeem;
|
|
187
|
+
p.netYtSwap = netYtIn - p.netPyRedeem;
|
|
188
|
+
|
|
189
|
+
if (p.netPtSwap > 0) {
|
|
190
|
+
address ptEntry = _entry_swapExactPtForSy(market, limit);
|
|
191
|
+
if (ptEntry != address(this)) _transferOut(address(PT), ptEntry, p.netPtSwap);
|
|
192
|
+
(p.netSyFromSwap, p.netSyFee) = _swapExactPtForSy(receiver, market, p.netPtSwap, 0, limit);
|
|
193
|
+
} else if (p.netYtSwap > 0) {
|
|
194
|
+
_transferFrom(YT, msg.sender, _entry_swapExactYtForSy(YT, limit), p.netYtSwap);
|
|
195
|
+
(p.netSyFromSwap, p.netSyFee) = _swapExactYtForSy(receiver, market, SY, YT, p.netYtSwap, 0, limit);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
p.totalSyOut = p.netSyFromRemove + p.netSyFromRedeem + p.netSyFromSwap;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/// @dev The interface might change in the future, check with Pendle team before use
|
|
202
|
+
function exitPostExpToToken(
|
|
203
|
+
address receiver,
|
|
204
|
+
address market,
|
|
205
|
+
uint256 netPtIn,
|
|
206
|
+
uint256 netLpIn,
|
|
207
|
+
TokenOutput calldata output
|
|
208
|
+
) external returns (uint256 totalTokenOut, ExitPostExpReturnParams memory params) {
|
|
209
|
+
IStandardizedYield SY;
|
|
210
|
+
|
|
211
|
+
(SY, params) = _exitPostExpToSy(true, address(0), market, netPtIn, netLpIn);
|
|
212
|
+
totalTokenOut = _redeemSyToToken(receiver, address(SY), params.totalSyOut, output, false);
|
|
213
|
+
|
|
214
|
+
emit ExitPostExpToToken(msg.sender, market, output.tokenOut, receiver, netLpIn, totalTokenOut, params);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/// @dev The interface might change in the future, check with Pendle team before use
|
|
218
|
+
function exitPostExpToSy(
|
|
219
|
+
address receiver,
|
|
220
|
+
address market,
|
|
221
|
+
uint256 netPtIn,
|
|
222
|
+
uint256 netLpIn,
|
|
223
|
+
uint256 minSyOut
|
|
224
|
+
) external returns (ExitPostExpReturnParams memory params) {
|
|
225
|
+
(, params) = _exitPostExpToSy(false, receiver, market, netPtIn, netLpIn);
|
|
226
|
+
require(params.totalSyOut >= minSyOut, "Slippage: INSUFFICIENT_SY_OUT");
|
|
227
|
+
|
|
228
|
+
emit ExitPostExpToSy(msg.sender, market, receiver, netLpIn, params);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function _exitPostExpToSy(
|
|
232
|
+
bool setReceiverToSy,
|
|
233
|
+
address receiver,
|
|
234
|
+
address market,
|
|
235
|
+
uint256 netPtIn,
|
|
236
|
+
uint256 netLpIn
|
|
237
|
+
) internal returns (IStandardizedYield SY, ExitPostExpReturnParams memory p) {
|
|
238
|
+
IPPrincipalToken PT;
|
|
239
|
+
IPYieldToken YT;
|
|
240
|
+
(SY, PT, YT) = IPMarket(market).readTokens();
|
|
241
|
+
|
|
242
|
+
if (setReceiverToSy) receiver = address(SY);
|
|
243
|
+
|
|
244
|
+
if (netLpIn > 0) {
|
|
245
|
+
_transferFrom(IERC20(market), msg.sender, market, netLpIn);
|
|
246
|
+
(p.netSyFromRemove, p.netPtFromRemove) = IPMarket(market).burn(receiver, address(YT), netLpIn);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (netPtIn > 0) {
|
|
250
|
+
_transferFrom(PT, msg.sender, address(YT), netPtIn);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
p.netPtRedeem = p.netPtFromRemove + netPtIn;
|
|
254
|
+
p.netSyFromRedeem = IPYieldToken(YT).redeemPY(receiver);
|
|
255
|
+
|
|
256
|
+
p.totalSyOut = p.netSyFromRemove + p.netSyFromRedeem;
|
|
257
|
+
}
|
|
258
|
+
|
|
121
259
|
// ----------------- MISC FUNCTIONS -----------------
|
|
122
260
|
|
|
123
261
|
function boostMarkets(address[] memory markets) external {
|
|
124
|
-
for (uint256 i = 0; i < markets.length; ) {
|
|
262
|
+
for (uint256 i = 0; i < markets.length; i++) {
|
|
125
263
|
IPMarket(markets[i]).transferFrom(msg.sender, markets[i], 0);
|
|
126
|
-
unchecked {
|
|
127
|
-
i++;
|
|
128
|
-
}
|
|
129
264
|
}
|
|
130
265
|
}
|
|
131
266
|
|
|
132
267
|
function multicall(Call3[] calldata calls) external payable returns (Result[] memory res) {
|
|
133
268
|
uint256 length = calls.length;
|
|
134
269
|
res = new Result[](length);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// delegatecall to itself, it turns allowing invoking functions from other actions
|
|
140
|
-
(bool success, bytes memory result) = address(this).delegatecall(call.callData);
|
|
141
|
-
|
|
142
|
-
if (!success && !call.allowFailure) {
|
|
143
|
-
assembly {
|
|
144
|
-
// We use Yul's revert() to bubble up errors from the target contract.
|
|
145
|
-
revert(add(32, result), mload(result))
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
res[i].success = success;
|
|
150
|
-
res[i].returnData = result;
|
|
151
|
-
|
|
152
|
-
unchecked {
|
|
153
|
-
++i;
|
|
154
|
-
}
|
|
270
|
+
for (uint256 i = 0; i < length; i++) {
|
|
271
|
+
(bool success, bytes memory result) = _delegateToSelf(calls[i].callData, calls[i].allowFailure);
|
|
272
|
+
res[i] = Result(success, result);
|
|
155
273
|
}
|
|
156
274
|
}
|
|
157
275
|
|
|
276
|
+
/// @dev The interface might change in the future, check with Pendle team before use
|
|
277
|
+
function callAndReflect(
|
|
278
|
+
address payable reflector,
|
|
279
|
+
bytes calldata selfCall1,
|
|
280
|
+
bytes calldata selfCall2,
|
|
281
|
+
bytes calldata reflectCall
|
|
282
|
+
) external payable returns (bytes memory selfRes1, bytes memory selfRes2, bytes memory reflectRes) {
|
|
283
|
+
(, selfRes1) = _delegateToSelf(selfCall1, false);
|
|
284
|
+
if (selfCall2.length > 0) (, selfRes2) = _delegateToSelf(selfCall2, false);
|
|
285
|
+
reflectRes = _callToReflector(reflector, reflectCall);
|
|
286
|
+
}
|
|
287
|
+
|
|
158
288
|
function simulate(address target, bytes calldata data) external payable {
|
|
159
289
|
(bool success, bytes memory result) = target.delegatecall(data);
|
|
160
290
|
revert Errors.SimulationResults(success, result);
|
|
161
291
|
}
|
|
292
|
+
|
|
293
|
+
function _delegateToSelf(
|
|
294
|
+
bytes memory data,
|
|
295
|
+
bool allowFailure
|
|
296
|
+
) internal returns (bool success, bytes memory result) {
|
|
297
|
+
(success, result) = address(this).delegatecall(data);
|
|
298
|
+
|
|
299
|
+
if (!success && !allowFailure) {
|
|
300
|
+
assembly {
|
|
301
|
+
// We use Yul's revert() to bubble up errors from the target contract.
|
|
302
|
+
revert(add(32, result), mload(result))
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function _callToReflector(address payable reflector, bytes memory data) internal returns (bytes memory) {
|
|
308
|
+
return IPReflector(reflector).reflect(data);
|
|
309
|
+
}
|
|
162
310
|
}
|
|
@@ -52,51 +52,6 @@ contract ActionSwapYTV3 is CallbackHelper, IPActionSwapYTV3, ActionBase {
|
|
|
52
52
|
emit SwapYtAndSy(msg.sender, market, receiver, netYtOut.Int(), exactSyIn.neg());
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
function _entry_swapExactSyForYt(IPYieldToken YT, LimitOrderData calldata limit) internal view returns (address) {
|
|
56
|
-
return !_isEmptyLimit(limit) ? address(this) : address(YT);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _swapExactSyForYt(
|
|
60
|
-
address receiver,
|
|
61
|
-
address market,
|
|
62
|
-
IStandardizedYield SY,
|
|
63
|
-
IPYieldToken YT,
|
|
64
|
-
uint256 exactSyIn,
|
|
65
|
-
uint256 minYtOut,
|
|
66
|
-
ApproxParams calldata guessYtOut,
|
|
67
|
-
LimitOrderData calldata limit
|
|
68
|
-
) internal returns (uint256 netYtOut, uint256 netSyFee) {
|
|
69
|
-
uint256 netSyLeft = exactSyIn;
|
|
70
|
-
bool doMarketOrder = true;
|
|
71
|
-
|
|
72
|
-
if (!_isEmptyLimit(limit)) {
|
|
73
|
-
(netSyLeft, netYtOut, netSyFee, doMarketOrder) = _fillLimit(receiver, SY, netSyLeft, limit);
|
|
74
|
-
if (doMarketOrder) {
|
|
75
|
-
_transferOut(address(SY), address(YT), netSyLeft);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (doMarketOrder) {
|
|
80
|
-
(uint256 netYtOutMarket, ) = _readMarket(market).approxSwapExactSyForYt(
|
|
81
|
-
YT.newIndex(),
|
|
82
|
-
netSyLeft,
|
|
83
|
-
block.timestamp,
|
|
84
|
-
guessYtOut
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
(, uint256 netSyFeeMarket) = IPMarket(market).swapExactPtForSy(
|
|
88
|
-
address(YT),
|
|
89
|
-
netYtOutMarket, // exactPtIn = netYtOut
|
|
90
|
-
_encodeSwapExactSyForYt(receiver, YT)
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
netYtOut += netYtOutMarket;
|
|
94
|
-
netSyFee += netSyFeeMarket;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (netYtOut < minYtOut) revert("Slippage: INSUFFICIENT_YT_OUT");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
55
|
// ------------------ SWAP TOKEN FOR TOKEN ------------------
|
|
101
56
|
|
|
102
57
|
function swapExactYtForToken(
|
|
@@ -138,46 +93,6 @@ contract ActionSwapYTV3 is CallbackHelper, IPActionSwapYTV3, ActionBase {
|
|
|
138
93
|
emit SwapYtAndSy(msg.sender, market, receiver, exactYtIn.neg(), netSyOut.Int());
|
|
139
94
|
}
|
|
140
95
|
|
|
141
|
-
function _entry_swapExactYtForSy(IPYieldToken YT, LimitOrderData calldata limit) internal view returns (address) {
|
|
142
|
-
return !_isEmptyLimit(limit) ? address(this) : address(YT);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function _swapExactYtForSy(
|
|
146
|
-
address receiver,
|
|
147
|
-
address market,
|
|
148
|
-
IStandardizedYield SY,
|
|
149
|
-
IPYieldToken YT,
|
|
150
|
-
uint256 exactYtIn,
|
|
151
|
-
uint256 minSyOut,
|
|
152
|
-
LimitOrderData calldata limit
|
|
153
|
-
) internal returns (uint256 netSyOut, uint256 netSyFee) {
|
|
154
|
-
uint256 netYtLeft = exactYtIn;
|
|
155
|
-
bool doMarketOrder = true;
|
|
156
|
-
|
|
157
|
-
if (!_isEmptyLimit(limit)) {
|
|
158
|
-
(netYtLeft, netSyOut, netSyFee, doMarketOrder) = _fillLimit(receiver, YT, netYtLeft, limit);
|
|
159
|
-
if (doMarketOrder) {
|
|
160
|
-
_transferOut(address(YT), address(YT), netYtLeft);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (doMarketOrder) {
|
|
165
|
-
uint256 preSyBalance = SY.balanceOf(receiver);
|
|
166
|
-
|
|
167
|
-
(, uint256 netSyFeeMarket) = IPMarket(market).swapSyForExactPt(
|
|
168
|
-
address(YT),
|
|
169
|
-
netYtLeft, // exactPtOut = netYtLeft
|
|
170
|
-
_encodeSwapYtForSy(receiver, YT)
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
// avoid stack issue
|
|
174
|
-
netSyFee += netSyFeeMarket;
|
|
175
|
-
netSyOut += SY.balanceOf(receiver) - preSyBalance;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (netSyOut < minSyOut) revert("Slippage: INSUFFICIENT_SY_OUT");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
96
|
// ------------------ SWAP PT FOR YT ------------------
|
|
182
97
|
|
|
183
98
|
function swapExactPtForYt(
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../interfaces/IPAllActionV3.sol";
|
|
5
|
+
import "../interfaces/IPReflector.sol";
|
|
6
|
+
import "../core/libraries/TokenHelper.sol";
|
|
7
|
+
|
|
8
|
+
contract Reflector is TokenHelper, IPReflector {
|
|
9
|
+
using SafeERC20 for IERC20;
|
|
10
|
+
|
|
11
|
+
mapping(address => bool) internal approved;
|
|
12
|
+
address internal constant ROUTER = 0x888888888889758F76e7103c6CbF23ABbF58F946;
|
|
13
|
+
|
|
14
|
+
receive() external payable {}
|
|
15
|
+
|
|
16
|
+
function reflect(bytes calldata inputData) external returns (bytes memory result) {
|
|
17
|
+
(uint256 value, bytes memory newCalldata) = _getNewCalldata(inputData);
|
|
18
|
+
bool success;
|
|
19
|
+
|
|
20
|
+
(success, result) = ROUTER.call{value: value}(newCalldata);
|
|
21
|
+
if (!success) {
|
|
22
|
+
assembly {
|
|
23
|
+
// We use Yul's revert() to bubble up errors from the target contract.
|
|
24
|
+
revert(add(32, result), mload(result))
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _getNewCalldata(bytes calldata inputData) internal returns (uint256 value, bytes memory newCalldata) {
|
|
30
|
+
bytes4 selector = bytes4(inputData[:4]);
|
|
31
|
+
bytes calldata data = inputData[4:];
|
|
32
|
+
|
|
33
|
+
if (selector == IPActionAddRemoveLiqV3.addLiquiditySingleToken.selector) {
|
|
34
|
+
(
|
|
35
|
+
address v1,
|
|
36
|
+
address v2,
|
|
37
|
+
uint256 v3,
|
|
38
|
+
ApproxParams memory v4,
|
|
39
|
+
TokenInput memory v5,
|
|
40
|
+
LimitOrderData memory v6
|
|
41
|
+
) = abi.decode(data, (address, address, uint256, ApproxParams, TokenInput, LimitOrderData));
|
|
42
|
+
|
|
43
|
+
value = _scaleTokenInputAndGetValue(v5);
|
|
44
|
+
newCalldata = abi.encodeWithSelector(selector, v1, v2, v3, v4, v5, v6);
|
|
45
|
+
} else if (selector == IPActionAddRemoveLiqV3.addLiquiditySingleTokenKeepYt.selector) {
|
|
46
|
+
(address v1, address v2, uint256 v3, uint256 v4, TokenInput memory v5) = abi.decode(
|
|
47
|
+
data,
|
|
48
|
+
(address, address, uint256, uint256, TokenInput)
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
value = _scaleTokenInputAndGetValue(v5);
|
|
52
|
+
newCalldata = abi.encodeWithSelector(selector, v1, v2, v3, v4, v5);
|
|
53
|
+
} else {
|
|
54
|
+
revert("UNSUPPORTED_SELECTOR");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _scaleTokenInputAndGetValue(TokenInput memory inp) internal returns (uint256 ethValue) {
|
|
59
|
+
require(inp.swapData.swapType == SwapType.NONE, "SWAP_NOT_ALLOWED"); // the exit call should already swap
|
|
60
|
+
|
|
61
|
+
inp.netTokenIn = _selfBalance(inp.tokenIn);
|
|
62
|
+
|
|
63
|
+
if (inp.tokenIn == NATIVE) {
|
|
64
|
+
ethValue = inp.netTokenIn;
|
|
65
|
+
} else if (!approved[inp.tokenIn]) {
|
|
66
|
+
IERC20(inp.tokenIn).forceApprove(ROUTER, type(uint256).max);
|
|
67
|
+
approved[inp.tokenIn] = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -10,8 +10,10 @@ import "../../router/base/MarketApproxLib.sol";
|
|
|
10
10
|
|
|
11
11
|
import "../../core/libraries/Errors.sol";
|
|
12
12
|
import "../swap-aggregator/IPSwapAggregator.sol";
|
|
13
|
+
import "./CallbackHelper.sol";
|
|
13
14
|
|
|
14
|
-
abstract contract ActionBase is TokenHelper, IPLimitOrderType {
|
|
15
|
+
abstract contract ActionBase is TokenHelper, CallbackHelper, IPLimitOrderType {
|
|
16
|
+
using MarketApproxPtInLib for MarketState;
|
|
15
17
|
using MarketApproxPtOutLib for MarketState;
|
|
16
18
|
using PMath for uint256;
|
|
17
19
|
using PYIndexLib for IPYieldToken;
|
|
@@ -236,6 +238,93 @@ abstract contract ActionBase is TokenHelper, IPLimitOrderType {
|
|
|
236
238
|
if (netPtOut < minPtOut) revert("Slippage: INSUFFICIENT_PT_OUT");
|
|
237
239
|
}
|
|
238
240
|
|
|
241
|
+
// ----------------- YT SWAP -----------------
|
|
242
|
+
|
|
243
|
+
function _entry_swapExactYtForSy(IPYieldToken YT, LimitOrderData calldata limit) internal view returns (address) {
|
|
244
|
+
return !_isEmptyLimit(limit) ? address(this) : address(YT);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function _swapExactYtForSy(
|
|
248
|
+
address receiver,
|
|
249
|
+
address market,
|
|
250
|
+
IStandardizedYield SY,
|
|
251
|
+
IPYieldToken YT,
|
|
252
|
+
uint256 exactYtIn,
|
|
253
|
+
uint256 minSyOut,
|
|
254
|
+
LimitOrderData calldata limit
|
|
255
|
+
) internal returns (uint256 netSyOut, uint256 netSyFee) {
|
|
256
|
+
uint256 netYtLeft = exactYtIn;
|
|
257
|
+
bool doMarketOrder = true;
|
|
258
|
+
|
|
259
|
+
if (!_isEmptyLimit(limit)) {
|
|
260
|
+
(netYtLeft, netSyOut, netSyFee, doMarketOrder) = _fillLimit(receiver, YT, netYtLeft, limit);
|
|
261
|
+
if (doMarketOrder) {
|
|
262
|
+
_transferOut(address(YT), address(YT), netYtLeft);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (doMarketOrder) {
|
|
267
|
+
uint256 preSyBalance = SY.balanceOf(receiver);
|
|
268
|
+
|
|
269
|
+
(, uint256 netSyFeeMarket) = IPMarket(market).swapSyForExactPt(
|
|
270
|
+
address(YT),
|
|
271
|
+
netYtLeft, // exactPtOut = netYtLeft
|
|
272
|
+
_encodeSwapYtForSy(receiver, YT)
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
// avoid stack issue
|
|
276
|
+
netSyFee += netSyFeeMarket;
|
|
277
|
+
netSyOut += SY.balanceOf(receiver) - preSyBalance;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (netSyOut < minSyOut) revert("Slippage: INSUFFICIENT_SY_OUT");
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function _entry_swapExactSyForYt(IPYieldToken YT, LimitOrderData calldata limit) internal view returns (address) {
|
|
284
|
+
return !_isEmptyLimit(limit) ? address(this) : address(YT);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function _swapExactSyForYt(
|
|
288
|
+
address receiver,
|
|
289
|
+
address market,
|
|
290
|
+
IStandardizedYield SY,
|
|
291
|
+
IPYieldToken YT,
|
|
292
|
+
uint256 exactSyIn,
|
|
293
|
+
uint256 minYtOut,
|
|
294
|
+
ApproxParams calldata guessYtOut,
|
|
295
|
+
LimitOrderData calldata limit
|
|
296
|
+
) internal returns (uint256 netYtOut, uint256 netSyFee) {
|
|
297
|
+
uint256 netSyLeft = exactSyIn;
|
|
298
|
+
bool doMarketOrder = true;
|
|
299
|
+
|
|
300
|
+
if (!_isEmptyLimit(limit)) {
|
|
301
|
+
(netSyLeft, netYtOut, netSyFee, doMarketOrder) = _fillLimit(receiver, SY, netSyLeft, limit);
|
|
302
|
+
if (doMarketOrder) {
|
|
303
|
+
_transferOut(address(SY), address(YT), netSyLeft);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (doMarketOrder) {
|
|
308
|
+
(uint256 netYtOutMarket, ) = _readMarket(market).approxSwapExactSyForYt(
|
|
309
|
+
YT.newIndex(),
|
|
310
|
+
netSyLeft,
|
|
311
|
+
block.timestamp,
|
|
312
|
+
guessYtOut
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
(, uint256 netSyFeeMarket) = IPMarket(market).swapExactPtForSy(
|
|
316
|
+
address(YT),
|
|
317
|
+
netYtOutMarket, // exactPtIn = netYtOut
|
|
318
|
+
_encodeSwapExactSyForYt(receiver, YT)
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
netYtOut += netYtOutMarket;
|
|
322
|
+
netSyFee += netSyFeeMarket;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (netYtOut < minYtOut) revert("Slippage: INSUFFICIENT_YT_OUT");
|
|
326
|
+
}
|
|
327
|
+
|
|
239
328
|
// ----------------- LIMIT ORDERS -----------------
|
|
240
329
|
function _fillLimit(
|
|
241
330
|
address receiver,
|
package/deployments/1-core.json
CHANGED
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
"yieldContractFactory": "0x70ee0A6DB4F5a2Dc4d9c0b57bE97B9987e75BAFD",
|
|
22
22
|
"marketFactory": "0x27b1dAcd74688aF24a64BD3C9C1B143118740784",
|
|
23
23
|
"router": "0x888888888889758F76e7103c6CbF23ABbF58F946",
|
|
24
|
+
"routerFacets": {
|
|
25
|
+
"ActionAddRemoveLiqV3": "0xb7631b93189900745Db51d960Ba64b8E6C658843",
|
|
26
|
+
"ActionSwapPTV3": "0xbFA3aAD535e1b996396698f89FFeC7ada0df17E8",
|
|
27
|
+
"ActionSwapYTV3": "0x8903dBFFcA66b3Fbc027aC81912ea64Fa61A5219",
|
|
28
|
+
"ActionMiscV3": "0x9afd337e41f59e5c2e6f2be05f32e958a4dbcd9a",
|
|
29
|
+
"ActionCallbackV3": "0x997FBC511a8Ad11F84a400feACD66E2A3fa805d2",
|
|
30
|
+
"ActionStorageV4": "0x6a0Ed0A9193FCBe7ae9B0F3D90F88e365Cca64fC"
|
|
31
|
+
},
|
|
24
32
|
"routerStatic": "0x263833d47eA3fA4a30f269323aba6a107f9eB14C",
|
|
25
33
|
"pendleSwap": "0x1e8b6Ac39f8A33f46a6Eb2D1aCD1047B99180AD1",
|
|
26
34
|
"routerHelper": "0x462206b11d185ef6F64B41D344325401C37EC335",
|
|
@@ -35,5 +43,6 @@
|
|
|
35
43
|
"votingController": "0x44087E105137a5095c008AaB6a6530182821F2F0",
|
|
36
44
|
"gaugeController": "0x47D74516B33eD5D70ddE7119A40839f6Fcc24e57",
|
|
37
45
|
"feeDistributor": "0xd7b34a6fDCb2A7ceD2115FF7f5fdD72aa6aA4dE2",
|
|
38
|
-
"feeDistributorV2": "0x8C237520a8E14D658170A633D96F8e80764433b9"
|
|
46
|
+
"feeDistributorV2": "0x8C237520a8E14D658170A633D96F8e80764433b9",
|
|
47
|
+
"reflector": "0x5a04b737D770Ed478cb9b65D1864c24d2E9Ca227"
|
|
39
48
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY Karak sUSDe",
|
|
3
|
+
"SY": "0x1b641894e66aec7bf5ab86517e8d81763cc8e19e",
|
|
4
|
+
"YT": "0xdd68f5D26Bf1182d6b241108bfC01f95C030502b",
|
|
5
|
+
"PT": "0xd351de53277c4218CC29f793263FB60E2fcFC1dC",
|
|
6
|
+
"market": "0xB1f587B354a4a363f5332e88effbbC2E4961250A",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "3480095243000000000",
|
|
9
|
+
"initAnchor": "1243231806000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000",
|
|
11
|
+
"deployTxHash": "0xb133757035e5f335a6070099cca7dfc7f34b3d2078cb3929db627a5e5228f50b",
|
|
12
|
+
"deployBlockNumber": 19967918,
|
|
13
|
+
"reversedFee": 0.2999999999199199
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY Karak USDe",
|
|
3
|
+
"SY": "0xfe2d379117895fa6144b209c13894a17ab18c86c",
|
|
4
|
+
"YT": "0x2e40D7Cfee1e7D31d1F4875e6F33B2c9a17038fF",
|
|
5
|
+
"PT": "0x791c1E9D38029092E8aD1E252d0Bb97261809A2c",
|
|
6
|
+
"market": "0x1BCBDB8c8652345A5ACF04e6E74f70086c68FEfC",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "3070185566000000000",
|
|
9
|
+
"initAnchor": "1247051504000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000",
|
|
11
|
+
"deployTxHash": "0xa74e87ad2f48154eb1192498122c80d99c11c2938cc2fd8bf3d6330132e9f520",
|
|
12
|
+
"deployBlockNumber": 19967899,
|
|
13
|
+
"reversedFee": 0.2999999999199199
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY Karak eETH",
|
|
3
|
+
"SY": "0x8db42af6b2de9e8aee47f3423570d8e9c3873796",
|
|
4
|
+
"YT": "0x5439c3Ef0072e4A19C44478CDF947F5d957e66C7",
|
|
5
|
+
"PT": "0x5E9e4bFd81c8c03F8289b827C9B92332789b6fe1",
|
|
6
|
+
"market": "0x18bAFcaBf2d5898956AE6AC31543d9657a604165",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "3612434850000000000",
|
|
9
|
+
"initAnchor": "1216826907000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000",
|
|
11
|
+
"deployTxHash": "0x26bba852c4385f67503265fb85d16df41325aeec85668cea7a8b062d7d1fbe7a",
|
|
12
|
+
"deployBlockNumber": 19967933,
|
|
13
|
+
"reversedFee": 0.2999999999199199
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY pufETH",
|
|
3
|
+
"SY": "0x253008ba4aE2f3E6488DC998a5321D4EB1a0c905",
|
|
4
|
+
"YT": "0x1a65eB80a2ac3ea6E41D456DdD6E9cC5728BEf7C",
|
|
5
|
+
"PT": "0xd4e75971eAF78a8d93D96df530f1FFf5f9F53288",
|
|
6
|
+
"market": "0xA54FC268101c8b97DE19eF3141d34751a11996B2",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7770558179000000000",
|
|
9
|
+
"initAnchor": "1110275954000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY rsETH",
|
|
3
|
+
"SY": "0x730A5E2AcEbccAA5e9095723B3CB862739DA793c",
|
|
4
|
+
"YT": "0xE653E4048620E546AFff02D3689678896d22e236",
|
|
5
|
+
"PT": "0x7bAf258049cc8B9A78097723dc19a8b103D4098F",
|
|
6
|
+
"market": "0x6b4740722e46048874d84306B2877600ABCea3Ae",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7770558179000000000",
|
|
9
|
+
"initAnchor": "1110275954000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SUSDE-MAINNET-SEP2024",
|
|
3
|
+
"SY": "0x4139cDC6345aFFbaC0692b43bed4D059Df3e6d65",
|
|
4
|
+
"YT": "0xdc02b77a3986da62C7A78FED73949C9767850809",
|
|
5
|
+
"PT": "0x6c9f097e044506712B58EAC670c9a5fd4BCceF13",
|
|
6
|
+
"market": "0xd1D7D99764f8a52Aff007b7831cc02748b2013b5",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"lnFeeRateRoot": "2995508979000000",
|
|
9
|
+
"scalarRoot": "8580934398000000000",
|
|
10
|
+
"initAnchor": "1120006408000000000",
|
|
11
|
+
"doCacheIndexSameBlock": true,
|
|
12
|
+
"deployTxHash": "0x467c0c15148778d0b99a1d9f3bd7406fd0c58d8a6e3284a57a50e55ae0160165"
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "UNIETH-MAINNET-SEP2024",
|
|
3
|
+
"SY": "0xc430dB19339A3051192233B4c49f9aB3DC6D16b7",
|
|
4
|
+
"YT": "0xdF74bA4436478969A54eCB352093312fE97EBAa5",
|
|
5
|
+
"PT": "0x15fA86404BFbA8b46684552F792558128bFB6418",
|
|
6
|
+
"market": "0xBaE2Df4DfCd0c613018D6056A40077F2d1eFf28A",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"lnFeeRateRoot": "2995508979000000",
|
|
9
|
+
"scalarRoot": "7770558179000000000",
|
|
10
|
+
"initAnchor": "1110275954000000000",
|
|
11
|
+
"doCacheIndexSameBlock": true,
|
|
12
|
+
"deployTxHash": "0x4e509feb8502bee0c719c1a9eb2c73c9e1b070fc8424e1f4f31618bdc764a560"
|
|
13
|
+
}
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
"multicall": "0xfd6Df9EFACfEfdF4E610d687A9c9b941D1b1Bf75",
|
|
3
3
|
"pendleMulticallV2": "0x539fd510fE352CC81822a222F821c340133Ed41C",
|
|
4
4
|
"implicitSwapfeeContract": "0x43D03031FAb845065e9CEfE89Dd122d63F72011F",
|
|
5
|
-
"simulateHelper": "0x2b3EC64160F658fFe7061769415Ff080fca80BbA"
|
|
5
|
+
"simulateHelper": "0x2b3EC64160F658fFe7061769415Ff080fca80BbA",
|
|
6
|
+
"supplyCapReader": "0x438C7dBA7d355aA0c77459AF38B2E62f9f9EccBf"
|
|
6
7
|
}
|