Skip to content

Commit

Permalink
refactor: use abi decoder instead of substring
Browse files Browse the repository at this point in the history
  • Loading branch information
blockchainguyy committed Nov 10, 2023
1 parent 817e0dc commit ebb0734
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ebb0734

Please sign in to comment.