@pendle/core-v2 1.4.0-testnet → 1.4.2-testnet
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/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.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/IPLiquidityMigrator.sol/IPLiquidityMigrator.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPLiquidityMigrator.sol/IPLiquidityMigrator.json +655 -0
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPRouterHelper.sol/IPRouterHelper.json +747 -0
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.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/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- 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/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- 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/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +2 -2
- 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/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +2 -2
- 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/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +2 -2
- 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/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
- 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/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +2 -2
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPT.sol/ActionSwapPT.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYT.sol/ActionSwapYT.json +2 -2
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/PendleRouterHelper.sol/PendleRouterHelper.json +891 -0
- 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/contracts/interfaces/IPRouterHelper.sol +168 -0
- package/contracts/router/PendleRouterHelper.sol +98 -55
- package/contracts/router/base/ActionBaseMintRedeem.sol +5 -4
- package/deployments/43113-core.json +1 -1
- package/package.json +1 -1
- package/typechain-types/IPRouterHelper.ts +638 -0
- package/typechain-types/PendleRouterHelper.ts +270 -171
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
- package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
- package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/IPRouterHelper__factory.ts +763 -0
- package/typechain-types/factories/PendleRouterHelper__factory.ts +159 -47
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +9 -0
- package/typechain-types/index.ts +2 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../router/base/MarketApproxLib.sol";
|
|
5
|
+
import "../router/base/ActionBaseMintRedeem.sol";
|
|
6
|
+
|
|
7
|
+
interface IPRouterHelper {
|
|
8
|
+
/**
|
|
9
|
+
* @param output This output struct should be filled the same way as the normal removeLiquiditySingleToken
|
|
10
|
+
operation (This means all BulkSeller, PendleSwap still works the same way). Note that the
|
|
11
|
+
output.tokenOut will also be used as the input token for the addLiquidity
|
|
12
|
+
*/
|
|
13
|
+
struct RemoveLiquiditySingleTokenStruct {
|
|
14
|
+
address market;
|
|
15
|
+
uint256 netLpToRemove;
|
|
16
|
+
bool doRedeemRewards;
|
|
17
|
+
TokenOutput output;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param guessNetTokenIn the predicted amount of tokenIn that will be used to add liquidity. This
|
|
22
|
+
should be the same amount that was used to generate guessPtReceivedFromSy (if any).
|
|
23
|
+
* @param guessPtReceivedFromSy the same guess struct in the normal addLiquiditySingleToken operation.
|
|
24
|
+
Again, note that this struct, if not empty (i.e. if guessOffchain == 0), should be generated
|
|
25
|
+
using `guessNetTokenIn` amount of tokenIn
|
|
26
|
+
* @dev tokenIn is the output.tokenOut of the removeLiquiditySingleTokenStruct
|
|
27
|
+
*/
|
|
28
|
+
struct AddLiquiditySingleTokenStruct {
|
|
29
|
+
address market;
|
|
30
|
+
uint256 minLpOut;
|
|
31
|
+
uint256 guessNetTokenIn;
|
|
32
|
+
ApproxParams guessPtReceivedFromSy;
|
|
33
|
+
address bulk;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @dev tokenIn is the output.tokenOut of the removeLiquiditySingleTokenStruct
|
|
38
|
+
*/
|
|
39
|
+
struct AddLiquiditySingleTokenKeepYtStruct {
|
|
40
|
+
address market;
|
|
41
|
+
uint256 minLpOut;
|
|
42
|
+
uint256 minYtOut;
|
|
43
|
+
address bulk;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
struct RemoveLiquiditySingleSyStruct {
|
|
47
|
+
address market;
|
|
48
|
+
uint256 netLpToRemove;
|
|
49
|
+
bool doRedeemRewards;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @dev guessNetSyIn & guessPtReceivedFromSy have similar meanings to AddLiquiditySingleTokenStruct
|
|
54
|
+
*/
|
|
55
|
+
struct AddLiquiditySingleSyStruct {
|
|
56
|
+
address market;
|
|
57
|
+
uint256 minLpOut;
|
|
58
|
+
uint256 guessNetSyIn;
|
|
59
|
+
ApproxParams guessPtReceivedFromSy;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
struct AddLiquiditySingleSyKeepYtStruct {
|
|
63
|
+
address market;
|
|
64
|
+
uint256 minLpOut;
|
|
65
|
+
uint256 minYtOut;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
event RemoveLiquiditySingleToken(
|
|
69
|
+
address indexed caller,
|
|
70
|
+
address indexed market,
|
|
71
|
+
address indexed token,
|
|
72
|
+
address receiver,
|
|
73
|
+
uint256 netLpToRemove,
|
|
74
|
+
uint256 netTokenOut
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
event RemoveLiquiditySingleSy(
|
|
78
|
+
address indexed caller,
|
|
79
|
+
address indexed market,
|
|
80
|
+
address indexed receiver,
|
|
81
|
+
uint256 netLpToRemove,
|
|
82
|
+
uint256 netSyOut
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
event AddLiquiditySingleToken(
|
|
86
|
+
address indexed caller,
|
|
87
|
+
address indexed market,
|
|
88
|
+
address indexed token,
|
|
89
|
+
address receiver,
|
|
90
|
+
uint256 netTokenIn,
|
|
91
|
+
uint256 netLpOut
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
event AddLiquiditySingleSy(
|
|
95
|
+
address indexed caller,
|
|
96
|
+
address indexed market,
|
|
97
|
+
address indexed receiver,
|
|
98
|
+
uint256 netSyIn,
|
|
99
|
+
uint256 netLpOut
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
event AddLiquiditySingleTokenKeepYt(
|
|
103
|
+
address indexed caller,
|
|
104
|
+
address indexed market,
|
|
105
|
+
address indexed token,
|
|
106
|
+
address receiver,
|
|
107
|
+
uint256 netTokenIn,
|
|
108
|
+
uint256 netLpOut,
|
|
109
|
+
uint256 netYtOut
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
event AddLiquiditySingleSyKeepYt(
|
|
113
|
+
address indexed caller,
|
|
114
|
+
address indexed market,
|
|
115
|
+
address indexed receiver,
|
|
116
|
+
uint256 netSyIn,
|
|
117
|
+
uint256 netLpOut,
|
|
118
|
+
uint256 netYtOut
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
function transferLiquidityDifferentSyNormal(
|
|
122
|
+
RemoveLiquiditySingleTokenStruct calldata fromMarket,
|
|
123
|
+
AddLiquiditySingleTokenStruct calldata toMarket
|
|
124
|
+
)
|
|
125
|
+
external
|
|
126
|
+
returns (
|
|
127
|
+
uint256 netLpOut,
|
|
128
|
+
uint256 netTokenZapIn,
|
|
129
|
+
uint256 netSyFeeOfRemove,
|
|
130
|
+
uint256 netSyFeeOfAdd
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
function transferLiquidityDifferentSyKeepYt(
|
|
134
|
+
RemoveLiquiditySingleTokenStruct calldata fromMarket,
|
|
135
|
+
AddLiquiditySingleTokenKeepYtStruct calldata toMarket
|
|
136
|
+
)
|
|
137
|
+
external
|
|
138
|
+
returns (
|
|
139
|
+
uint256 netLpOut,
|
|
140
|
+
uint256 netYtOut,
|
|
141
|
+
uint256 netTokenZapIn,
|
|
142
|
+
uint256 netSyFeeOfRemove
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
function transferLiquiditySameSyNormal(
|
|
146
|
+
RemoveLiquiditySingleSyStruct calldata fromMarket,
|
|
147
|
+
AddLiquiditySingleSyStruct calldata toMarket
|
|
148
|
+
)
|
|
149
|
+
external
|
|
150
|
+
returns (
|
|
151
|
+
uint256 netLpOut,
|
|
152
|
+
uint256 netSyZapIn,
|
|
153
|
+
uint256 netSyFeeOfRemove,
|
|
154
|
+
uint256 netSyFeeOfAdd
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
function transferLiquiditySameSyKeepYt(
|
|
158
|
+
RemoveLiquiditySingleSyStruct calldata fromMarket,
|
|
159
|
+
AddLiquiditySingleSyKeepYtStruct calldata toMarket
|
|
160
|
+
)
|
|
161
|
+
external
|
|
162
|
+
returns (
|
|
163
|
+
uint256 netLpOut,
|
|
164
|
+
uint256 netYtOut,
|
|
165
|
+
uint256 netSyZapIn,
|
|
166
|
+
uint256 netSyFeeOfRemove
|
|
167
|
+
);
|
|
168
|
+
}
|
|
@@ -3,22 +3,35 @@ pragma solidity 0.8.17;
|
|
|
3
3
|
|
|
4
4
|
import "../interfaces/IPAllAction.sol";
|
|
5
5
|
import "../interfaces/IPMarket.sol";
|
|
6
|
-
import "../interfaces/
|
|
6
|
+
import "../interfaces/IPRouterHelper.sol";
|
|
7
7
|
import "./base/ActionBaseMintRedeem.sol";
|
|
8
8
|
import "./base/MarketApproxLib.sol";
|
|
9
|
+
import "../interfaces/IAddressProvider.sol";
|
|
9
10
|
|
|
10
|
-
contract PendleRouterHelper is TokenHelper,
|
|
11
|
-
IPAllAction
|
|
12
|
-
address
|
|
11
|
+
contract PendleRouterHelper is TokenHelper, IPRouterHelper {
|
|
12
|
+
IPAllAction public immutable ROUTER;
|
|
13
|
+
address public immutable WETH;
|
|
13
14
|
|
|
14
|
-
constructor(address _ROUTER,
|
|
15
|
+
constructor(address _ROUTER, IAddressProvider provider) {
|
|
15
16
|
ROUTER = IPAllAction(_ROUTER);
|
|
16
|
-
WETH =
|
|
17
|
+
WETH = _getWETHAddress(provider, 1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _getWETHAddress(IAddressProvider provider, uint256 providerId)
|
|
21
|
+
internal
|
|
22
|
+
view
|
|
23
|
+
returns (address)
|
|
24
|
+
{
|
|
25
|
+
return provider.get(providerId);
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
receive() external payable {}
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @dev all the parameters for this function should be generated in the same way as they are
|
|
32
|
+
generated for the main Router, except that input.tokenIn & swapData should be generated
|
|
33
|
+
for tokenIn == WETH instead of ETH
|
|
34
|
+
*/
|
|
22
35
|
function addLiquiditySingleTokenKeepYtWithEth(
|
|
23
36
|
address receiver,
|
|
24
37
|
address market,
|
|
@@ -26,10 +39,11 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
26
39
|
uint256 minYtOut,
|
|
27
40
|
TokenInput calldata input
|
|
28
41
|
) external payable returns (uint256 netLpOut, uint256 netYtOut) {
|
|
29
|
-
|
|
42
|
+
require(input.tokenIn == WETH);
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
_transferIn(NATIVE, msg.sender, input.netTokenIn);
|
|
32
45
|
|
|
46
|
+
_wrap_unwrap_ETH(NATIVE, WETH, input.netTokenIn);
|
|
33
47
|
(netLpOut, netYtOut) = ROUTER.addLiquiditySingleTokenKeepYt(
|
|
34
48
|
receiver,
|
|
35
49
|
market,
|
|
@@ -37,11 +51,19 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
37
51
|
minYtOut,
|
|
38
52
|
input
|
|
39
53
|
);
|
|
40
|
-
}
|
|
41
54
|
|
|
42
|
-
|
|
55
|
+
emit AddLiquiditySingleTokenKeepYt(
|
|
56
|
+
msg.sender,
|
|
57
|
+
market,
|
|
58
|
+
NATIVE,
|
|
59
|
+
msg.sender,
|
|
60
|
+
input.netTokenIn,
|
|
61
|
+
netLpOut,
|
|
62
|
+
netYtOut
|
|
63
|
+
);
|
|
64
|
+
}
|
|
43
65
|
|
|
44
|
-
function
|
|
66
|
+
function transferLiquidityDifferentSyNormal(
|
|
45
67
|
RemoveLiquiditySingleTokenStruct calldata fromMarket,
|
|
46
68
|
AddLiquiditySingleTokenStruct calldata toMarket
|
|
47
69
|
)
|
|
@@ -59,17 +81,9 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
59
81
|
fromMarket.output.tokenOut,
|
|
60
82
|
netTokenZapIn
|
|
61
83
|
);
|
|
62
|
-
|
|
63
|
-
emit MigrateDifferentSyNormal(
|
|
64
|
-
fromMarket.market,
|
|
65
|
-
toMarket.market,
|
|
66
|
-
msg.sender,
|
|
67
|
-
fromMarket.netLpToRemove,
|
|
68
|
-
netLpOut
|
|
69
|
-
);
|
|
70
84
|
}
|
|
71
85
|
|
|
72
|
-
function
|
|
86
|
+
function transferLiquidityDifferentSyKeepYt(
|
|
73
87
|
RemoveLiquiditySingleTokenStruct calldata fromMarket,
|
|
74
88
|
AddLiquiditySingleTokenKeepYtStruct calldata toMarket
|
|
75
89
|
)
|
|
@@ -87,41 +101,25 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
87
101
|
fromMarket.output.tokenOut,
|
|
88
102
|
netTokenZapIn
|
|
89
103
|
);
|
|
90
|
-
|
|
91
|
-
emit MigrateDifferentSyKeepYt(
|
|
92
|
-
fromMarket.market,
|
|
93
|
-
toMarket.market,
|
|
94
|
-
msg.sender,
|
|
95
|
-
fromMarket.netLpToRemove,
|
|
96
|
-
netLpOut,
|
|
97
|
-
netYtOut
|
|
98
|
-
);
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
function
|
|
106
|
+
function transferLiquiditySameSyNormal(
|
|
102
107
|
RemoveLiquiditySingleSyStruct calldata fromMarket,
|
|
103
108
|
AddLiquiditySingleSyStruct calldata toMarket
|
|
104
109
|
)
|
|
105
110
|
external
|
|
106
111
|
returns (
|
|
107
112
|
uint256 netLpOut,
|
|
108
|
-
uint256
|
|
113
|
+
uint256 netSyZapIn,
|
|
109
114
|
uint256 netSyFeeOfRemove,
|
|
110
115
|
uint256 netSyFeeOfAdd
|
|
111
116
|
)
|
|
112
117
|
{
|
|
113
|
-
(
|
|
114
|
-
(netLpOut, netSyFeeOfAdd) = _addLiquiditySingleSy(toMarket,
|
|
115
|
-
emit MigrateSameSyNormal(
|
|
116
|
-
fromMarket.market,
|
|
117
|
-
toMarket.market,
|
|
118
|
-
msg.sender,
|
|
119
|
-
fromMarket.netLpToRemove,
|
|
120
|
-
netLpOut
|
|
121
|
-
);
|
|
118
|
+
(netSyZapIn, netSyFeeOfRemove) = _removeLiquiditySingleSy(fromMarket);
|
|
119
|
+
(netLpOut, netSyFeeOfAdd) = _addLiquiditySingleSy(toMarket, netSyZapIn);
|
|
122
120
|
}
|
|
123
121
|
|
|
124
|
-
function
|
|
122
|
+
function transferLiquiditySameSyKeepYt(
|
|
125
123
|
RemoveLiquiditySingleSyStruct calldata fromMarket,
|
|
126
124
|
AddLiquiditySingleSyKeepYtStruct calldata toMarket
|
|
127
125
|
)
|
|
@@ -129,20 +127,12 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
129
127
|
returns (
|
|
130
128
|
uint256 netLpOut,
|
|
131
129
|
uint256 netYtOut,
|
|
132
|
-
uint256
|
|
130
|
+
uint256 netSyZapIn,
|
|
133
131
|
uint256 netSyFeeOfRemove
|
|
134
132
|
)
|
|
135
133
|
{
|
|
136
|
-
(
|
|
137
|
-
(netLpOut, netYtOut) = _addLiquiditySingleSyKeepYt(toMarket,
|
|
138
|
-
emit MigrateSameSyKeepYt(
|
|
139
|
-
fromMarket.market,
|
|
140
|
-
toMarket.market,
|
|
141
|
-
msg.sender,
|
|
142
|
-
fromMarket.netLpToRemove,
|
|
143
|
-
netLpOut,
|
|
144
|
-
netYtOut
|
|
145
|
-
);
|
|
134
|
+
(netSyZapIn, netSyFeeOfRemove) = _removeLiquiditySingleSy(fromMarket);
|
|
135
|
+
(netLpOut, netYtOut) = _addLiquiditySingleSyKeepYt(toMarket, netSyZapIn);
|
|
146
136
|
}
|
|
147
137
|
|
|
148
138
|
function _removeLiquiditySingleToken(RemoveLiquiditySingleTokenStruct calldata fromMarket)
|
|
@@ -168,6 +158,15 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
168
158
|
if (fromMarket.doRedeemRewards) {
|
|
169
159
|
IPMarket(fromMarket.market).redeemRewards(msg.sender);
|
|
170
160
|
}
|
|
161
|
+
|
|
162
|
+
emit RemoveLiquiditySingleToken(
|
|
163
|
+
msg.sender,
|
|
164
|
+
fromMarket.market,
|
|
165
|
+
fromMarket.output.tokenOut,
|
|
166
|
+
msg.sender,
|
|
167
|
+
fromMarket.netLpToRemove,
|
|
168
|
+
netTokenOut
|
|
169
|
+
);
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
function _removeLiquiditySingleSy(RemoveLiquiditySingleSyStruct calldata fromMarket)
|
|
@@ -193,6 +192,14 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
193
192
|
if (fromMarket.doRedeemRewards) {
|
|
194
193
|
IPMarket(fromMarket.market).redeemRewards(msg.sender);
|
|
195
194
|
}
|
|
195
|
+
|
|
196
|
+
emit RemoveLiquiditySingleSy(
|
|
197
|
+
msg.sender,
|
|
198
|
+
fromMarket.market,
|
|
199
|
+
msg.sender,
|
|
200
|
+
fromMarket.netLpToRemove,
|
|
201
|
+
netSyOut
|
|
202
|
+
);
|
|
196
203
|
}
|
|
197
204
|
|
|
198
205
|
function _addLiquiditySingleToken(
|
|
@@ -218,6 +225,15 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
218
225
|
),
|
|
219
226
|
_newTokenInputStruct(tokenToZapIn, actualNetTokenIn, toMarket.bulk)
|
|
220
227
|
);
|
|
228
|
+
|
|
229
|
+
emit AddLiquiditySingleToken(
|
|
230
|
+
msg.sender,
|
|
231
|
+
toMarket.market,
|
|
232
|
+
tokenToZapIn,
|
|
233
|
+
msg.sender,
|
|
234
|
+
actualNetTokenIn,
|
|
235
|
+
netLpOut
|
|
236
|
+
);
|
|
221
237
|
}
|
|
222
238
|
|
|
223
239
|
function _addLiquiditySingleSy(
|
|
@@ -239,13 +255,21 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
239
255
|
actualNetSyIn
|
|
240
256
|
)
|
|
241
257
|
);
|
|
258
|
+
|
|
259
|
+
emit AddLiquiditySingleSy(
|
|
260
|
+
msg.sender,
|
|
261
|
+
toMarket.market,
|
|
262
|
+
msg.sender,
|
|
263
|
+
actualNetSyIn,
|
|
264
|
+
netLpOut
|
|
265
|
+
);
|
|
242
266
|
}
|
|
243
267
|
|
|
244
268
|
function _addLiquiditySingleTokenKeepYt(
|
|
245
269
|
AddLiquiditySingleTokenKeepYtStruct calldata toMarket,
|
|
246
270
|
address tokenToZapIn,
|
|
247
271
|
uint256 actualNetTokenIn
|
|
248
|
-
) internal returns (uint256 netLpOut, uint256
|
|
272
|
+
) internal returns (uint256 netLpOut, uint256 netYtOut) {
|
|
249
273
|
if (tokenToZapIn == NATIVE) {
|
|
250
274
|
tokenToZapIn = WETH;
|
|
251
275
|
_wrap_unwrap_ETH(NATIVE, WETH, actualNetTokenIn);
|
|
@@ -253,13 +277,23 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
253
277
|
|
|
254
278
|
_safeApproveInf(tokenToZapIn, address(ROUTER));
|
|
255
279
|
|
|
256
|
-
(netLpOut,
|
|
280
|
+
(netLpOut, netYtOut) = ROUTER.addLiquiditySingleTokenKeepYt(
|
|
257
281
|
msg.sender,
|
|
258
282
|
toMarket.market,
|
|
259
283
|
toMarket.minLpOut,
|
|
260
284
|
toMarket.minYtOut,
|
|
261
285
|
_newTokenInputStruct(tokenToZapIn, actualNetTokenIn, toMarket.bulk)
|
|
262
286
|
);
|
|
287
|
+
|
|
288
|
+
emit AddLiquiditySingleTokenKeepYt(
|
|
289
|
+
msg.sender,
|
|
290
|
+
toMarket.market,
|
|
291
|
+
tokenToZapIn,
|
|
292
|
+
msg.sender,
|
|
293
|
+
actualNetTokenIn,
|
|
294
|
+
netLpOut,
|
|
295
|
+
netYtOut
|
|
296
|
+
);
|
|
263
297
|
}
|
|
264
298
|
|
|
265
299
|
function _addLiquiditySingleSyKeepYt(
|
|
@@ -277,6 +311,15 @@ contract PendleRouterHelper is TokenHelper, IPLiquidityMigrator {
|
|
|
277
311
|
toMarket.minLpOut,
|
|
278
312
|
toMarket.minYtOut
|
|
279
313
|
);
|
|
314
|
+
|
|
315
|
+
emit AddLiquiditySingleSyKeepYt(
|
|
316
|
+
msg.sender,
|
|
317
|
+
toMarket.market,
|
|
318
|
+
msg.sender,
|
|
319
|
+
actualNetSyIn,
|
|
320
|
+
netLpOut,
|
|
321
|
+
netYtOut
|
|
322
|
+
);
|
|
280
323
|
}
|
|
281
324
|
|
|
282
325
|
// ============ struct helpers ============
|
|
@@ -193,10 +193,11 @@ abstract contract ActionBaseMintRedeem is TokenHelper {
|
|
|
193
193
|
if (netSyOut < minSyOut) revert Errors.RouterInsufficientSyOut(netSyOut, minSyOut);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
function _syOrBulk(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
function _syOrBulk(address SY, TokenOutput memory output)
|
|
197
|
+
internal
|
|
198
|
+
pure
|
|
199
|
+
returns (address addr)
|
|
200
|
+
{
|
|
200
201
|
return output.bulk != address(0) ? output.bulk : SY;
|
|
201
202
|
}
|
|
202
203
|
}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"router": "0xFC0F1237961A6ecEacAC86aD407e181Ecd5e673C",
|
|
23
23
|
"pendleSwap": "0xc6404511EF2C4C05A15446aF7D54FB63AFbe4d47",
|
|
24
24
|
"routerStatic": "0x483B13d42f3d72db7C449461289299C095143a05",
|
|
25
|
-
"routerHelper": "
|
|
25
|
+
"routerHelper": "0x2CbebCfAf4e08E153937d7f14FebfD30e038A433",
|
|
26
26
|
"vePendle": "0xB20E3c268C993BC3c9Bc1C1cc5D7491F2268cD91",
|
|
27
27
|
"senderEndpoint": "0x86bD575c36e236386284C035ffeBE66CB6ecd2DD",
|
|
28
28
|
"votingController": "0x40ea97a7E9A4A0520229d1bbdf4D82E36b1a5475",
|
package/package.json
CHANGED