@swapkit/core 1.0.0-rc.170 → 1.0.0-rc.171
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/dist/index.js +2 -2
- package/dist/index.js.map +5 -30
- package/package.json +11 -9
- package/src/client.ts +72 -53
- package/src/helpers/explorerUrls.ts +2 -2
- package/src/aggregator/contracts/avaxGeneric.ts +0 -92
- package/src/aggregator/contracts/avaxWoofi.ts +0 -145
- package/src/aggregator/contracts/bscGeneric.ts +0 -106
- package/src/aggregator/contracts/ethGeneric.ts +0 -92
- package/src/aggregator/contracts/index.ts +0 -76
- package/src/aggregator/contracts/pancakeV2.ts +0 -145
- package/src/aggregator/contracts/pangolin.ts +0 -120
- package/src/aggregator/contracts/routers/index.ts +0 -58
- package/src/aggregator/contracts/routers/kyber.ts +0 -402
- package/src/aggregator/contracts/routers/oneinch.ts +0 -2188
- package/src/aggregator/contracts/routers/pancakeswap.ts +0 -340
- package/src/aggregator/contracts/routers/pangolin.ts +0 -340
- package/src/aggregator/contracts/routers/sushiswap.ts +0 -340
- package/src/aggregator/contracts/routers/traderJoe.ts +0 -340
- package/src/aggregator/contracts/routers/uniswapv2.ts +0 -340
- package/src/aggregator/contracts/routers/uniswapv3.ts +0 -254
- package/src/aggregator/contracts/routers/woofi.ts +0 -171
- package/src/aggregator/contracts/sushiswap.ts +0 -120
- package/src/aggregator/contracts/traderJoe.ts +0 -120
- package/src/aggregator/contracts/uniswapV2.ts +0 -120
- package/src/aggregator/contracts/uniswapV2Leg.ts +0 -128
- package/src/aggregator/contracts/uniswapV3_100.ts +0 -128
- package/src/aggregator/contracts/uniswapV3_10000.ts +0 -128
- package/src/aggregator/contracts/uniswapV3_3000.ts +0 -128
- package/src/aggregator/contracts/uniswapV3_500.ts +0 -128
- package/src/aggregator/getSwapParams.ts +0 -70
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
export const uniswapV3_100 = [
|
|
2
|
-
{
|
|
3
|
-
inputs: [
|
|
4
|
-
{ internalType: "address", name: "_ttp", type: "address" },
|
|
5
|
-
{ internalType: "address", name: "_weth", type: "address" },
|
|
6
|
-
{ internalType: "address", name: "_swapRouter", type: "address" },
|
|
7
|
-
{ internalType: "uint24", name: "_poolFee", type: "uint24" },
|
|
8
|
-
],
|
|
9
|
-
stateMutability: "nonpayable",
|
|
10
|
-
type: "constructor",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
anonymous: false,
|
|
14
|
-
inputs: [
|
|
15
|
-
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
16
|
-
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
17
|
-
],
|
|
18
|
-
name: "FeeSet",
|
|
19
|
-
type: "event",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
anonymous: false,
|
|
23
|
-
inputs: [
|
|
24
|
-
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
25
|
-
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
26
|
-
],
|
|
27
|
-
name: "OwnerSet",
|
|
28
|
-
type: "event",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
inputs: [],
|
|
32
|
-
name: "fee",
|
|
33
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
34
|
-
stateMutability: "view",
|
|
35
|
-
type: "function",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
inputs: [],
|
|
39
|
-
name: "feeRecipient",
|
|
40
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
41
|
-
stateMutability: "view",
|
|
42
|
-
type: "function",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
46
|
-
name: "owners",
|
|
47
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
48
|
-
stateMutability: "view",
|
|
49
|
-
type: "function",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
inputs: [],
|
|
53
|
-
name: "poolFee",
|
|
54
|
-
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
55
|
-
stateMutability: "view",
|
|
56
|
-
type: "function",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
inputs: [
|
|
60
|
-
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
61
|
-
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
62
|
-
],
|
|
63
|
-
name: "setFee",
|
|
64
|
-
outputs: [],
|
|
65
|
-
stateMutability: "nonpayable",
|
|
66
|
-
type: "function",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
inputs: [
|
|
70
|
-
{ internalType: "address", name: "owner", type: "address" },
|
|
71
|
-
{ internalType: "bool", name: "active", type: "bool" },
|
|
72
|
-
],
|
|
73
|
-
name: "setOwner",
|
|
74
|
-
outputs: [],
|
|
75
|
-
stateMutability: "nonpayable",
|
|
76
|
-
type: "function",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
inputs: [
|
|
80
|
-
{ internalType: "address", name: "tcRouter", type: "address" },
|
|
81
|
-
{ internalType: "address", name: "tcVault", type: "address" },
|
|
82
|
-
{ internalType: "string", name: "tcMemo", type: "string" },
|
|
83
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
84
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
85
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
86
|
-
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
87
|
-
],
|
|
88
|
-
name: "swapIn",
|
|
89
|
-
outputs: [],
|
|
90
|
-
stateMutability: "nonpayable",
|
|
91
|
-
type: "function",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
inputs: [
|
|
95
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
96
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
97
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
98
|
-
],
|
|
99
|
-
name: "swapOut",
|
|
100
|
-
outputs: [],
|
|
101
|
-
stateMutability: "payable",
|
|
102
|
-
type: "function",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
inputs: [],
|
|
106
|
-
name: "swapRouter",
|
|
107
|
-
outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
|
|
108
|
-
stateMutability: "view",
|
|
109
|
-
type: "function",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
inputs: [],
|
|
113
|
-
name: "tokenTransferProxy",
|
|
114
|
-
outputs: [
|
|
115
|
-
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
116
|
-
],
|
|
117
|
-
stateMutability: "view",
|
|
118
|
-
type: "function",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
inputs: [],
|
|
122
|
-
name: "weth",
|
|
123
|
-
outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
type: "function",
|
|
126
|
-
},
|
|
127
|
-
{ stateMutability: "payable", type: "receive" },
|
|
128
|
-
];
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
export const uniswapV3_10000 = [
|
|
2
|
-
{
|
|
3
|
-
inputs: [
|
|
4
|
-
{ internalType: "address", name: "_ttp", type: "address" },
|
|
5
|
-
{ internalType: "address", name: "_weth", type: "address" },
|
|
6
|
-
{ internalType: "address", name: "_swapRouter", type: "address" },
|
|
7
|
-
{ internalType: "uint24", name: "_poolFee", type: "uint24" },
|
|
8
|
-
],
|
|
9
|
-
stateMutability: "nonpayable",
|
|
10
|
-
type: "constructor",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
anonymous: false,
|
|
14
|
-
inputs: [
|
|
15
|
-
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
16
|
-
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
17
|
-
],
|
|
18
|
-
name: "FeeSet",
|
|
19
|
-
type: "event",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
anonymous: false,
|
|
23
|
-
inputs: [
|
|
24
|
-
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
25
|
-
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
26
|
-
],
|
|
27
|
-
name: "OwnerSet",
|
|
28
|
-
type: "event",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
inputs: [],
|
|
32
|
-
name: "fee",
|
|
33
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
34
|
-
stateMutability: "view",
|
|
35
|
-
type: "function",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
inputs: [],
|
|
39
|
-
name: "feeRecipient",
|
|
40
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
41
|
-
stateMutability: "view",
|
|
42
|
-
type: "function",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
46
|
-
name: "owners",
|
|
47
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
48
|
-
stateMutability: "view",
|
|
49
|
-
type: "function",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
inputs: [],
|
|
53
|
-
name: "poolFee",
|
|
54
|
-
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
55
|
-
stateMutability: "view",
|
|
56
|
-
type: "function",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
inputs: [
|
|
60
|
-
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
61
|
-
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
62
|
-
],
|
|
63
|
-
name: "setFee",
|
|
64
|
-
outputs: [],
|
|
65
|
-
stateMutability: "nonpayable",
|
|
66
|
-
type: "function",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
inputs: [
|
|
70
|
-
{ internalType: "address", name: "owner", type: "address" },
|
|
71
|
-
{ internalType: "bool", name: "active", type: "bool" },
|
|
72
|
-
],
|
|
73
|
-
name: "setOwner",
|
|
74
|
-
outputs: [],
|
|
75
|
-
stateMutability: "nonpayable",
|
|
76
|
-
type: "function",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
inputs: [
|
|
80
|
-
{ internalType: "address", name: "tcRouter", type: "address" },
|
|
81
|
-
{ internalType: "address", name: "tcVault", type: "address" },
|
|
82
|
-
{ internalType: "string", name: "tcMemo", type: "string" },
|
|
83
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
84
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
85
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
86
|
-
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
87
|
-
],
|
|
88
|
-
name: "swapIn",
|
|
89
|
-
outputs: [],
|
|
90
|
-
stateMutability: "nonpayable",
|
|
91
|
-
type: "function",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
inputs: [
|
|
95
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
96
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
97
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
98
|
-
],
|
|
99
|
-
name: "swapOut",
|
|
100
|
-
outputs: [],
|
|
101
|
-
stateMutability: "payable",
|
|
102
|
-
type: "function",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
inputs: [],
|
|
106
|
-
name: "swapRouter",
|
|
107
|
-
outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
|
|
108
|
-
stateMutability: "view",
|
|
109
|
-
type: "function",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
inputs: [],
|
|
113
|
-
name: "tokenTransferProxy",
|
|
114
|
-
outputs: [
|
|
115
|
-
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
116
|
-
],
|
|
117
|
-
stateMutability: "view",
|
|
118
|
-
type: "function",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
inputs: [],
|
|
122
|
-
name: "weth",
|
|
123
|
-
outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
type: "function",
|
|
126
|
-
},
|
|
127
|
-
{ stateMutability: "payable", type: "receive" },
|
|
128
|
-
];
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
export const uniswapV3_3000 = [
|
|
2
|
-
{
|
|
3
|
-
inputs: [
|
|
4
|
-
{ internalType: "address", name: "_ttp", type: "address" },
|
|
5
|
-
{ internalType: "address", name: "_weth", type: "address" },
|
|
6
|
-
{ internalType: "address", name: "_swapRouter", type: "address" },
|
|
7
|
-
{ internalType: "uint24", name: "_poolFee", type: "uint24" },
|
|
8
|
-
],
|
|
9
|
-
stateMutability: "nonpayable",
|
|
10
|
-
type: "constructor",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
anonymous: false,
|
|
14
|
-
inputs: [
|
|
15
|
-
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
16
|
-
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
17
|
-
],
|
|
18
|
-
name: "FeeSet",
|
|
19
|
-
type: "event",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
anonymous: false,
|
|
23
|
-
inputs: [
|
|
24
|
-
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
25
|
-
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
26
|
-
],
|
|
27
|
-
name: "OwnerSet",
|
|
28
|
-
type: "event",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
inputs: [],
|
|
32
|
-
name: "fee",
|
|
33
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
34
|
-
stateMutability: "view",
|
|
35
|
-
type: "function",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
inputs: [],
|
|
39
|
-
name: "feeRecipient",
|
|
40
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
41
|
-
stateMutability: "view",
|
|
42
|
-
type: "function",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
46
|
-
name: "owners",
|
|
47
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
48
|
-
stateMutability: "view",
|
|
49
|
-
type: "function",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
inputs: [],
|
|
53
|
-
name: "poolFee",
|
|
54
|
-
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
55
|
-
stateMutability: "view",
|
|
56
|
-
type: "function",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
inputs: [
|
|
60
|
-
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
61
|
-
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
62
|
-
],
|
|
63
|
-
name: "setFee",
|
|
64
|
-
outputs: [],
|
|
65
|
-
stateMutability: "nonpayable",
|
|
66
|
-
type: "function",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
inputs: [
|
|
70
|
-
{ internalType: "address", name: "owner", type: "address" },
|
|
71
|
-
{ internalType: "bool", name: "active", type: "bool" },
|
|
72
|
-
],
|
|
73
|
-
name: "setOwner",
|
|
74
|
-
outputs: [],
|
|
75
|
-
stateMutability: "nonpayable",
|
|
76
|
-
type: "function",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
inputs: [
|
|
80
|
-
{ internalType: "address", name: "tcRouter", type: "address" },
|
|
81
|
-
{ internalType: "address", name: "tcVault", type: "address" },
|
|
82
|
-
{ internalType: "string", name: "tcMemo", type: "string" },
|
|
83
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
84
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
85
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
86
|
-
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
87
|
-
],
|
|
88
|
-
name: "swapIn",
|
|
89
|
-
outputs: [],
|
|
90
|
-
stateMutability: "nonpayable",
|
|
91
|
-
type: "function",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
inputs: [
|
|
95
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
96
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
97
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
98
|
-
],
|
|
99
|
-
name: "swapOut",
|
|
100
|
-
outputs: [],
|
|
101
|
-
stateMutability: "payable",
|
|
102
|
-
type: "function",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
inputs: [],
|
|
106
|
-
name: "swapRouter",
|
|
107
|
-
outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
|
|
108
|
-
stateMutability: "view",
|
|
109
|
-
type: "function",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
inputs: [],
|
|
113
|
-
name: "tokenTransferProxy",
|
|
114
|
-
outputs: [
|
|
115
|
-
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
116
|
-
],
|
|
117
|
-
stateMutability: "view",
|
|
118
|
-
type: "function",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
inputs: [],
|
|
122
|
-
name: "weth",
|
|
123
|
-
outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
type: "function",
|
|
126
|
-
},
|
|
127
|
-
{ stateMutability: "payable", type: "receive" },
|
|
128
|
-
];
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
export const uniswapV3_500 = [
|
|
2
|
-
{
|
|
3
|
-
inputs: [
|
|
4
|
-
{ internalType: "address", name: "_ttp", type: "address" },
|
|
5
|
-
{ internalType: "address", name: "_weth", type: "address" },
|
|
6
|
-
{ internalType: "address", name: "_swapRouter", type: "address" },
|
|
7
|
-
{ internalType: "uint24", name: "_poolFee", type: "uint24" },
|
|
8
|
-
],
|
|
9
|
-
stateMutability: "nonpayable",
|
|
10
|
-
type: "constructor",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
anonymous: false,
|
|
14
|
-
inputs: [
|
|
15
|
-
{ indexed: false, internalType: "uint256", name: "fee", type: "uint256" },
|
|
16
|
-
{ indexed: false, internalType: "address", name: "feeRecipient", type: "address" },
|
|
17
|
-
],
|
|
18
|
-
name: "FeeSet",
|
|
19
|
-
type: "event",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
anonymous: false,
|
|
23
|
-
inputs: [
|
|
24
|
-
{ indexed: true, internalType: "address", name: "owner", type: "address" },
|
|
25
|
-
{ indexed: false, internalType: "bool", name: "active", type: "bool" },
|
|
26
|
-
],
|
|
27
|
-
name: "OwnerSet",
|
|
28
|
-
type: "event",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
inputs: [],
|
|
32
|
-
name: "fee",
|
|
33
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
34
|
-
stateMutability: "view",
|
|
35
|
-
type: "function",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
inputs: [],
|
|
39
|
-
name: "feeRecipient",
|
|
40
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
41
|
-
stateMutability: "view",
|
|
42
|
-
type: "function",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
46
|
-
name: "owners",
|
|
47
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
48
|
-
stateMutability: "view",
|
|
49
|
-
type: "function",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
inputs: [],
|
|
53
|
-
name: "poolFee",
|
|
54
|
-
outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
|
|
55
|
-
stateMutability: "view",
|
|
56
|
-
type: "function",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
inputs: [
|
|
60
|
-
{ internalType: "uint256", name: "_fee", type: "uint256" },
|
|
61
|
-
{ internalType: "address", name: "_feeRecipient", type: "address" },
|
|
62
|
-
],
|
|
63
|
-
name: "setFee",
|
|
64
|
-
outputs: [],
|
|
65
|
-
stateMutability: "nonpayable",
|
|
66
|
-
type: "function",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
inputs: [
|
|
70
|
-
{ internalType: "address", name: "owner", type: "address" },
|
|
71
|
-
{ internalType: "bool", name: "active", type: "bool" },
|
|
72
|
-
],
|
|
73
|
-
name: "setOwner",
|
|
74
|
-
outputs: [],
|
|
75
|
-
stateMutability: "nonpayable",
|
|
76
|
-
type: "function",
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
inputs: [
|
|
80
|
-
{ internalType: "address", name: "tcRouter", type: "address" },
|
|
81
|
-
{ internalType: "address", name: "tcVault", type: "address" },
|
|
82
|
-
{ internalType: "string", name: "tcMemo", type: "string" },
|
|
83
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
84
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
85
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
86
|
-
{ internalType: "uint256", name: "deadline", type: "uint256" },
|
|
87
|
-
],
|
|
88
|
-
name: "swapIn",
|
|
89
|
-
outputs: [],
|
|
90
|
-
stateMutability: "nonpayable",
|
|
91
|
-
type: "function",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
inputs: [
|
|
95
|
-
{ internalType: "address", name: "token", type: "address" },
|
|
96
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
97
|
-
{ internalType: "uint256", name: "amountOutMin", type: "uint256" },
|
|
98
|
-
],
|
|
99
|
-
name: "swapOut",
|
|
100
|
-
outputs: [],
|
|
101
|
-
stateMutability: "payable",
|
|
102
|
-
type: "function",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
inputs: [],
|
|
106
|
-
name: "swapRouter",
|
|
107
|
-
outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
|
|
108
|
-
stateMutability: "view",
|
|
109
|
-
type: "function",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
inputs: [],
|
|
113
|
-
name: "tokenTransferProxy",
|
|
114
|
-
outputs: [
|
|
115
|
-
{ internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" },
|
|
116
|
-
],
|
|
117
|
-
stateMutability: "view",
|
|
118
|
-
type: "function",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
inputs: [],
|
|
122
|
-
name: "weth",
|
|
123
|
-
outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
|
|
124
|
-
stateMutability: "view",
|
|
125
|
-
type: "function",
|
|
126
|
-
},
|
|
127
|
-
{ stateMutability: "payable", type: "receive" },
|
|
128
|
-
];
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { QuoteRoute } from "@swapkit/api";
|
|
2
|
-
|
|
3
|
-
import type { AGG_CONTRACT_ADDRESS } from "./contracts/index.ts";
|
|
4
|
-
import { lowercasedGenericAbiMappings } from "./contracts/index.ts";
|
|
5
|
-
|
|
6
|
-
type SwapInParams = {
|
|
7
|
-
calldata: QuoteRoute["calldata"];
|
|
8
|
-
recipient: string;
|
|
9
|
-
streamSwap?: boolean;
|
|
10
|
-
contractAddress: AGG_CONTRACT_ADDRESS;
|
|
11
|
-
toChecksumAddress: (address: string) => string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const getSwapInParams = ({
|
|
15
|
-
streamSwap,
|
|
16
|
-
contractAddress,
|
|
17
|
-
recipient,
|
|
18
|
-
toChecksumAddress,
|
|
19
|
-
calldata: {
|
|
20
|
-
amount,
|
|
21
|
-
amountOutMin = "",
|
|
22
|
-
data = "",
|
|
23
|
-
deadline,
|
|
24
|
-
memo,
|
|
25
|
-
router,
|
|
26
|
-
memoStreamingSwap,
|
|
27
|
-
tcMemo,
|
|
28
|
-
tcRouter,
|
|
29
|
-
tcVault,
|
|
30
|
-
vault,
|
|
31
|
-
token,
|
|
32
|
-
},
|
|
33
|
-
}: SwapInParams) => {
|
|
34
|
-
const isGeneric = !!lowercasedGenericAbiMappings[contractAddress.toLowerCase()];
|
|
35
|
-
|
|
36
|
-
if (isGeneric && !router) {
|
|
37
|
-
throw new Error("Router is required on calldata for swapIn with GenericContract");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Data structure for contract calls
|
|
42
|
-
* GENERIC: tcRouter, tcVault, tcMemo, token, amount, router, data, deadline
|
|
43
|
-
* ETH_UNISWAP: tcRouter, tcVault, tcMemo, token, amount, amountOutMin, deadline
|
|
44
|
-
* AVAX_PANGOLIN: tcRouter, tcVault, tcMemo, token, amount, amountOutMin, deadline
|
|
45
|
-
* AVAX_WOOFI: router, vault, memo, token, amount, amountOutMin, deadline
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
const baseMemo = tcMemo || memo;
|
|
49
|
-
const transactionMemo = streamSwap ? memoStreamingSwap || baseMemo : baseMemo;
|
|
50
|
-
|
|
51
|
-
if (!(tcVault || vault)) throw new Error("TC Vault is required on calldata");
|
|
52
|
-
if (!(tcRouter || router)) throw new Error("TC Router is required on calldata");
|
|
53
|
-
if (!transactionMemo) throw new Error("TC Memo is required on calldata");
|
|
54
|
-
if (!token) throw new Error("Token is required on calldata");
|
|
55
|
-
|
|
56
|
-
const baseParams = [
|
|
57
|
-
// v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
|
|
58
|
-
toChecksumAddress((tcRouter || router) as string),
|
|
59
|
-
toChecksumAddress((tcVault || vault) as string),
|
|
60
|
-
transactionMemo.replace("{recipientAddress}", recipient),
|
|
61
|
-
toChecksumAddress(token),
|
|
62
|
-
amount,
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
const contractParams = isGeneric
|
|
66
|
-
? [toChecksumAddress(router as string), data, deadline]
|
|
67
|
-
: [amountOutMin, deadline];
|
|
68
|
-
|
|
69
|
-
return [...baseParams, ...contractParams];
|
|
70
|
-
};
|