This commit is contained in:
Tim
2024-03-13 17:33:11 -04:00
parent 142e635458
commit f2a6ad9119

View File

@@ -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
function addSymbol(p, base, quote, inverted) {
// console.log('addSymbol', p, base, quote, inverted)
const symbol = base.s + '/' + quote.s
const exchange = ['UNIv2', 'UNIv3'][p.e]
const full_name = exchange + ':' + symbol // + '%' + formatFee(fee)
let key = `${base.a}${quote.a}`
let found = symbolsSeen[key]
if (!found) {
key = `${quote.a}${base.a}`
found = symbolsSeen[key]
}
if (found) {
console.log('addSymbol', p, base, quote, inverted, key)
if (symbolsSeen[key]) {
// add this pool's address to the existing symbol as an additional fee tier
const symbolInfo = _symbols[key];
symbolInfo.pools.push([p.a, p.f])
symbolInfo.pools.sort((a,b)=>a[1]-b[1])
console.log('integrated symbol', _symbols[key])
indexes[key].as.push(p.a)
return
}
@@ -118,7 +114,7 @@ function addSymbol(p, base, quote, inverted) {
}
if (defaultSymbol===null)
defaultSymbol = _symbols[key]
console.log('added symbol', key, _symbols[key])
console.log('new symbol', key, _symbols[key])
indexes[key] = {
// key
id: key,
@@ -132,7 +128,7 @@ function addSymbol(p, base, quote, inverted) {
fn: full_name,
bs: base.s,
qs: quote.s,
e: exchange,
e: exchange + ' ' + longExchange,
d: description,
}
}