@pendle/core-v2 5.8.0 → 5.8.1-paraswap
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/IPActionAddRemoveLiqV3.sol/IPActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSimple.sol/IPActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageV4.sol/IPActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTV3.sol/IPActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYTV3.sol/IPActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionAddRemoveLiqV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionMiscV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionStorageEvents.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapPTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapYTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPAllEventsV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.json +2 -2
- 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/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.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 +2 -2
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.json +2 -2
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.json +2 -2
- 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/PendleRouterV4.sol/PendleRouterV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.json +2 -2
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.dbg.json +1 -1
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.json +2 -2
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/IOKXDexRouter.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/OKXScaleHelper.sol/OKXScaleHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/ParaswapScaleHelper.sol/IGenericSwapExactAmountIn.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/ParaswapScaleHelper.sol/IGenericSwapExactAmountIn.json +81 -0
- package/build/artifacts/contracts/router/swap-aggregator/ParaswapScaleHelper.sol/ParaswapScaleHelper.dbg.json +4 -0
- package/build/artifacts/contracts/router/swap-aggregator/{OneInchScaleHelper.sol/OneInchScaleHelper.json → ParaswapScaleHelper.sol/ParaswapScaleHelper.json} +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IKyberScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.json +2 -2
- package/contracts/router/swap-aggregator/IPSwapAggregator.sol +1 -1
- package/contracts/router/swap-aggregator/ParaswapScaleHelper.sol +50 -0
- package/contracts/router/swap-aggregator/PendleSwap.sol +4 -4
- package/deployments/1-core.json +1 -1
- package/deployments/146-core.json +1 -1
- package/deployments/42161-core.json +1 -1
- package/deployments/5000-core.json +1 -1
- package/deployments/56-core.json +1 -1
- package/deployments/80094-core.json +1 -1
- package/deployments/8453-core.json +1 -1
- package/package.json +1 -1
- package/typechain-types/IGenericSwapExactAmountIn.ts +161 -0
- package/typechain-types/factories/ActionAddRemoveLiqV3__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/ActionMiscV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSimple__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageV4__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/IGenericSwapExactAmountIn__factory.ts +100 -0
- package/typechain-types/factories/PendleCommonPoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendlePoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendlePoolDeployHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterV4__factory.ts +1 -1
- package/typechain-types/factories/PendleSwap__factory.ts +1 -1
- package/typechain-types/factories/Reflector__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +9 -0
- package/typechain-types/index.ts +2 -0
- package/build/artifacts/contracts/router/swap-aggregator/OneInchScaleHelper.sol/I1inchAggregationRouterV6.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/OneInchScaleHelper.sol/I1inchAggregationRouterV6.json +0 -214
- package/build/artifacts/contracts/router/swap-aggregator/OneInchScaleHelper.sol/I1inchCommonType.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/OneInchScaleHelper.sol/I1inchCommonType.json +0 -10
- package/build/artifacts/contracts/router/swap-aggregator/OneInchScaleHelper.sol/OneInchScaleHelper.dbg.json +0 -4
- package/contracts/router/swap-aggregator/OneInchScaleHelper.sol +0 -120
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-artifact-1",
|
|
3
|
-
"contractName": "I1inchAggregationRouterV6",
|
|
4
|
-
"sourceName": "contracts/router/swap-aggregator/OneInchScaleHelper.sol",
|
|
5
|
-
"abi": [
|
|
6
|
-
{
|
|
7
|
-
"inputs": [
|
|
8
|
-
{
|
|
9
|
-
"internalType": "address",
|
|
10
|
-
"name": "executor",
|
|
11
|
-
"type": "address"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"components": [
|
|
15
|
-
{
|
|
16
|
-
"internalType": "contract IERC20",
|
|
17
|
-
"name": "srcToken",
|
|
18
|
-
"type": "address"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"internalType": "contract IERC20",
|
|
22
|
-
"name": "dstToken",
|
|
23
|
-
"type": "address"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"internalType": "address payable",
|
|
27
|
-
"name": "srcReceiver",
|
|
28
|
-
"type": "address"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"internalType": "address payable",
|
|
32
|
-
"name": "dstReceiver",
|
|
33
|
-
"type": "address"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"internalType": "uint256",
|
|
37
|
-
"name": "amount",
|
|
38
|
-
"type": "uint256"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"internalType": "uint256",
|
|
42
|
-
"name": "minReturnAmount",
|
|
43
|
-
"type": "uint256"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"internalType": "uint256",
|
|
47
|
-
"name": "flags",
|
|
48
|
-
"type": "uint256"
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
"internalType": "struct I1inchAggregationRouterV6.SwapDescription",
|
|
52
|
-
"name": "desc",
|
|
53
|
-
"type": "tuple"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"internalType": "bytes",
|
|
57
|
-
"name": "data",
|
|
58
|
-
"type": "bytes"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"name": "swap",
|
|
62
|
-
"outputs": [
|
|
63
|
-
{
|
|
64
|
-
"internalType": "uint256",
|
|
65
|
-
"name": "returnAmount",
|
|
66
|
-
"type": "uint256"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"internalType": "uint256",
|
|
70
|
-
"name": "spentAmount",
|
|
71
|
-
"type": "uint256"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
"stateMutability": "payable",
|
|
75
|
-
"type": "function"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"inputs": [
|
|
79
|
-
{
|
|
80
|
-
"internalType": "I1inchCommonType.Address256",
|
|
81
|
-
"name": "to",
|
|
82
|
-
"type": "uint256"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"internalType": "I1inchCommonType.Address256",
|
|
86
|
-
"name": "token",
|
|
87
|
-
"type": "uint256"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"internalType": "uint256",
|
|
91
|
-
"name": "amount",
|
|
92
|
-
"type": "uint256"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"internalType": "uint256",
|
|
96
|
-
"name": "minReturn",
|
|
97
|
-
"type": "uint256"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"internalType": "I1inchCommonType.Address256",
|
|
101
|
-
"name": "dex",
|
|
102
|
-
"type": "uint256"
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
"name": "unoswapTo",
|
|
106
|
-
"outputs": [
|
|
107
|
-
{
|
|
108
|
-
"internalType": "uint256",
|
|
109
|
-
"name": "returnAmount",
|
|
110
|
-
"type": "uint256"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
"stateMutability": "nonpayable",
|
|
114
|
-
"type": "function"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"inputs": [
|
|
118
|
-
{
|
|
119
|
-
"internalType": "I1inchCommonType.Address256",
|
|
120
|
-
"name": "to",
|
|
121
|
-
"type": "uint256"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"internalType": "I1inchCommonType.Address256",
|
|
125
|
-
"name": "token",
|
|
126
|
-
"type": "uint256"
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"internalType": "uint256",
|
|
130
|
-
"name": "amount",
|
|
131
|
-
"type": "uint256"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"internalType": "uint256",
|
|
135
|
-
"name": "minReturn",
|
|
136
|
-
"type": "uint256"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"internalType": "I1inchCommonType.Address256",
|
|
140
|
-
"name": "dex",
|
|
141
|
-
"type": "uint256"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"internalType": "I1inchCommonType.Address256",
|
|
145
|
-
"name": "dex2",
|
|
146
|
-
"type": "uint256"
|
|
147
|
-
}
|
|
148
|
-
],
|
|
149
|
-
"name": "unoswapTo2",
|
|
150
|
-
"outputs": [
|
|
151
|
-
{
|
|
152
|
-
"internalType": "uint256",
|
|
153
|
-
"name": "returnAmount",
|
|
154
|
-
"type": "uint256"
|
|
155
|
-
}
|
|
156
|
-
],
|
|
157
|
-
"stateMutability": "nonpayable",
|
|
158
|
-
"type": "function"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"inputs": [
|
|
162
|
-
{
|
|
163
|
-
"internalType": "I1inchCommonType.Address256",
|
|
164
|
-
"name": "to",
|
|
165
|
-
"type": "uint256"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"internalType": "I1inchCommonType.Address256",
|
|
169
|
-
"name": "token",
|
|
170
|
-
"type": "uint256"
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"internalType": "uint256",
|
|
174
|
-
"name": "amount",
|
|
175
|
-
"type": "uint256"
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"internalType": "uint256",
|
|
179
|
-
"name": "minReturn",
|
|
180
|
-
"type": "uint256"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"internalType": "I1inchCommonType.Address256",
|
|
184
|
-
"name": "dex",
|
|
185
|
-
"type": "uint256"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"internalType": "I1inchCommonType.Address256",
|
|
189
|
-
"name": "dex2",
|
|
190
|
-
"type": "uint256"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"internalType": "I1inchCommonType.Address256",
|
|
194
|
-
"name": "dex3",
|
|
195
|
-
"type": "uint256"
|
|
196
|
-
}
|
|
197
|
-
],
|
|
198
|
-
"name": "unoswapTo3",
|
|
199
|
-
"outputs": [
|
|
200
|
-
{
|
|
201
|
-
"internalType": "uint256",
|
|
202
|
-
"name": "returnAmount",
|
|
203
|
-
"type": "uint256"
|
|
204
|
-
}
|
|
205
|
-
],
|
|
206
|
-
"stateMutability": "nonpayable",
|
|
207
|
-
"type": "function"
|
|
208
|
-
}
|
|
209
|
-
],
|
|
210
|
-
"bytecode": "0x",
|
|
211
|
-
"deployedBytecode": "0x",
|
|
212
|
-
"linkReferences": {},
|
|
213
|
-
"deployedLinkReferences": {}
|
|
214
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-artifact-1",
|
|
3
|
-
"contractName": "I1inchCommonType",
|
|
4
|
-
"sourceName": "contracts/router/swap-aggregator/OneInchScaleHelper.sol",
|
|
5
|
-
"abi": [],
|
|
6
|
-
"bytecode": "0x",
|
|
7
|
-
"deployedBytecode": "0x",
|
|
8
|
-
"linkReferences": {},
|
|
9
|
-
"deployedLinkReferences": {}
|
|
10
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity ^0.8.17;
|
|
3
|
-
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
4
|
-
|
|
5
|
-
interface I1inchCommonType {
|
|
6
|
-
type Address256 is uint256;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
abstract contract OneInchScaleHelper is I1inchCommonType {
|
|
10
|
-
function _rescaleMinAmount(
|
|
11
|
-
uint256 minAmount,
|
|
12
|
-
uint256 oldAmount,
|
|
13
|
-
uint256 newAmount
|
|
14
|
-
) internal pure returns (uint256) {
|
|
15
|
-
return (minAmount * newAmount) / oldAmount;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _oneInchScaling(bytes calldata rawCallData, uint256 actualAmount) internal pure returns (bytes memory) {
|
|
19
|
-
bytes4 selector = bytes4(rawCallData[:4]);
|
|
20
|
-
bytes memory args = rawCallData[4:];
|
|
21
|
-
|
|
22
|
-
if (selector == I1inchAggregationRouterV6.unoswapTo.selector) {
|
|
23
|
-
(Address256 to, Address256 token, uint256 amount, uint256 minReturn, Address256 dex) = abi.decode(
|
|
24
|
-
args,
|
|
25
|
-
(Address256, Address256, uint256, uint256, Address256)
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
minReturn = (minReturn * actualAmount) / amount;
|
|
29
|
-
amount = actualAmount;
|
|
30
|
-
return abi.encodeWithSelector(selector, to, token, amount, minReturn, dex);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (selector == I1inchAggregationRouterV6.unoswapTo2.selector) {
|
|
34
|
-
(Address256 to, Address256 token, uint256 amount, uint256 minReturn, Address256 dex, Address256 dex2) = abi
|
|
35
|
-
.decode(args, (Address256, Address256, uint256, uint256, Address256, Address256));
|
|
36
|
-
|
|
37
|
-
minReturn = (minReturn * actualAmount) / amount;
|
|
38
|
-
amount = actualAmount;
|
|
39
|
-
|
|
40
|
-
return abi.encodeWithSelector(selector, to, token, amount, minReturn, dex, dex2);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (selector == I1inchAggregationRouterV6.unoswapTo3.selector) {
|
|
44
|
-
(
|
|
45
|
-
Address256 to,
|
|
46
|
-
Address256 token,
|
|
47
|
-
uint256 amount,
|
|
48
|
-
uint256 minReturn,
|
|
49
|
-
Address256 dex,
|
|
50
|
-
Address256 dex2,
|
|
51
|
-
Address256 dex3
|
|
52
|
-
) = abi.decode(args, (Address256, Address256, uint256, uint256, Address256, Address256, Address256));
|
|
53
|
-
|
|
54
|
-
minReturn = (minReturn * actualAmount) / amount;
|
|
55
|
-
amount = actualAmount;
|
|
56
|
-
|
|
57
|
-
return abi.encodeWithSelector(selector, to, token, amount, minReturn, dex, dex2, dex3);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (selector == I1inchAggregationRouterV6.swap.selector) {
|
|
61
|
-
(address executor, I1inchAggregationRouterV6.SwapDescription memory desc, bytes memory data) = abi.decode(
|
|
62
|
-
args,
|
|
63
|
-
(address, I1inchAggregationRouterV6.SwapDescription, bytes)
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
desc.minReturnAmount = (desc.minReturnAmount * actualAmount) / desc.amount;
|
|
67
|
-
desc.amount = actualAmount;
|
|
68
|
-
return abi.encodeWithSelector(selector, executor, desc, data);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
revert("1inch: unsupported selector");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
interface I1inchAggregationRouterV6 is I1inchCommonType {
|
|
76
|
-
struct SwapDescription {
|
|
77
|
-
IERC20 srcToken;
|
|
78
|
-
IERC20 dstToken;
|
|
79
|
-
address payable srcReceiver;
|
|
80
|
-
address payable dstReceiver;
|
|
81
|
-
uint256 amount;
|
|
82
|
-
uint256 minReturnAmount;
|
|
83
|
-
uint256 flags;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// we ignore the non-to version since it's guarantee this contract won't receive tokens
|
|
87
|
-
|
|
88
|
-
function unoswapTo(
|
|
89
|
-
Address256 to,
|
|
90
|
-
Address256 token,
|
|
91
|
-
uint256 amount,
|
|
92
|
-
uint256 minReturn,
|
|
93
|
-
Address256 dex
|
|
94
|
-
) external returns (uint256 returnAmount);
|
|
95
|
-
|
|
96
|
-
function unoswapTo2(
|
|
97
|
-
Address256 to,
|
|
98
|
-
Address256 token,
|
|
99
|
-
uint256 amount,
|
|
100
|
-
uint256 minReturn,
|
|
101
|
-
Address256 dex,
|
|
102
|
-
Address256 dex2
|
|
103
|
-
) external returns (uint256 returnAmount);
|
|
104
|
-
|
|
105
|
-
function unoswapTo3(
|
|
106
|
-
Address256 to,
|
|
107
|
-
Address256 token,
|
|
108
|
-
uint256 amount,
|
|
109
|
-
uint256 minReturn,
|
|
110
|
-
Address256 dex,
|
|
111
|
-
Address256 dex2,
|
|
112
|
-
Address256 dex3
|
|
113
|
-
) external returns (uint256 returnAmount);
|
|
114
|
-
|
|
115
|
-
function swap(
|
|
116
|
-
address executor,
|
|
117
|
-
SwapDescription calldata desc,
|
|
118
|
-
bytes calldata data
|
|
119
|
-
) external payable returns (uint256 returnAmount, uint256 spentAmount);
|
|
120
|
-
}
|