@icgio/icg-utils 1.7.64 → 1.7.66

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.
@@ -12,7 +12,7 @@ const sort_keys = require('./utils.js').sort_keys
12
12
 
13
13
  const Limiter = require('./rate-limiter.js')
14
14
 
15
- const dex_rate = require('./dex-rate/dex-rate.js')
15
+ const dex_rate = require('./dex-rate.js')
16
16
 
17
17
  let limiter = new Limiter({
18
18
  max_concurrent: 1,
@@ -178,6 +178,133 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
178
178
  }
179
179
  cb(result)
180
180
  })
181
+ } else if (type === 'curs_dict') {
182
+ let curs_dict = pair_or_pairs_or_cur_curs
183
+ let length = _.keys(curs_dict).length
184
+ for (let cur in curs_dict) {
185
+ let exchange = curs_dict[cur]
186
+ if (exchange === 'mexc') {
187
+ let pair = cur + '_USDT'
188
+ let url = `https://www.mexc.com/open/api/v2/market/depth?symbol=${pair}&depth=100`
189
+ limiter.process(needle.get, url, (err, res, body) => {
190
+ try {
191
+ const { asks, bids } = body.data
192
+ let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
193
+ result[cur] = {
194
+ USD: rate,
195
+ USDT: rate,
196
+ }
197
+ let result_length = _.keys(result).length
198
+ if (result_length === length) {
199
+ for (let stable of stablecoins) {
200
+ result[stable] = {
201
+ USD: 1,
202
+ USDT: 1,
203
+ }
204
+ }
205
+ cb(result)
206
+ }
207
+ } catch (error) {
208
+ console.error(error)
209
+ }
210
+ })
211
+ } else if (exchange === 'gate') {
212
+ let pair = cur + '_USDT'
213
+ let url = `https://api.gateio.ws/api/v4/spot/order_book?currency_pair=${pair}`
214
+ limiter.process(needle.get, url, (err, res, body) => {
215
+ try {
216
+ const { asks, bids } = body
217
+ let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
218
+ result[cur] = {
219
+ USD: rate,
220
+ USDT: rate,
221
+ }
222
+ let result_length = _.keys(result).length
223
+ if (result_length === length) {
224
+ for (let stable of stablecoins) {
225
+ result[stable] = {
226
+ USD: 1,
227
+ USDT: 1,
228
+ }
229
+ }
230
+ cb(result)
231
+ }
232
+ } catch (error) {
233
+ console.error(error)
234
+ }
235
+ })
236
+ } else if (exchange === 'bitforex') {
237
+ } else if (exchange === 'coinstore') {
238
+ let pair = cur.toLowerCase() + 'usdt'
239
+ let url = `https://api.coinstore.com/api/v1/market/depth/${pair}`
240
+ limiter.process(needle.get, url, (err, res, body) => {
241
+ try {
242
+ const asks = body.data.a
243
+ const bids = body.data.b
244
+ let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
245
+ result[cur] = {
246
+ USD: rate,
247
+ USDT: rate,
248
+ }
249
+ let result_length = _.keys(result).length
250
+ if (result_length === length) {
251
+ for (let stable of stablecoins) {
252
+ result[stable] = {
253
+ USD: 1,
254
+ USDT: 1,
255
+ }
256
+ }
257
+ cb(result)
258
+ }
259
+ } catch (error) {
260
+ console.error(error)
261
+ }
262
+ })
263
+ } else if (exchange === 'xt') {
264
+ let pair = cur.toLowerCase() + '_usdt'
265
+ let url = `https://sapi.xt.com/v4/public/depth?symbol=${pair}&limit=20`
266
+ limiter.process(needle.get, url, (err, res, body) => {
267
+ try {
268
+ const asks = body.result.asks
269
+ const bids = body.result.bids
270
+ let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
271
+ result[cur] = {
272
+ USD: rate,
273
+ USDT: rate,
274
+ }
275
+ let result_length = _.keys(result).length
276
+ if (result_length === length) {
277
+ for (let stable of stablecoins) {
278
+ result[stable] = {
279
+ USD: 1,
280
+ USDT: 1,
281
+ }
282
+ }
283
+ cb(result)
284
+ }
285
+ } catch (error) {
286
+ console.error(error)
287
+ }
288
+ })
289
+ } else if (exchange === 'pancakeswap') {
290
+ dex_rate(cur, (res) => {
291
+ result[cur] = {
292
+ USD: res[cur],
293
+ USDT: res[cur],
294
+ }
295
+ let result_length = _.keys(result).length
296
+ if (result_length === length) {
297
+ for (let stable of stablecoins) {
298
+ result[stable] = {
299
+ USD: 1,
300
+ USDT: 1,
301
+ }
302
+ }
303
+ cb(result)
304
+ }
305
+ })
306
+ }
307
+ }
181
308
  } else {
182
309
  let quote_cur = 'USD',
183
310
  page = 1,
@@ -189,10 +316,10 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
189
316
  if (body && body.length > 0) {
190
317
  for (let coin of body) {
191
318
  let symbol = coin.symbol
192
- if (!symbol || !coin.current_price) continue
193
-
319
+ if (!symbol || !coin.current_price) {
320
+ continue
321
+ }
194
322
  symbol = symbol.toUpperCase()
195
-
196
323
  if (symbol === 'BAT' && coin.id !== 'basic-attention-token') {
197
324
  continue
198
325
  } else if (symbol === 'SBTC' && coin.id !== 'super-bitcoin') {
@@ -236,253 +363,32 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
236
363
  }
237
364
  }
238
365
  coins_map = source === 'coingecko' ? process_coins_map_coingecko(coins_map_raw_coingecko) : process_coins_map_coinmarketcap(coins_map_raw_coinmarketcap)
239
- if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'BBDC')) {
240
- let curs = _.without(pair_or_pairs_or_cur_curs, 'BBDC')
241
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=BBDC_USDT&depth=100').then((res) => {
242
- try {
243
- const { asks, bids } = res.body.data
244
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
245
- result.BBDC = {
246
- USD: rate,
247
- USDT: rate,
248
- }
249
- get_crypto_rates(cb, curs, type, source)
250
- } catch (error) {
251
- console.error(error)
252
- }
253
- })
254
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DARK')) {
255
- let curs = _.without(pair_or_pairs_or_cur_curs, 'DARK')
256
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=DARK_USDT&depth=100').then((res) => {
257
- try {
258
- const { asks, bids } = res.body.data
259
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
260
- result.DARK = {
261
- USD: rate,
262
- USDT: rate,
263
- }
264
- get_crypto_rates(cb, curs, type, source)
265
- } catch (error) {
266
- console.error(error)
267
- }
268
- })
269
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DMC')) {
270
- let curs = _.without(pair_or_pairs_or_cur_curs, 'DMC')
271
- needle('get', 'https://api.gateio.ws/api/v4/spot/order_book?currency_pair=DMC_USDT').then((res) => {
272
- try {
273
- const { asks, bids } = res.body
274
- let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
275
- result.DMC = {
276
- USD: rate,
277
- USDT: rate,
278
- }
279
- get_crypto_rates(cb, curs, type, source)
280
- } catch (error) {
281
- console.error(error)
282
- }
283
- })
284
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DFI')) {
285
- let curs = _.without(pair_or_pairs_or_cur_curs, 'DFI')
286
- needle('get', 'https://api.coinstore.com/api/v1/market/depth/dfiusdt').then((res) => {
287
- try {
288
- const asks = res.body.data.a
289
- const bids = res.body.data.b
290
- let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
291
- result.DFI = {
292
- USD: rate,
293
- USDT: rate,
294
- }
295
- get_crypto_rates(cb, curs, type, source)
296
- } catch (error) {
297
- console.error(error)
298
- }
299
- })
300
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ENIX')) {
301
- let curs = _.without(pair_or_pairs_or_cur_curs, 'ENIX')
302
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ENIX_USDT&depth=100').then((res) => {
303
- try {
304
- const { asks, bids } = res.body.data
305
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
306
- result.ENIX = {
307
- USD: rate,
308
- USDT: rate,
309
- }
310
- get_crypto_rates(cb, curs, type, source)
311
- } catch (error) {
312
- console.error(error)
313
- }
314
- })
315
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'FREN')) {
316
- let curs = _.without(pair_or_pairs_or_cur_curs, 'FREN')
317
- dex_rate().then((res) => {
318
- result.FREN = {
319
- USD: res.FRENUSDT,
320
- USDT: res.FRENUSDT,
321
- }
322
- get_crypto_rates(cb, curs, type, source)
323
- })
324
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'GLW')) {
325
- let curs = _.without(pair_or_pairs_or_cur_curs, 'GLW')
326
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=GLW_USDT&depth=100').then((res) => {
327
- try {
328
- const { asks, bids } = res.body.data
329
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
330
- result.GLW = {
331
- USD: rate,
332
- USDT: rate,
333
- }
334
- get_crypto_rates(cb, curs, type, source)
335
- } catch (error) {
336
- console.error(error)
337
- }
338
- })
339
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'IUS')) {
340
- let curs = _.without(pair_or_pairs_or_cur_curs, 'IUS')
341
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=IUS_USDT&depth=100').then((res) => {
342
- try {
343
- const { asks, bids } = res.body.data
344
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
345
- result.IUS = {
346
- USD: rate,
347
- USDT: rate,
348
- }
349
- get_crypto_rates(cb, curs, type, source)
350
- } catch (error) {
351
- console.error(error)
352
- }
353
- })
354
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'JD')) {
355
- let curs = _.without(pair_or_pairs_or_cur_curs, 'JD')
356
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=JD_USDT&depth=100').then((res) => {
357
- try {
358
- const { asks, bids } = res.body.data
359
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
360
- result.JD = {
361
- USD: rate,
362
- USDT: rate,
363
- }
364
- get_crypto_rates(cb, curs, type, source)
365
- } catch (error) {
366
- console.error(error)
367
- }
368
- })
369
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'KLC')) {
370
- let curs = _.without(pair_or_pairs_or_cur_curs, 'KLC')
371
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=KLC_USDT&depth=100').then((res) => {
372
- try {
373
- const { asks, bids } = res.body.data
374
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
375
- result.KLC = {
376
- USD: rate,
377
- USDT: rate,
378
- }
379
- get_crypto_rates(cb, curs, type, source)
380
- } catch (error) {
381
- console.error(error)
382
- }
383
- })
384
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'MEGODS')) {
385
- let curs = _.without(pair_or_pairs_or_cur_curs, 'MEGODS')
386
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=MEGODS_USDT&depth=100').then((res) => {
387
- try {
388
- const { asks, bids } = res.body.data
389
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
390
- result.MEGODS = {
391
- USD: rate,
392
- USDT: rate,
393
- }
394
- get_crypto_rates(cb, curs, type, source)
395
- } catch (error) {
396
- console.error(error)
397
- }
398
- })
399
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'MONE')) {
400
- let curs = _.without(pair_or_pairs_or_cur_curs, 'MONE')
401
- needle('get', 'https://www.bitforex.com/api/v1/market/depth?symbol=coin-usdt-mone').then((res) => {
402
- try {
403
- const { asks, bids } = JSON.parse(res.body).data
404
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
405
- result.MONE = {
406
- USD: rate,
407
- USDT: rate,
408
- }
409
- get_crypto_rates(cb, curs, type, source)
410
- } catch (error) {
411
- console.error(error)
412
- }
413
- })
414
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ROACHCOIN')) {
415
- let curs = _.without(pair_or_pairs_or_cur_curs, 'ROACHCOIN')
416
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ROACHCOIN_USDT&depth=100').then((res) => {
417
- try {
418
- const { asks, bids } = res.body.data
419
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
420
- result.ROACHCOIN = {
421
- USD: rate,
422
- USDT: rate,
423
- }
424
- get_crypto_rates(cb, curs, type, source)
425
- } catch (error) {
426
- console.error(error)
427
- }
428
- })
429
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SDP')) {
430
- let curs = _.without(pair_or_pairs_or_cur_curs, 'SDP')
431
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=SDP_USDT&depth=100').then((res) => {
432
- try {
433
- const { asks, bids } = res.body.data
434
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
435
- result.SDP = {
436
- USD: rate,
437
- USDT: rate,
438
- }
439
- get_crypto_rates(cb, curs, type, source)
440
- } catch (error) {
441
- console.error(error)
442
- }
443
- })
444
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SPAI')) {
445
- let curs = _.without(pair_or_pairs_or_cur_curs, 'SPAI')
446
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=SPAI_USDT&depth=100').then((res) => {
447
- try {
448
- const { asks, bids } = res.body.data
449
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
450
- result.SPAI = {
451
- USD: rate,
452
- USDT: rate,
453
- }
454
- get_crypto_rates(cb, curs, type, source)
455
- } catch (error) {
456
- console.error(error)
457
- }
458
- })
459
- } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'TIN')) {
460
- let curs = _.without(pair_or_pairs_or_cur_curs, 'TIN')
461
- needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=TIN_USDT&depth=100').then((res) => {
462
- try {
463
- const { asks, bids } = res.body.data
464
- let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
465
- result.TIN = {
466
- USD: rate,
467
- USDT: rate,
468
- }
469
- get_crypto_rates(cb, curs, type, source)
470
- } catch (error) {
471
- console.error(error)
472
- }
473
- })
474
- } else {
475
- get_crypto_rates_base(cb, pair_or_pairs_or_cur_curs, type)
476
- }
366
+ get_crypto_rates_base(cb, pair_or_pairs_or_cur_curs, type)
477
367
  }
