Merge remote-tracking branch 'refs/remotes/origin/fix/bootstrap' into fix/bootstrap
This commit is contained in:
commit
3c078a857e
2 changed files with 5 additions and 5 deletions
|
|
@ -79,11 +79,11 @@ export class LiquidityProvider {
|
||||||
|
|
||||||
Connect = async () => {
|
Connect = async () => {
|
||||||
await new Promise(res => setTimeout(res, 2000))
|
await new Promise(res => setTimeout(res, 2000))
|
||||||
this.log("ready")
|
|
||||||
const res = await this.GetUserState()
|
const res = await this.GetUserState()
|
||||||
if (res.status === 'ERROR') {
|
if (res.status === 'ERROR' && res.reason !== 'timeout') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.log("provider ready with balance:", res.status === 'OK' ? res.balance : 0)
|
||||||
this.ready = true
|
this.ready = true
|
||||||
this.queue.forEach(q => q('ready'))
|
this.queue.forEach(q => q('ready'))
|
||||||
this.log("subbing to user operations")
|
this.log("subbing to user operations")
|
||||||
|
|
@ -101,9 +101,9 @@ export class LiquidityProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
GetUserState = async () => {
|
GetUserState = async () => {
|
||||||
const res = await this.client.GetUserInfo()
|
const res = await Promise.race([this.client.GetUserInfo(), new Promise<Types.ResultError>(res => setTimeout(() => res({ status: 'ERROR', reason: 'timeout' }), 10 * 1000))])
|
||||||
if (res.status === 'ERROR') {
|
if (res.status === 'ERROR') {
|
||||||
this.log("error getting user info", res)
|
this.log("error getting user info", res.reason)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
this.utils.stateBundler.AddBalancePoint('providerBalance', res.balance)
|
this.utils.stateBundler.AddBalancePoint('providerBalance', res.balance)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export class RugPullTracker {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForDisruption = async (pubDst: string, trackedBalance: number, providerTracker: TrackedProvider) => {
|
checkForDisruption = async (pubDst: string, trackedBalance: number, providerTracker: TrackedProvider) => {
|
||||||
const diff = providerTracker.latest_balance - trackedBalance
|
const diff = trackedBalance - providerTracker.latest_balance
|
||||||
this.log({ latestBalance: providerTracker.latest_balance, diff })
|
this.log({ latestBalance: providerTracker.latest_balance, diff })
|
||||||
if (diff < 0) {
|
if (diff < 0) {
|
||||||
this.rugPulled = true
|
this.rugPulled = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue