From 325a1612a34a53e5dca708df6f89cabed276f7b8 Mon Sep 17 00:00:00 2001 From: blockchainguyy Date: Fri, 10 Nov 2023 08:40:14 +0530 Subject: [PATCH] refactor: fetch severity enum from tenderly storage --- .../role-update-action/role-update/roleUpdate.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tenderly-suite/role-update-action/role-update/roleUpdate.js b/tenderly-suite/role-update-action/role-update/roleUpdate.js index fd1a695a..1febb721 100755 --- a/tenderly-suite/role-update-action/role-update/roleUpdate.js +++ b/tenderly-suite/role-update-action/role-update/roleUpdate.js @@ -77,6 +77,8 @@ const handleRoleUpdate = async (context, event) => { } if (severity) { + const Severity = await context.storage.getJson('Severity'); + try { await axios.post( PAGER_DUTY_ALERT_URL, @@ -86,7 +88,7 @@ const handleRoleUpdate = async (context, event) => { payload: { summary, source: `${chainName}-${event.hash}`, - severity: Severity[severity], + severity: Severity[`${severity}`], custom_details: { timestamp: Date.now(), chain_name: chainName, @@ -120,12 +122,6 @@ const Role = { 2: 'FlowLimiter', }; -const Severity = { - 1: 'info', - 2: 'warning', - 3: 'critical', -}; - function toRoleArray(accountRoles) { const roles = []; let bitIndex = 0;