@dolomite-exchange/zap-sdk 0.3.21 → 0.3.23
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/src/lib/Constants.js +220 -170
- package/dist/src/lib/Constants.js.map +1 -1
- package/package.json +4 -3
- package/src/DolomiteZap.ts +940 -0
- package/src/abis/IArbitrumGasInfo.json +198 -0
- package/src/abis/IDolomiteMarginExchangeWrapper.json +80 -0
- package/src/abis/IERC20.json +185 -0
- package/src/abis/IGmxV2DataStore.json +101 -0
- package/src/abis/IGmxV2Reader.json +3487 -0
- package/src/abis/IIsolationModeFactory.json +902 -0
- package/src/abis/types/IArbitrumGasInfo.ts +299 -0
- package/src/abis/types/IERC20.ts +269 -0
- package/src/abis/types/IGmxV2DataStore.ts +170 -0
- package/src/abis/types/IGmxV2Reader.ts +825 -0
- package/src/clients/AggregatorClient.ts +22 -0
- package/src/clients/DolomiteClient.ts +301 -0
- package/src/clients/IsolationModeClient.ts +75 -0
- package/src/clients/OdosAggregator.ts +107 -0
- package/src/clients/OogaBoogaAggregator.ts +76 -0
- package/src/clients/ParaswapAggregator.ts +135 -0
- package/src/index.ts +29 -0
- package/src/lib/ApiTypes.ts +241 -0
- package/src/lib/Constants.ts +1441 -0
- package/src/lib/Environment.ts +1 -0
- package/src/lib/GraphqlPageable.ts +23 -0
- package/src/lib/LocalCache.ts +34 -0
- package/src/lib/Logger.ts +59 -0
- package/src/lib/MathUtils.ts +13 -0
- package/src/lib/Utils.ts +52 -0
- package/src/lib/estimators/GmxV2GmEstimator.ts +349 -0
- package/src/lib/estimators/PendlePtEstimatorV3.ts +321 -0
- package/src/lib/estimators/PendleYtEstimatorV3.ts +77 -0
- package/src/lib/estimators/SimpleEstimator.ts +16 -0
- package/src/lib/estimators/StandardEstimator.ts +137 -0
- package/src/lib/graphql-types.ts +19 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [],
|
|
4
|
+
"name": "getCurrentTxL1GasFees",
|
|
5
|
+
"outputs": [
|
|
6
|
+
{
|
|
7
|
+
"internalType": "uint256",
|
|
8
|
+
"name": "",
|
|
9
|
+
"type": "uint256"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"stateMutability": "view",
|
|
13
|
+
"type": "function"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"inputs": [],
|
|
17
|
+
"name": "getGasAccountingParams",
|
|
18
|
+
"outputs": [
|
|
19
|
+
{
|
|
20
|
+
"internalType": "uint256",
|
|
21
|
+
"name": "",
|
|
22
|
+
"type": "uint256"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"internalType": "uint256",
|
|
26
|
+
"name": "",
|
|
27
|
+
"type": "uint256"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"internalType": "uint256",
|
|
31
|
+
"name": "",
|
|
32
|
+
"type": "uint256"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"stateMutability": "view",
|
|
36
|
+
"type": "function"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"inputs": [],
|
|
40
|
+
"name": "getL1GasPriceEstimate",
|
|
41
|
+
"outputs": [
|
|
42
|
+
{
|
|
43
|
+
"internalType": "uint256",
|
|
44
|
+
"name": "",
|
|
45
|
+
"type": "uint256"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"stateMutability": "view",
|
|
49
|
+
"type": "function"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"inputs": [],
|
|
53
|
+
"name": "getPricesInArbGas",
|
|
54
|
+
"outputs": [
|
|
55
|
+
{
|
|
56
|
+
"internalType": "uint256",
|
|
57
|
+
"name": "",
|
|
58
|
+
"type": "uint256"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"internalType": "uint256",
|
|
62
|
+
"name": "",
|
|
63
|
+
"type": "uint256"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"internalType": "uint256",
|
|
67
|
+
"name": "",
|
|
68
|
+
"type": "uint256"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"stateMutability": "view",
|
|
72
|
+
"type": "function"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"inputs": [
|
|
76
|
+
{
|
|
77
|
+
"internalType": "address",
|
|
78
|
+
"name": "aggregator",
|
|
79
|
+
"type": "address"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"name": "getPricesInArbGasWithAggregator",
|
|
83
|
+
"outputs": [
|
|
84
|
+
{
|
|
85
|
+
"internalType": "uint256",
|
|
86
|
+
"name": "",
|
|
87
|
+
"type": "uint256"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"internalType": "uint256",
|
|
91
|
+
"name": "",
|
|
92
|
+
"type": "uint256"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"internalType": "uint256",
|
|
96
|
+
"name": "",
|
|
97
|
+
"type": "uint256"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"stateMutability": "view",
|
|
101
|
+
"type": "function"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"inputs": [],
|
|
105
|
+
"name": "getPricesInWei",
|
|
106
|
+
"outputs": [
|
|
107
|
+
{
|
|
108
|
+
"internalType": "uint256",
|
|
109
|
+
"name": "",
|
|
110
|
+
"type": "uint256"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"internalType": "uint256",
|
|
114
|
+
"name": "",
|
|
115
|
+
"type": "uint256"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"internalType": "uint256",
|
|
119
|
+
"name": "",
|
|
120
|
+
"type": "uint256"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"internalType": "uint256",
|
|
124
|
+
"name": "",
|
|
125
|
+
"type": "uint256"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"internalType": "uint256",
|
|
129
|
+
"name": "",
|
|
130
|
+
"type": "uint256"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"internalType": "uint256",
|
|
134
|
+
"name": "",
|
|
135
|
+
"type": "uint256"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"stateMutability": "view",
|
|
139
|
+
"type": "function"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"inputs": [
|
|
143
|
+
{
|
|
144
|
+
"internalType": "address",
|
|
145
|
+
"name": "aggregator",
|
|
146
|
+
"type": "address"
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"name": "getPricesInWeiWithAggregator",
|
|
150
|
+
"outputs": [
|
|
151
|
+
{
|
|
152
|
+
"internalType": "uint256",
|
|
153
|
+
"name": "",
|
|
154
|
+
"type": "uint256"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"internalType": "uint256",
|
|
158
|
+
"name": "",
|
|
159
|
+
"type": "uint256"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"internalType": "uint256",
|
|
163
|
+
"name": "",
|
|
164
|
+
"type": "uint256"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"internalType": "uint256",
|
|
168
|
+
"name": "",
|
|
169
|
+
"type": "uint256"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"internalType": "uint256",
|
|
173
|
+
"name": "",
|
|
174
|
+
"type": "uint256"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"internalType": "uint256",
|
|
178
|
+
"name": "",
|
|
179
|
+
"type": "uint256"
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"stateMutability": "view",
|
|
183
|
+
"type": "function"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"inputs": [
|
|
187
|
+
{
|
|
188
|
+
"internalType": "uint256",
|
|
189
|
+
"name": "priceInWei",
|
|
190
|
+
"type": "uint256"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"name": "setL1GasPriceEstimate",
|
|
194
|
+
"outputs": [],
|
|
195
|
+
"stateMutability": "nonpayable",
|
|
196
|
+
"type": "function"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "address",
|
|
6
|
+
"name": "_tradeOriginator",
|
|
7
|
+
"type": "address"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"internalType": "address",
|
|
11
|
+
"name": "_receiver",
|
|
12
|
+
"type": "address"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"internalType": "address",
|
|
16
|
+
"name": "_outputToken",
|
|
17
|
+
"type": "address"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"internalType": "address",
|
|
21
|
+
"name": "_inputToken",
|
|
22
|
+
"type": "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"internalType": "uint256",
|
|
26
|
+
"name": "_inputAmount",
|
|
27
|
+
"type": "uint256"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"internalType": "bytes",
|
|
31
|
+
"name": "_orderData",
|
|
32
|
+
"type": "bytes"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"name": "exchange",
|
|
36
|
+
"outputs": [
|
|
37
|
+
{
|
|
38
|
+
"internalType": "uint256",
|
|
39
|
+
"name": "",
|
|
40
|
+
"type": "uint256"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"stateMutability": "nonpayable",
|
|
44
|
+
"type": "function"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"inputs": [
|
|
48
|
+
{
|
|
49
|
+
"internalType": "address",
|
|
50
|
+
"name": "_inputToken",
|
|
51
|
+
"type": "address"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"internalType": "address",
|
|
55
|
+
"name": "_outputToken",
|
|
56
|
+
"type": "address"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"internalType": "uint256",
|
|
60
|
+
"name": "_desiredInputAmount",
|
|
61
|
+
"type": "uint256"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"internalType": "bytes",
|
|
65
|
+
"name": "_orderData",
|
|
66
|
+
"type": "bytes"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"name": "getExchangeCost",
|
|
70
|
+
"outputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "uint256",
|
|
73
|
+
"name": "",
|
|
74
|
+
"type": "uint256"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"stateMutability": "view",
|
|
78
|
+
"type": "function"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"anonymous": false,
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"indexed": true,
|
|
7
|
+
"internalType": "address",
|
|
8
|
+
"name": "owner",
|
|
9
|
+
"type": "address"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"indexed": true,
|
|
13
|
+
"internalType": "address",
|
|
14
|
+
"name": "spender",
|
|
15
|
+
"type": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"indexed": false,
|
|
19
|
+
"internalType": "uint256",
|
|
20
|
+
"name": "value",
|
|
21
|
+
"type": "uint256"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"name": "Approval",
|
|
25
|
+
"type": "event"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"anonymous": false,
|
|
29
|
+
"inputs": [
|
|
30
|
+
{
|
|
31
|
+
"indexed": true,
|
|
32
|
+
"internalType": "address",
|
|
33
|
+
"name": "from",
|
|
34
|
+
"type": "address"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"indexed": true,
|
|
38
|
+
"internalType": "address",
|
|
39
|
+
"name": "to",
|
|
40
|
+
"type": "address"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"indexed": false,
|
|
44
|
+
"internalType": "uint256",
|
|
45
|
+
"name": "value",
|
|
46
|
+
"type": "uint256"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"name": "Transfer",
|
|
50
|
+
"type": "event"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"inputs": [
|
|
54
|
+
{
|
|
55
|
+
"internalType": "address",
|
|
56
|
+
"name": "owner",
|
|
57
|
+
"type": "address"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"internalType": "address",
|
|
61
|
+
"name": "spender",
|
|
62
|
+
"type": "address"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"name": "allowance",
|
|
66
|
+
"outputs": [
|
|
67
|
+
{
|
|
68
|
+
"internalType": "uint256",
|
|
69
|
+
"name": "",
|
|
70
|
+
"type": "uint256"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"stateMutability": "view",
|
|
74
|
+
"type": "function"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"inputs": [
|
|
78
|
+
{
|
|
79
|
+
"internalType": "address",
|
|
80
|
+
"name": "spender",
|
|
81
|
+
"type": "address"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"internalType": "uint256",
|
|
85
|
+
"name": "amount",
|
|
86
|
+
"type": "uint256"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"name": "approve",
|
|
90
|
+
"outputs": [
|
|
91
|
+
{
|
|
92
|
+
"internalType": "bool",
|
|
93
|
+
"name": "",
|
|
94
|
+
"type": "bool"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"stateMutability": "nonpayable",
|
|
98
|
+
"type": "function"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [
|
|
102
|
+
{
|
|
103
|
+
"internalType": "address",
|
|
104
|
+
"name": "account",
|
|
105
|
+
"type": "address"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "balanceOf",
|
|
109
|
+
"outputs": [
|
|
110
|
+
{
|
|
111
|
+
"internalType": "uint256",
|
|
112
|
+
"name": "",
|
|
113
|
+
"type": "uint256"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"stateMutability": "view",
|
|
117
|
+
"type": "function"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"inputs": [],
|
|
121
|
+
"name": "totalSupply",
|
|
122
|
+
"outputs": [
|
|
123
|
+
{
|
|
124
|
+
"internalType": "uint256",
|
|
125
|
+
"name": "",
|
|
126
|
+
"type": "uint256"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"stateMutability": "view",
|
|
130
|
+
"type": "function"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"inputs": [
|
|
134
|
+
{
|
|
135
|
+
"internalType": "address",
|
|
136
|
+
"name": "to",
|
|
137
|
+
"type": "address"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"internalType": "uint256",
|
|
141
|
+
"name": "amount",
|
|
142
|
+
"type": "uint256"
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"name": "transfer",
|
|
146
|
+
"outputs": [
|
|
147
|
+
{
|
|
148
|
+
"internalType": "bool",
|
|
149
|
+
"name": "",
|
|
150
|
+
"type": "bool"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"stateMutability": "nonpayable",
|
|
154
|
+
"type": "function"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"inputs": [
|
|
158
|
+
{
|
|
159
|
+
"internalType": "address",
|
|
160
|
+
"name": "from",
|
|
161
|
+
"type": "address"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"internalType": "address",
|
|
165
|
+
"name": "to",
|
|
166
|
+
"type": "address"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"internalType": "uint256",
|
|
170
|
+
"name": "amount",
|
|
171
|
+
"type": "uint256"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"name": "transferFrom",
|
|
175
|
+
"outputs": [
|
|
176
|
+
{
|
|
177
|
+
"internalType": "bool",
|
|
178
|
+
"name": "",
|
|
179
|
+
"type": "bool"
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"stateMutability": "nonpayable",
|
|
183
|
+
"type": "function"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "bytes32",
|
|
6
|
+
"name": "_key",
|
|
7
|
+
"type": "bytes32"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"name": "getBool",
|
|
11
|
+
"outputs": [
|
|
12
|
+
{
|
|
13
|
+
"internalType": "bool",
|
|
14
|
+
"name": "",
|
|
15
|
+
"type": "bool"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"stateMutability": "view",
|
|
19
|
+
"type": "function"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"inputs": [
|
|
23
|
+
{
|
|
24
|
+
"internalType": "bytes32",
|
|
25
|
+
"name": "_key",
|
|
26
|
+
"type": "bytes32"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"name": "getUint",
|
|
30
|
+
"outputs": [
|
|
31
|
+
{
|
|
32
|
+
"internalType": "uint256",
|
|
33
|
+
"name": "",
|
|
34
|
+
"type": "uint256"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"stateMutability": "view",
|
|
38
|
+
"type": "function"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"inputs": [],
|
|
42
|
+
"name": "roleStore",
|
|
43
|
+
"outputs": [
|
|
44
|
+
{
|
|
45
|
+
"internalType": "contract IGmxRoleStore",
|
|
46
|
+
"name": "",
|
|
47
|
+
"type": "address"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"stateMutability": "view",
|
|
51
|
+
"type": "function"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"inputs": [
|
|
55
|
+
{
|
|
56
|
+
"internalType": "bytes32",
|
|
57
|
+
"name": "_key",
|
|
58
|
+
"type": "bytes32"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"internalType": "bool",
|
|
62
|
+
"name": "_bool",
|
|
63
|
+
"type": "bool"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"name": "setBool",
|
|
67
|
+
"outputs": [
|
|
68
|
+
{
|
|
69
|
+
"internalType": "bool",
|
|
70
|
+
"name": "",
|
|
71
|
+
"type": "bool"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"stateMutability": "nonpayable",
|
|
75
|
+
"type": "function"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"inputs": [
|
|
79
|
+
{
|
|
80
|
+
"internalType": "bytes32",
|
|
81
|
+
"name": "_key",
|
|
82
|
+
"type": "bytes32"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"internalType": "uint256",
|
|
86
|
+
"name": "_value",
|
|
87
|
+
"type": "uint256"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"name": "setUint",
|
|
91
|
+
"outputs": [
|
|
92
|
+
{
|
|
93
|
+
"internalType": "uint256",
|
|
94
|
+
"name": "",
|
|
95
|
+
"type": "uint256"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"stateMutability": "nonpayable",
|
|
99
|
+
"type": "function"
|
|
100
|
+
}
|
|
101
|
+
]
|