bugfix
This commit is contained in:
@@ -89,21 +89,17 @@ const indexes = {}
|
|||||||
const symbolsSeen = {} // keyed by (base,quote) so we only list one pool per pair even if there are many fee tiers
|
const symbolsSeen = {} // keyed by (base,quote) so we only list one pool per pair even if there are many fee tiers
|
||||||
|
|
||||||
function addSymbol(p, base, quote, inverted) {
|
function addSymbol(p, base, quote, inverted) {
|
||||||
// console.log('addSymbol', p, base, quote, inverted)
|
|
||||||
const symbol = base.s + '/' + quote.s
|
const symbol = base.s + '/' + quote.s
|
||||||
const exchange = ['UNIv2', 'UNIv3'][p.e]
|
const exchange = ['UNIv2', 'UNIv3'][p.e]
|
||||||
const full_name = exchange + ':' + symbol // + '%' + formatFee(fee)
|
const full_name = exchange + ':' + symbol // + '%' + formatFee(fee)
|
||||||
let key = `${base.a}${quote.a}`
|
let key = `${base.a}${quote.a}`
|
||||||
let found = symbolsSeen[key]
|
console.log('addSymbol', p, base, quote, inverted, key)
|
||||||
if (!found) {
|
if (symbolsSeen[key]) {
|
||||||
key = `${quote.a}${base.a}`
|
|
||||||
found = symbolsSeen[key]
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
// add this pool's address to the existing symbol as an additional fee tier
|
// add this pool's address to the existing symbol as an additional fee tier
|
||||||
const symbolInfo = _symbols[key];
|
const symbolInfo = _symbols[key];
|
||||||
symbolInfo.pools.push([p.a, p.f])
|
symbolInfo.pools.push([p.a, p.f])
|
||||||
symbolInfo.pools.sort((a,b)=>a[1]-b[1])
|
symbolInfo.pools.sort((a,b)=>a[1]-b[1])
|
||||||
|
console.log('integrated symbol', _symbols[key])
|
||||||
indexes[key].as.push(p.a)
|
indexes[key].as.push(p.a)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -118,7 +114,7 @@ function addSymbol(p, base, quote, inverted) {
|
|||||||
}
|
}
|
||||||
if (defaultSymbol===null)
|
if (defaultSymbol===null)
|
||||||
defaultSymbol = _symbols[key]
|
defaultSymbol = _symbols[key]
|
||||||
console.log('added symbol', key, _symbols[key])
|
console.log('new symbol', key, _symbols[key])
|
||||||
indexes[key] = {
|
indexes[key] = {
|
||||||
// key
|
// key
|
||||||
id: key,
|
id: key,
|
||||||
@@ -132,7 +128,7 @@ function addSymbol(p, base, quote, inverted) {
|
|||||||
fn: full_name,
|
fn: full_name,
|
||||||
bs: base.s,
|
bs: base.s,
|
||||||
qs: quote.s,
|
qs: quote.s,
|
||||||
e: exchange,
|
e: exchange + ' ' + longExchange,
|
||||||
d: description,
|
d: description,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user