fix division by 0 and correctly deploy from master branch

This commit is contained in:
Maximilian Schneider 2021-09-06 15:08:01 +02:00
parent 2740bb346d
commit 5ac0dc673d
6 changed files with 2119 additions and 8 deletions

3
.gitignore vendored
View File

@ -2,7 +2,6 @@ dist
node_modules
.vscode
logs.*
yarn.lock
*.ps1
*.env
*.log
*.log

View File

@ -1 +1 @@
worker: npm run start
worker: yarn start

View File

@ -6,6 +6,7 @@
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"prepare": "yarn clean && yarn build",
"start": "node dist/index.js",
"update-pnl-cache": "node dist/updatePnlCache/index.js",
"test": "echo \"Error: no test specified\" && exit 1",
@ -33,4 +34,4 @@
"engines": {
"node": "14.x"
}
}
}

View File

@ -101,7 +101,8 @@ function ParseLiquidationData(instruction, instructionNum, confirmedTransaction)
}
}
let collRatio = startAssetsVal / startLiabsVal;
// add epsilon to prevent exploding coll ratio
let collRatio = startAssetsVal / (startLiabsVal+0.0001);
let inTokenPrice = prices[symbols.indexOf(inTokenSymbol)];
let outTokenPrice = prices[symbols.indexOf(outTokenSymbol)];
@ -272,7 +273,7 @@ function parseMangoTransactions(transactions) {
processStates.push({signature: signature, process_state: 'processed'});
}
} catch(e) {
} catch(e: any) {
console.log(e.stack)
processStates.push({signature: signature, process_state: 'processing error'});
}
@ -594,7 +595,7 @@ async function main() {
try {
await consumeTransactions()
}
catch(e) {
catch(e: any) {
notify(e.toString())
console.log(e, e.stack)
// Wait for 10 mins

View File

@ -143,7 +143,7 @@ async function runCron() {
hrend = process.hrtime(hrstart)
console.log('Execution time (hr): %ds %dms', hrend[0], hrend[1] / 1000000)
} catch(e) {
} catch(e: any) {
notify(e.toString())
throw e
}

2110
yarn.lock Normal file

File diff suppressed because it is too large Load Diff