@exodus/ethereum-lib 1.0.2 → 1.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-lib",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "author": "Exodus Movement, Inc.",
@@ -20,5 +20,5 @@
20
20
  "peerDependencies": {
21
21
  "@exodus/assets": "8.0.x"
22
22
  },
23
- "gitHead": "b3f82bee0811534594425dcadb52ce70a8e049e8"
23
+ "gitHead": "c325cbde7e75dd6a4924ddc0aab40202d65c55c3"
24
24
  }
package/src/abi/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import cdai from './cdai'
2
2
  import dai from './dai'
3
+ import repv2 from './repv2'
4
+ import scdMcdMigration from './scd-mcd-migration'
3
5
 
4
6
  export default {
5
7
  cdai,
6
8
  dai,
9
+ repv2,
10
+ scdMcdMigration,
7
11
  }
@@ -0,0 +1,358 @@
1
+ export default [
2
+ {
3
+ inputs: [
4
+ { internalType: 'contract IAugur', name: '_augur', type: 'address' },
5
+ { internalType: 'contract IUniverse', name: '_universe', type: 'address' },
6
+ { internalType: 'contract IUniverse', name: '_parentUniverse', type: 'address' },
7
+ ],
8
+ payable: false,
9
+ stateMutability: 'nonpayable',
10
+ type: 'constructor',
11
+ },
12
+ {
13
+ anonymous: false,
14
+ inputs: [
15
+ { indexed: true, internalType: 'address', name: 'owner', type: 'address' },
16
+ { indexed: true, internalType: 'address', name: 'spender', type: 'address' },
17
+ { indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
18
+ ],
19
+ name: 'Approval',
20
+ type: 'event',
21
+ },
22
+ {
23
+ anonymous: false,
24
+ inputs: [
25
+ { indexed: true, internalType: 'address', name: 'from', type: 'address' },
26
+ { indexed: true, internalType: 'address', name: 'to', type: 'address' },
27
+ { indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
28
+ ],
29
+ name: 'Transfer',
30
+ type: 'event',
31
+ },
32
+ {
33
+ constant: true,
34
+ inputs: [
35
+ { internalType: 'address', name: '_owner', type: 'address' },
36
+ { internalType: 'address', name: '_spender', type: 'address' },
37
+ ],
38
+ name: 'allowance',
39
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
40
+ payable: false,
41
+ stateMutability: 'view',
42
+ type: 'function',
43
+ },
44
+ {
45
+ constant: true,
46
+ inputs: [
47
+ { internalType: 'address', name: '', type: 'address' },
48
+ { internalType: 'address', name: '', type: 'address' },
49
+ ],
50
+ name: 'allowances',
51
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
52
+ payable: false,
53
+ stateMutability: 'view',
54
+ type: 'function',
55
+ },
56
+ {
57
+ constant: false,
58
+ inputs: [
59
+ { internalType: 'address', name: '_spender', type: 'address' },
60
+ { internalType: 'uint256', name: '_amount', type: 'uint256' },
61
+ ],
62
+ name: 'approve',
63
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
64
+ payable: false,
65
+ stateMutability: 'nonpayable',
66
+ type: 'function',
67
+ },
68
+ {
69
+ constant: true,
70
+ inputs: [],
71
+ name: 'augur',
72
+ outputs: [{ internalType: 'contract IAugur', name: '', type: 'address' }],
73
+ payable: false,
74
+ stateMutability: 'view',
75
+ type: 'function',
76
+ },
77
+ {
78
+ constant: true,
79
+ inputs: [{ internalType: 'address', name: '_account', type: 'address' }],
80
+ name: 'balanceOf',
81
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
82
+ payable: false,
83
+ stateMutability: 'view',
84
+ type: 'function',
85
+ },
86
+ {
87
+ constant: true,
88
+ inputs: [{ internalType: 'address', name: '', type: 'address' }],
89
+ name: 'balances',
90
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
91
+ payable: false,
92
+ stateMutability: 'view',
93
+ type: 'function',
94
+ },
95
+ {
96
+ constant: false,
97
+ inputs: [{ internalType: 'uint256', name: '_amountToBurn', type: 'uint256' }],
98
+ name: 'burnForMarket',
99
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
100
+ payable: false,
101
+ stateMutability: 'nonpayable',
102
+ type: 'function',
103
+ },
104
+ {
105
+ constant: true,
106
+ inputs: [],
107
+ name: 'decimals',
108
+ outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
109
+ payable: false,
110
+ stateMutability: 'view',
111
+ type: 'function',
112
+ },
113
+ {
114
+ constant: false,
115
+ inputs: [
116
+ { internalType: 'address', name: '_spender', type: 'address' },
117
+ { internalType: 'uint256', name: '_subtractedValue', type: 'uint256' },
118
+ ],
119
+ name: 'decreaseAllowance',
120
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
121
+ payable: false,
122
+ stateMutability: 'nonpayable',
123
+ type: 'function',
124
+ },
125
+ {
126
+ constant: true,
127
+ inputs: [],
128
+ name: 'getLegacyRepToken',
129
+ outputs: [{ internalType: 'contract IERC20', name: '', type: 'address' }],
130
+ payable: false,
131
+ stateMutability: 'view',
132
+ type: 'function',
133
+ },
134
+ {
135
+ constant: true,
136
+ inputs: [],
137
+ name: 'getTotalMigrated',
138
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
139
+ payable: false,
140
+ stateMutability: 'view',
141
+ type: 'function',
142
+ },
143
+ {
144
+ constant: true,
145
+ inputs: [],
146
+ name: 'getTotalTheoreticalSupply',
147
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
148
+ payable: false,
149
+ stateMutability: 'view',
150
+ type: 'function',
151
+ },
152
+ {
153
+ constant: true,
154
+ inputs: [],
155
+ name: 'getUniverse',
156
+ outputs: [{ internalType: 'contract IUniverse', name: '', type: 'address' }],
157
+ payable: false,
158
+ stateMutability: 'view',
159
+ type: 'function',
160
+ },
161
+ {
162
+ constant: false,
163
+ inputs: [
164
+ { internalType: 'address', name: '_spender', type: 'address' },
165
+ { internalType: 'uint256', name: '_addedValue', type: 'uint256' },
166
+ ],
167
+ name: 'increaseAllowance',
168
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
169
+ payable: false,
170
+ stateMutability: 'nonpayable',
171
+ type: 'function',
172
+ },
173
+ {
174
+ constant: true,
175
+ inputs: [],
176
+ name: 'legacyRepToken',
177
+ outputs: [{ internalType: 'contract IERC20', name: '', type: 'address' }],
178
+ payable: false,
179
+ stateMutability: 'view',
180
+ type: 'function',
181
+ },
182
+ {
183
+ constant: false,
184
+ inputs: [],
185
+ name: 'migrateFromLegacyReputationToken',
186
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
187
+ payable: false,
188
+ stateMutability: 'nonpayable',
189
+ type: 'function',
190
+ },
191
+ {
192
+ constant: false,
193
+ inputs: [
194
+ { internalType: 'address', name: '_reporter', type: 'address' },
195
+ { internalType: 'uint256', name: '_attotokens', type: 'uint256' },
196
+ ],
197
+ name: 'migrateIn',
198
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
199
+ payable: false,
200
+ stateMutability: 'nonpayable',
201
+ type: 'function',
202
+ },
203
+ {
204
+ constant: false,
205
+ inputs: [
206
+ { internalType: 'uint256[]', name: '_payoutNumerators', type: 'uint256[]' },
207
+ { internalType: 'uint256', name: '_attotokens', type: 'uint256' },
208
+ ],
209
+ name: 'migrateOutByPayout',
210
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
211
+ payable: false,
212
+ stateMutability: 'nonpayable',
213
+ type: 'function',
214
+ },
215
+ {
216
+ constant: false,
217
+ inputs: [{ internalType: 'uint256', name: '_amountMigrated', type: 'uint256' }],
218
+ name: 'mintForReportingParticipant',
219
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
220
+ payable: false,
221
+ stateMutability: 'nonpayable',
222
+ type: 'function',
223
+ },
224
+ {
225
+ constant: false,
226
+ inputs: [
227
+ { internalType: 'uint256', name: '_amountToMint', type: 'uint256' },
228
+ { internalType: 'address', name: '_target', type: 'address' },
229
+ ],
230
+ name: 'mintForWarpSync',
231
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
232
+ payable: false,
233
+ stateMutability: 'nonpayable',
234
+ type: 'function',
235
+ },
236
+ {
237
+ constant: true,
238
+ inputs: [],
239
+ name: 'name',
240
+ outputs: [{ internalType: 'string', name: '', type: 'string' }],
241
+ payable: false,
242
+ stateMutability: 'view',
243
+ type: 'function',
244
+ },
245
+ {
246
+ constant: true,
247
+ inputs: [],
248
+ name: 'parentUniverse',
249
+ outputs: [{ internalType: 'contract IUniverse', name: '', type: 'address' }],
250
+ payable: false,
251
+ stateMutability: 'view',
252
+ type: 'function',
253
+ },
254
+ {
255
+ constant: true,
256
+ inputs: [],
257
+ name: 'symbol',
258
+ outputs: [{ internalType: 'string', name: '', type: 'string' }],
259
+ payable: false,
260
+ stateMutability: 'view',
261
+ type: 'function',
262
+ },
263
+ {
264
+ constant: true,
265
+ inputs: [],
266
+ name: 'totalSupply',
267
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
268
+ payable: false,
269
+ stateMutability: 'view',
270
+ type: 'function',
271
+ },
272
+ {
273
+ constant: false,
274
+ inputs: [
275
+ { internalType: 'address', name: '_recipient', type: 'address' },
276
+ { internalType: 'uint256', name: '_amount', type: 'uint256' },
277
+ ],
278
+ name: 'transfer',
279
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
280
+ payable: false,
281
+ stateMutability: 'nonpayable',
282
+ type: 'function',
283
+ },
284
+ {
285
+ constant: false,
286
+ inputs: [
287
+ { internalType: 'address', name: '_sender', type: 'address' },
288
+ { internalType: 'address', name: '_recipient', type: 'address' },
289
+ { internalType: 'uint256', name: '_amount', type: 'uint256' },
290
+ ],
291
+ name: 'transferFrom',
292
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
293
+ payable: false,
294
+ stateMutability: 'nonpayable',
295
+ type: 'function',
296
+ },
297
+ {
298
+ constant: false,
299
+ inputs: [
300
+ { internalType: 'address', name: '_source', type: 'address' },
301
+ { internalType: 'address', name: '_destination', type: 'address' },
302
+ { internalType: 'uint256', name: '_attotokens', type: 'uint256' },
303
+ ],
304
+ name: 'trustedDisputeWindowTransfer',
305
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
306
+ payable: false,
307
+ stateMutability: 'nonpayable',
308
+ type: 'function',
309
+ },
310
+ {
311
+ constant: false,
312
+ inputs: [
313
+ { internalType: 'address', name: '_source', type: 'address' },
314
+ { internalType: 'address', name: '_destination', type: 'address' },
315
+ { internalType: 'uint256', name: '_attotokens', type: 'uint256' },
316
+ ],
317
+ name: 'trustedMarketTransfer',
318
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
319
+ payable: false,
320
+ stateMutability: 'nonpayable',
321
+ type: 'function',
322
+ },
323
+ {
324
+ constant: false,
325
+ inputs: [
326
+ { internalType: 'address', name: '_source', type: 'address' },
327
+ { internalType: 'address', name: '_destination', type: 'address' },
328
+ { internalType: 'uint256', name: '_attotokens', type: 'uint256' },
329
+ ],
330
+ name: 'trustedReportingParticipantTransfer',
331
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
332
+ payable: false,
333
+ stateMutability: 'nonpayable',
334
+ type: 'function',
335
+ },
336
+ {
337
+ constant: false,
338
+ inputs: [
339
+ { internalType: 'address', name: '_source', type: 'address' },
340
+ { internalType: 'address', name: '_destination', type: 'address' },
341
+ { internalType: 'uint256', name: '_attotokens', type: 'uint256' },
342
+ ],
343
+ name: 'trustedUniverseTransfer',
344
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
345
+ payable: false,
346
+ stateMutability: 'nonpayable',
347
+ type: 'function',
348
+ },
349
+ {
350
+ constant: true,
351
+ inputs: [],
352
+ name: 'warpSync',
353
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
354
+ payable: false,
355
+ stateMutability: 'view',
356
+ type: 'function',
357
+ },
358
+ ]
@@ -0,0 +1,95 @@
1
+ export default [
2
+ {
3
+ constant: true,
4
+ inputs: [],
5
+ name: 'saiJoin',
6
+ outputs: [{ internalType: 'contract JoinLike', name: '', type: 'address' }],
7
+ payable: false,
8
+ stateMutability: 'view',
9
+ type: 'function',
10
+ },
11
+ {
12
+ constant: true,
13
+ inputs: [],
14
+ name: 'wethJoin',
15
+ outputs: [{ internalType: 'contract JoinLike', name: '', type: 'address' }],
16
+ payable: false,
17
+ stateMutability: 'view',
18
+ type: 'function',
19
+ },
20
+ {
21
+ constant: true,
22
+ inputs: [],
23
+ name: 'tub',
24
+ outputs: [{ internalType: 'contract SaiTubLike', name: '', type: 'address' }],
25
+ payable: false,
26
+ stateMutability: 'view',
27
+ type: 'function',
28
+ },
29
+ {
30
+ constant: true,
31
+ inputs: [],
32
+ name: 'vat',
33
+ outputs: [{ internalType: 'contract VatLike', name: '', type: 'address' }],
34
+ payable: false,
35
+ stateMutability: 'view',
36
+ type: 'function',
37
+ },
38
+ {
39
+ constant: true,
40
+ inputs: [],
41
+ name: 'cdpManager',
42
+ outputs: [{ internalType: 'contract ManagerLike', name: '', type: 'address' }],
43
+ payable: false,
44
+ stateMutability: 'view',
45
+ type: 'function',
46
+ },
47
+ {
48
+ constant: true,
49
+ inputs: [],
50
+ name: 'daiJoin',
51
+ outputs: [{ internalType: 'contract JoinLike', name: '', type: 'address' }],
52
+ payable: false,
53
+ stateMutability: 'view',
54
+ type: 'function',
55
+ },
56
+ {
57
+ constant: false,
58
+ inputs: [{ internalType: 'uint256', name: 'wad', type: 'uint256' }],
59
+ name: 'swapDaiToSai',
60
+ outputs: [],
61
+ payable: false,
62
+ stateMutability: 'nonpayable',
63
+ type: 'function',
64
+ },
65
+ {
66
+ constant: false,
67
+ inputs: [{ internalType: 'bytes32', name: 'cup', type: 'bytes32' }],
68
+ name: 'migrate',
69
+ outputs: [{ internalType: 'uint256', name: 'cdp', type: 'uint256' }],
70
+ payable: false,
71
+ stateMutability: 'nonpayable',
72
+ type: 'function',
73
+ },
74
+ {
75
+ constant: false,
76
+ inputs: [{ internalType: 'uint256', name: 'wad', type: 'uint256' }],
77
+ name: 'swapSaiToDai',
78
+ outputs: [],
79
+ payable: false,
80
+ stateMutability: 'nonpayable',
81
+ type: 'function',
82
+ },
83
+ {
84
+ inputs: [
85
+ { internalType: 'address', name: 'tub_', type: 'address' },
86
+ { internalType: 'address', name: 'cdpManager_', type: 'address' },
87
+ { internalType: 'address', name: 'saiJoin_', type: 'address' },
88
+ { internalType: 'address', name: 'wethJoin_', type: 'address' },
89
+ { internalType: 'address', name: 'daiJoin_', type: 'address' },
90
+ ],
91
+ payable: false,
92
+ stateMutability: 'nonpayable',
93
+ type: 'constructor',
94
+ },
95
+ ]
@@ -1,11 +1,10 @@
1
1
  import ethUtil from 'ethereumjs-util'
2
- import { isEthereumToken, currency2buffer } from '../utils'
2
+ import { isEthereumToken, currency2buffer, getBaseAsset } from '../utils'
3
3
  import { CHAIN_IDS } from '../constants'
4
4
 
5
5
  import type { UnsignedTransaction } from '#/app-models'
6
6
 
7
7
  export default function createUnsignedTx({
8
- baseAsset,
9
8
  asset,
10
9
  address,
11
10
  amount,
@@ -23,6 +22,7 @@ export default function createUnsignedTx({
23
22
  txInput = Buffer.alloc(0)
24
23
  }
25
24
 
25
+ const baseAsset = getBaseAsset(asset)
26
26
  if (!chainId) chainId = CHAIN_IDS[baseAsset.name] // mainnet
27
27
 
28
28
  const isToken = isEthereumToken(asset)