From ebb0734dfb1e8bb56989ccb0ac8940d2f5f9be4e Mon Sep 17 00:00:00 2001 From: blockchainguyy Date: Fri, 10 Nov 2023 09:28:21 +0530 Subject: [PATCH] refactor: use abi decoder instead of substring --- .../flow-limit-update/flow-limit-update/flowLimitUpdate.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tenderly-suite/flow-limit-update/flow-limit-update/flowLimitUpdate.js b/tenderly-suite/flow-limit-update/flow-limit-update/flowLimitUpdate.js index b23ff37b..8044ca6c 100644 --- a/tenderly-suite/flow-limit-update/flow-limit-update/flowLimitUpdate.js +++ b/tenderly-suite/flow-limit-update/flow-limit-update/flowLimitUpdate.js @@ -30,8 +30,7 @@ const flowLimitUpdateFn = async (context, event) => { throw new Error('INVALID_LOG_DATA_LENGTH'); } - // log data contains address in first 32 bytes i.e. first 64 chars, here data string is also prefixed with 0x. - const operatorAddress = '0x' + log.data.substring(26, 66); + const [operatorAddress] = ethers.utils.defaultAbiCoder.decode(['address', 'uint256'], log.data); const tempSeverity = itsAddresses.includes(operatorAddress.toLowerCase()) ? 1 : 2; if (tempSeverity > severity) {