|
@@ -11,6 +11,7 @@ const ierc20abi = require('../../abi/IERC20_ABI.json')
|
|
|
|
|
|
|
|
export class LpGenerate {
|
|
export class LpGenerate {
|
|
|
tokenInstance: any = {}
|
|
tokenInstance: any = {}
|
|
|
|
|
+ lpInstance: any = {}
|
|
|
memoryUtils: MemoryUtils = new MemoryUtils()
|
|
memoryUtils: MemoryUtils = new MemoryUtils()
|
|
|
|
|
|
|
|
async handlePosition(routerObj: any) {
|
|
async handlePosition(routerObj: any) {
|
|
@@ -130,17 +131,26 @@ export class LpGenerate {
|
|
|
try {
|
|
try {
|
|
|
const token = await this.handleToken(lp, true)
|
|
const token = await this.handleToken(lp, true)
|
|
|
|
|
|
|
|
- await history.appendOrUpdate(type, token.address, token)
|
|
|
|
|
|
|
+ // token的hash不同时为lp的情况才更新
|
|
|
|
|
+ if (!this.lpInstance[token.address]) {
|
|
|
|
|
+ await history.appendOrUpdate(type, token.address, token)
|
|
|
|
|
+ }
|
|
|
} catch (e) {}
|
|
} catch (e) {}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const token = await this.handleToken(lp, false)
|
|
const token = await this.handleToken(lp, false)
|
|
|
|
|
|
|
|
- await history.appendOrUpdate(type, token.address, token)
|
|
|
|
|
|
|
+ // token的hash不同时为lp的情况才更新
|
|
|
|
|
+ if (!this.lpInstance[token.address]) {
|
|
|
|
|
+ await history.appendOrUpdate(type, token.address, token)
|
|
|
|
|
+ }
|
|
|
} catch (e) {}
|
|
} catch (e) {}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async saveLp(lp: any, type='0') {
|
|
async saveLp(lp: any, type='0') {
|
|
|
|
|
+ // 本地lp实例存档
|
|
|
|
|
+ this.lpInstance[lp.LP] = lp
|
|
|
|
|
+
|
|
|
await History.appendOrUpdate(type, lp.LP, lp)
|
|
await History.appendOrUpdate(type, lp.LP, lp)
|
|
|
}
|
|
}
|
|
|
|
|
|