478
368
 
369
+ // get_crypto_rates(
370
+ // (res) => {
371
+ // console.log(res)
372
+ // },
373
+ // {
374
+ // ENIX: 'mexc',
375
+ // FREN: 'pancakeswap',
376
+ // RWX: 'pancakeswap',
377
+ // DMC: 'gate',
378
+ // XERT: 'xt',
379
+ // DFI: 'coinstore',
380
+ // },
381
+ // 'curs_dict',
382
+ // 'coinmarketcap'
383
+ // )
384
+
479
385
  // get_crypto_rates(
480
386
  // (res) => {
481
387
  // console.log(res)
482
388
  // },
483
389
  // ['BTC', 'DFI', 'ETH', 'ENIX', 'FREN', 'DMC', 'IUS', 'MONE'],
484
390
  // 'curs',
485
- // 'coingecko'
391
+ // 'coinmarketcap'
486
392
  // )
487
393
 
488
394
  // dex_rate().then((res) => {
@@ -0,0 +1,33 @@
1
+ const _ = require('lodash')
2
+
3
+ const needle = require('needle')
4
+
5
+ const token_dict = {
6
+ FREN: {
7
+ address: '0xe6a768464b042a6d029394db1fdef360cb60bbeb',
8
+ network: 'bsc',
9
+ },
10
+ RWX: {
11
+ address: '0xb0a1c87b890fe171371f81a59f7ed4636e82595d',
12
+ network: 'bsc',
13
+ },
14
+ USDT: {
15
+ address: '0x55d398326f99059fF775485246999027B3197955',
16
+ network: 'bsc',
17
+ },
18
+ }
19
+
20
+ let dex_rate = function (cur, cb) {
21
+ const { address, network } = token_dict[cur]
22
+ const url = `https://api.geckoterminal.com/api/v2/simple/networks/${network}/token_price/${address}`
23
+ needle.get(url, (res, error, body) => {
24
+ if (body && body.data && body.data.id) {
25
+ let rate = parseFloat(body.data.attributes.token_prices[address])
26
+ cb({
27
+ [cur]: rate,
28
+ })
29
+ }
30
+ })
31
+ }
32
+
33
+ module.exports = dex_rate
package/lib/utils.js CHANGED
@@ -53,17 +53,17 @@ Date.prototype.addHours = function (h) {
53
53
  return new Date(this.getTime() + h * 60 * 60 * 1000)
54
54
  }
