Skip to content

Commit

Permalink
refactor: fetch severity enum from tenderly storage
Browse files Browse the repository at this point in the history
  • Loading branch information
blockchainguyy committed Nov 10, 2023
1 parent ee43523 commit 325a161
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tenderly-suite/role-update-action/role-update/roleUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -120,12 +122,6 @@ const Role = {
2: 'FlowLimiter',
};

const Severity = {
1: 'info',
2: 'warning',
3: 'critical',
};

function toRoleArray(accountRoles) {
const roles = [];
let bitIndex = 0;
Expand Down

0 comments on commit 325a161

Please sign in to comment.