revert ma/health checks

This commit is contained in:
saml33 2022-04-13 13:35:28 +10:00
parent 8b6383f149
commit 3464953256
1 changed files with 18 additions and 20 deletions

View File

@ -253,14 +253,13 @@ const handleAlert = async (alert: any, db: any) => {
mangoAccountPk, mangoAccountPk,
mangoGroup.dexProgramId mangoGroup.dexProgramId
) )
if (mangoAccount) {
const walletPublicKey = mangoAccount.owner.toBase58() const walletPublicKey = mangoAccount.owner.toBase58()
const health = await mangoAccount.getHealthRatio( const health = await mangoAccount.getHealthRatio(
mangoGroup, mangoGroup,
mangoCache, mangoCache,
"Maint" "Maint"
) )
if (health && health.toNumber() <= parseFloat(alert.health)) { if (health.toNumber() <= parseFloat(alert.health)) {
let message = MESSAGE.replace("@ratio@", alert.health) let message = MESSAGE.replace("@ratio@", alert.health)
message += message +=
"Deposit more collateral or reduce your liabilities to improve your account health. \n" "Deposit more collateral or reduce your liabilities to improve your account health. \n"
@ -275,7 +274,6 @@ const handleAlert = async (alert: any, db: any) => {
db.collection("alerts").deleteOne({ _id: alert._id }) db.collection("alerts").deleteOne({ _id: alert._id })
} }
} }
}
} catch (e) { } catch (e) {
console.log("Error handling alert:", alert.mangoAccountPk, e) console.log("Error handling alert:", alert.mangoAccountPk, e)
// sendLogsToDiscord(null, e) // sendLogsToDiscord(null, e)