55
55
 
56
- Date.prototype.roundHours = function (m) {
56
+ Date.prototype.roundHours = function (m = 1) {
57
57
  let coeff = m * 60 * 60 * 1000
58
58
  return new Date(Math.round(this.getTime() / coeff) * coeff)
59
59
  }
60
60
 
61
- Date.prototype.ceilHours = function (m) {
61
+ Date.prototype.ceilHours = function (m = 1) {
62
62
  let coeff = m * 60 * 60 * 1000
63
63
  return new Date(Math.ceil(this.getTime() / coeff) * coeff)
64
64
  }
65
65
 
66
- Date.prototype.floorHours = function (m) {
66
+ Date.prototype.floorHours = function (m = 1) {
67
67
  let coeff = m * 60 * 60 * 1000
68
68
  return new Date(Math.floor(this.getTime() / coeff) * coeff)
69
69
  }
@@ -72,17 +72,17 @@ Date.prototype.addMinutes = function (m) {
72
72
  return new Date(this.getTime() + m * 60 * 1000)
73
73
  }
74
74
 
75
- Date.prototype.roundMinutes = function (m) {
75
+ Date.prototype.roundMinutes = function (m = 1) {
76
76
  let coeff = m * 60 * 1000
77
77
  return new Date(Math.round(this.getTime() / coeff) * coeff)
78
78
  }
79
79
 
80
- Date.prototype.ceilMinutes = function (m) {
80
+ Date.prototype.ceilMinutes = function (m = 1) {
81
81
  let coeff = m * 60 * 1000
82
82
  return new Date(Math.ceil(this.getTime() / coeff) * coeff)
83
83
  }
84
84
 
85
- Date.prototype.floorMinutes = function (m) {
85
+ Date.prototype.floorMinutes = function (m = 1) {
86
86
  let coeff = m * 60 * 1000
87
87
  return new Date(Math.floor(this.getTime() / coeff) * coeff)
88
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.64",
3
+ "version": "1.7.66",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -30,7 +30,6 @@
30
30
  "needle": "^3.2.0",
31
31
  "nodemailer": "^4.7.0",
32
32
  "qrcode-terminal": "^0.12.0",
33
- "web3": "^1.10.0",
34
33
  "websocket": "^1.0.33",
35
34
  "winston": "^2.4.5",
36
35
  "ws": "^8.13.0"
@@ -1,22 +0,0 @@
1
- const _ = require('lodash')
2
-
3
- const Web3 = require('web3')
4
- const toBN = Web3.utils.toBN
5
- const web3_bsc = new Web3('https://bsc-dataseed.binance.org/')
6
-
7
- const router_abi = require('./router-abi.js')
8
- const token_abi = require('./token-abi.js')
9
-
10
- const router_contract = new web3_bsc.eth.Contract(router_abi, '0x10ED43C718714eb63d5aA57B78B54704E256024E')
11
- const USDT_address = '0x55d398326f99059fF775485246999027B3197955'
12
- const FREN_address = '0xe6a768464b042a6d029394db1fdef360cb60bbeb'
13
- const WBNB_address = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'
14
-
15
- let FRENUSDT_rate = async function () {
16
- let rate = _.last(await router_contract.methods.getAmountsOut(toBN(1e18), [FREN_address, WBNB_address, USDT_address]).call()) / 1e18
17
- return {
18
- FRENUSDT: rate,
19
- }
20
- }
21
-
22
- module.exports = FRENUSDT_rate
@@ -1,328 +0,0 @@
1
- module.exports = [
2
- {
3
- inputs: [
4
- { internalType: 'address', name: '_factory', type: 'address' },
5
- { internalType: 'address', name: '_WETH', type: 'address' },
6
- ],
7
- stateMutability: 'nonpayable',
8
- type: 'constructor',
9
- },
10
- { inputs: [], name: 'WETH', outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function' },
11
- {
12
- inputs: [
13
- { internalType: 'address', name: 'tokenA', type: 'address' },
14
- { internalType: 'address', name: 'tokenB', type: 'address' },
15
- { internalType: 'uint256', name: 'amountADesired', type: 'uint256' },
16
- { internalType: 'uint256', name: 'amountBDesired', type: 'uint256' },
17
- { internalType: 'uint256', name: 'amountAMin', type: 'uint256' },
18
- { internalType: 'uint256', name: 'amountBMin', type: 'uint256' },
19
- { internalType: 'address', name: 'to', type: 'address' },
20
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
21
- ],
22
- name: 'addLiquidity',
23
- outputs: [
24
- { internalType: 'uint256', name: 'amountA', type: 'uint256' },
25
- { internalType: 'uint256', name: 'amountB', type: 'uint256' },
26
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
27
- ],
28
- stateMutability: 'nonpayable',
29
- type: 'function',
30
- },
31
- {
32
- inputs: [
33
- { internalType: 'address', name: 'token', type: 'address' },
34
- { internalType: 'uint256', name: 'amountTokenDesired', type: 'uint256' },
35
- { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' },
36
- { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' },
37
- { internalType: 'address', name: 'to', type: 'address' },
38
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
39
- ],
40
- name: 'addLiquidityETH',
41
- outputs: [
42
- { internalType: 'uint256', name: 'amountToken', type: 'uint256' },
43
- { internalType: 'uint256', name: 'amountETH', type: 'uint256' },
44
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
45
- ],
46
- stateMutability: 'payable',
47
- type: 'function',
48
- },
49
- { inputs: [], name: 'factory', outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function' },
50
- {
51
- inputs: [
52
- { internalType: 'uint256', name: 'amountOut', type: 'uint256' },
53
- { internalType: 'uint256', name: 'reserveIn', type: 'uint256' },
54
- { internalType: 'uint256', name: 'reserveOut', type: 'uint256' },
55
- ],
56
- name: 'getAmountIn',
57
- outputs: [{ internalType: 'uint256', name: 'amountIn', type: 'uint256' }],
58
- stateMutability: 'pure',
59
- type: 'function',
60
- },
61
- {
62
- inputs: [
63
- { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
64
- { internalType: 'uint256', name: 'reserveIn', type: 'uint256' },
65
- { internalType: 'uint256', name: 'reserveOut', type: 'uint256' },
66
- ],
67
- name: 'getAmountOut',
68
- outputs: [{ internalType: 'uint256', name: 'amountOut', type: 'uint256' }],
69
- stateMutability: 'pure',
70
- type: 'function',
71
- },
72
- {
73
- inputs: [
74
- { internalType: 'uint256', name: 'amountOut', type: 'uint256' },
75
- { internalType: 'address[]', name: 'path', type: 'address[]' },
76
- ],
77
- name: 'getAmountsIn',
78
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
79
- stateMutability: 'view',
80
- type: 'function',
81
- },
82
- {
83
- inputs: [
84
- { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
85
- { internalType: 'address[]', name: 'path', type: 'address[]' },
86
- ],
87
- name: 'getAmountsOut',
88
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
89
- stateMutability: 'view',
90
- type: 'function',
91
- },
92
- {
93
- inputs: [
94
- { internalType: 'uint256', name: 'amountA', type: 'uint256' },
95
- { internalType: 'uint256', name: 'reserveA', type: 'uint256' },
96
- { internalType: 'uint256', name: 'reserveB', type: 'uint256' },
97
- ],
98
- name: 'quote',
99
- outputs: [{ internalType: 'uint256', name: 'amountB', type: 'uint256' }],
100
- stateMutability: 'pure',
101
- type: 'function',
102
- },
103
- {
104
- inputs: [
105
- { internalType: 'address', name: 'tokenA', type: 'address' },
106
- { internalType: 'address', name: 'tokenB', type: 'address' },
107
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
108
- { internalType: 'uint256', name: 'amountAMin', type: 'uint256' },
109
- { internalType: 'uint256', name: 'amountBMin', type: 'uint256' },
110
- { internalType: 'address', name: 'to', type: 'address' },
111
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
112
- ],
113
- name: 'removeLiquidity',
114
- outputs: [
115
- { internalType: 'uint256', name: 'amountA', type: 'uint256' },
116
- { internalType: 'uint256', name: 'amountB', type: 'uint256' },
117
- ],
118
- stateMutability: 'nonpayable',
119
- type: 'function',
120
- },
121
- {
122
- inputs: [
123
- { internalType: 'address', name: 'token', type: 'address' },
124
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
125
- { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' },
126
- { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' },
127
- { internalType: 'address', name: 'to', type: 'address' },
128
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
129
- ],
130
- name: 'removeLiquidityETH',
131
- outputs: [
132
- { internalType: 'uint256', name: 'amountToken', type: 'uint256' },
133
- { internalType: 'uint256', name: 'amountETH', type: 'uint256' },
134
- ],
135
- stateMutability: 'nonpayable',
136
- type: 'function',
137
- },
138
- {
139
- inputs: [
140
- { internalType: 'address', name: 'token', type: 'address' },
141
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
142
- { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' },
143
- { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' },
144
- { internalType: 'address', name: 'to', type: 'address' },
145
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
146
- ],
147
- name: 'removeLiquidityETHSupportingFeeOnTransferTokens',
148
- outputs: [{ internalType: 'uint256', name: 'amountETH', type: 'uint256' }],
149
- stateMutability: 'nonpayable',
150
- type: 'function',
151
- },
152
- {
153
- inputs: [
154
- { internalType: 'address', name: 'token', type: 'address' },
155
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
156
- { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' },
157
- { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' },
158
- { internalType: 'address', name: 'to', type: 'address' },
159
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
160
- { internalType: 'bool', name: 'approveMax', type: 'bool' },
161
- { internalType: 'uint8', name: 'v', type: 'uint8' },
162
- { internalType: 'bytes32', name: 'r', type: 'bytes32' },
163
- { internalType: 'bytes32', name: 's', type: 'bytes32' },
164
- ],
165
- name: 'removeLiquidityETHWithPermit',
166
- outputs: [
167
- { internalType: 'uint256', name: 'amountToken', type: 'uint256' },
168
- { internalType: 'uint256', name: 'amountETH', type: 'uint256' },
169
- ],
170
- stateMutability: 'nonpayable',
171
- type: 'function',
172
- },
173
- {
174
- inputs: [
175
- { internalType: 'address', name: 'token', type: 'address' },
176
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
177
- { internalType: 'uint256', name: 'amountTokenMin', type: 'uint256' },
178
- { internalType: 'uint256', name: 'amountETHMin', type: 'uint256' },
179
- { internalType: 'address', name: 'to', type: 'address' },
180
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
181
- { internalType: 'bool', name: 'approveMax', type: 'bool' },
182
- { internalType: 'uint8', name: 'v', type: 'uint8' },
183
- { internalType: 'bytes32', name: 'r', type: 'bytes32' },
184
- { internalType: 'bytes32', name: 's', type: 'bytes32' },
185
- ],
186
- name: 'removeLiquidityETHWithPermitSupportingFeeOnTransferTokens',
187
- outputs: [{ internalType: 'uint256', name: 'amountETH', type: 'uint256' }],
188
- stateMutability: 'nonpayable',
189
- type: 'function',
190
- },
191
- {
192
- inputs: [
193
- { internalType: 'address', name: 'tokenA', type: 'address' },
194
- { internalType: 'address', name: 'tokenB', type: 'address' },
195
- { internalType: 'uint256', name: 'liquidity', type: 'uint256' },
196
- { internalType: 'uint256', name: 'amountAMin', type: 'uint256' },
197
- { internalType: 'uint256', name: 'amountBMin', type: 'uint256' },
198
- { internalType: 'address', name: 'to', type: 'address' },
199
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
200
- { internalType: 'bool', name: 'approveMax', type: 'bool' },
201
- { internalType: 'uint8', name: 'v', type: 'uint8' },
202
- { internalType: 'bytes32', name: 'r', type: 'bytes32' },
203
- { internalType: 'bytes32', name: 's', type: 'bytes32' },
204
- ],
205
- name: 'removeLiquidityWithPermit',
206
- outputs: [
207
- { internalType: 'uint256', name: 'amountA', type: 'uint256' },
208
- { internalType: 'uint256', name: 'amountB', type: 'uint256' },
209
- ],
210
- stateMutability: 'nonpayable',
211
- type: 'function',
212
- },
213
- {
214
- inputs: [
215
- { internalType: 'uint256', name: 'amountOut', type: 'uint256' },
216
- { internalType: 'address[]', name: 'path', type: 'address[]' },
217
- { internalType: 'address', name: 'to', type: 'address' },
218
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
219
- ],
220
- name: 'swapETHForExactTokens',
221
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
222
- stateMutability: 'payable',
223
- type: 'function',
224
- },
225
- {
226
- inputs: [
227
- { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' },
228
- { internalType: 'address[]', name: 'path', type: 'address[]' },
229
- { internalType: 'address', name: 'to', type: 'address' },
230
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
231
- ],
232
- name: 'swapExactETHForTokens',
233
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
234
- stateMutability: 'payable',
235
- type: 'function',
236
- },
237
- {
238
- inputs: [
239
- { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' },
240
- { internalType: 'address[]', name: 'path', type: 'address[]' },
241
- { internalType: 'address', name: 'to', type: 'address' },
242
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
243
- ],
244
- name: 'swapExactETHForTokensSupportingFeeOnTransferTokens',
245
- outputs: [],
246
- stateMutability: 'payable',
247
- type: 'function',
248
- },
249
- {
250
- inputs: [
251
- { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
252
- { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' },
253
- { internalType: 'address[]', name: 'path', type: 'address[]' },
254
- { internalType: 'address', name: 'to', type: 'address' },
255
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
256
- ],
257
- name: 'swapExactTokensForETH',
258
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
259
- stateMutability: 'nonpayable',
260
- type: 'function',
261
- },
262
- {
263
- inputs: [
264
- { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
265
- { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' },
266
- { internalType: 'address[]', name: 'path', type: 'address[]' },
267
- { internalType: 'address', name: 'to', type: 'address' },
268
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
269
- ],
270
- name: 'swapExactTokensForETHSupportingFeeOnTransferTokens',
271
- outputs: [],
272
- stateMutability: 'nonpayable',
273
- type: 'function',
274
- },
275
- {
276
- inputs: [
277
- { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
278
- { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' },
279
- { internalType: 'address[]', name: 'path', type: 'address[]' },
280
- { internalType: 'address', name: 'to', type: 'address' },
281
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
282
- ],
283
- name: 'swapExactTokensForTokens',
284
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
285
- stateMutability: 'nonpayable',
286
- type: 'function',
287
- },
288
- {
289
- inputs: [
290
- { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
291
- { internalType: 'uint256', name: 'amountOutMin', type: 'uint256' },
292
- { internalType: 'address[]', name: 'path', type: 'address[]' },
293
- { internalType: 'address', name: 'to', type: 'address' },
294
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
295
- ],
296
- name: 'swapExactTokensForTokensSupportingFeeOnTransferTokens',
297
- outputs: [],
298
- stateMutability: 'nonpayable',
299
- type: 'function',
300
- },
301
- {
302
- inputs: [
303
- { internalType: 'uint256', name: 'amountOut', type: 'uint256' },
304
- { internalType: 'uint256', name: 'amountInMax', type: 'uint256' },
305
- { internalType: 'address[]', name: 'path', type: 'address[]' },
306
- { internalType: 'address', name: 'to', type: 'address' },
307
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
308
- ],
309
- name: 'swapTokensForExactETH',
310
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
311
- stateMutability: 'nonpayable',
312
- type: 'function',
313
- },
314
- {
315
- inputs: [
316
- { internalType: 'uint256', name: 'amountOut', type: 'uint256' },
317
- { internalType: 'uint256', name: 'amountInMax', type: 'uint256' },
318
- { internalType: 'address[]', name: 'path', type: 'address[]' },
319
- { internalType: 'address', name: 'to', type: 'address' },
320
- { internalType: 'uint256', name: 'deadline', type: 'uint256' },
321
- ],
322
- name: 'swapTokensForExactTokens',
323
- outputs: [{ internalType: 'uint256[]', name: 'amounts', type: 'uint256[]' }],
324
- stateMutability: 'nonpayable',
325
- type: 'function',
326
- },
327
- { stateMutability: 'payable', type: 'receive' },
328
- ]
@@ -1,148 +0,0 @@
1
- module.exports = [
2
- { inputs: [], payable: false, stateMutability: 'nonpayable', type: 'constructor' },
3
- {
4
- anonymous: false,
5
- inputs: [
6
- { indexed: true, internalType: 'address', name: 'owner', type: 'address' },
7
- { indexed: true, internalType: 'address', name: 'spender', type: 'address' },
8
- { indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
9
- ],
10
- name: 'Approval',
11
- type: 'event',
12
- },
13
- {
14
- anonymous: false,
15
- inputs: [
16
- { indexed: true, internalType: 'address', name: 'previousOwner', type: 'address' },
17
- { indexed: true, internalType: 'address', name: 'newOwner', type: 'address' },
18
- ],
19
- name: 'OwnershipTransferred',
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: false,
46
- inputs: [
47
- { internalType: 'address', name: 'spender', type: 'address' },
48
- { internalType: 'uint256', name: 'amount', type: 'uint256' },
49
- ],
50
- name: 'approve',
51
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
52
- payable: false,
53
- stateMutability: 'nonpayable',
54
- type: 'function',
55
- },
56
- {
57
- constant: true,
58
- inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
59
- name: 'balanceOf',
60
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
61
- payable: false,
62
- stateMutability: 'view',
63
- type: 'function',
64
- },
65
- {
66
- constant: false,
67
- inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }],
68
- name: 'burn',
69
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
70
- payable: false,
71
- stateMutability: 'nonpayable',
72
- type: 'function',
73
- },
74
- { constant: true, inputs: [], name: 'decimals', outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }], payable: false, stateMutability: 'view', type: 'function' },
75
- {
76
- constant: false,
77
- inputs: [
78
- { internalType: 'address', name: 'spender', type: 'address' },
79
- { internalType: 'uint256', name: 'subtractedValue', type: 'uint256' },
80
- ],
81
- name: 'decreaseAllowance',
82
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
83
- payable: false,
84
- stateMutability: 'nonpayable',
85
- type: 'function',
86
- },
87
- { constant: true, inputs: [], name: 'getOwner', outputs: [{ internalType: 'address', name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' },
88
- {
89
- constant: false,
90
- inputs: [
91
- { internalType: 'address', name: 'spender', type: 'address' },
92
- { internalType: 'uint256', name: 'addedValue', type: 'uint256' },
93
- ],
94
- name: 'increaseAllowance',
95
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
96
- payable: false,
97
- stateMutability: 'nonpayable',
98
- type: 'function',
99
- },
100
- {
101
- constant: false,
102
- inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }],
103
- name: 'mint',
104
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
105
- payable: false,
106
- stateMutability: 'nonpayable',
107
- type: 'function',
108
- },
109
- { constant: true, inputs: [], name: 'name', outputs: [{ internalType: 'string', name: '', type: 'string' }], payable: false, stateMutability: 'view', type: 'function' },
110
- { constant: true, inputs: [], name: 'owner', outputs: [{ internalType: 'address', name: '', type: 'address' }], payable: false, stateMutability: 'view', type: 'function' },
111
- { constant: false, inputs: [], name: 'renounceOwnership', outputs: [], payable: false, stateMutability: 'nonpayable', type: 'function' },
112
- { constant: true, inputs: [], name: 'symbol', outputs: [{ internalType: 'string', name: '', type: 'string' }], payable: false, stateMutability: 'view', type: 'function' },
113
- { constant: true, inputs: [], name: 'totalSupply', outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], payable: false, stateMutability: 'view', type: 'function' },
114
- {
115
- constant: false,
116
- inputs: [
117
- { internalType: 'address', name: 'recipient', type: 'address' },
118
- { internalType: 'uint256', name: 'amount', type: 'uint256' },
119
- ],
120
- name: 'transfer',
121
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
122
- payable: false,
123
- stateMutability: 'nonpayable',
124
- type: 'function',
125
- },
126
- {
127
- constant: false,
128
- inputs: [
129
- { internalType: 'address', name: 'sender', type: 'address' },
130
- { internalType: 'address', name: 'recipient', type: 'address' },
131
- { internalType: 'uint256', name: 'amount', type: 'uint256' },
132
- ],
133
- name: 'transferFrom',
134
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
135
- payable: false,
136
- stateMutability: 'nonpayable',
137
- type: 'function',
138
- },
139
- {
140
- constant: false,
141
- inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }],
142
- name: 'transferOwnership',
143
- outputs: [],
144
- payable: false,
145
- stateMutability: 'nonpayable',
146
- type: 'function',
147
- },
148
- ]