diff --git a/tenderly-suite/handle-failed-tx-action/handle-failed-tx/handleFailedTx.js b/tenderly-suite/handle-failed-tx-action/handle-failed-tx/handleFailedTx.js index 1f25b71c..ff500022 100644 --- a/tenderly-suite/handle-failed-tx-action/handle-failed-tx/handleFailedTx.js +++ b/tenderly-suite/handle-failed-tx-action/handle-failed-tx/handleFailedTx.js @@ -51,15 +51,34 @@ const handleFailedTxFn = async (context, event) => { throw new Error('INVALID_RESPONSE_LENGTH'); } - const { flowLimitExceeded, missingRole, missingAllRoles, missingAnyOfRoles, reEntrancy, notService } = await context.storage.getJson( - 'ErrorsABI', - ); + const { + flowLimitExceeded, + missingRole, + missingAllRoles, + missingAnyOfRoles, + reEntrancy, + notService, + notSigner, + alreadyVoted, + invalidSigners, + invalidSignerThreshold, + duplicateSigner, + notGovernance, + notSelf, + } = await context.storage.getJson('ErrorsABI'); const flowLimitExceededHash = ethers.utils.keccak256(toUtf8Bytes(flowLimitExceeded)).slice(0, 10); const missingRoleHash = ethers.utils.keccak256(toUtf8Bytes(missingRole)).slice(0, 10); const missingAllRolesHash = ethers.utils.keccak256(toUtf8Bytes(missingAllRoles)).slice(0, 10); const missingAnyOfRolesHash = ethers.utils.keccak256(toUtf8Bytes(missingAnyOfRoles)).slice(0, 10); const reEntrancyHash = ethers.utils.keccak256(toUtf8Bytes(reEntrancy)).slice(0, 10); const notServiceHash = ethers.utils.keccak256(toUtf8Bytes(notService)).slice(0, 10); + const notSignerHash = ethers.utils.keccak256(toUtf8Bytes(notSigner)).slice(0, 10); + const alreadyVotedHash = ethers.utils.keccak256(toUtf8Bytes(alreadyVoted)).slice(0, 10); + const invalidSignersHash = ethers.utils.keccak256(toUtf8Bytes(invalidSigners)).slice(0, 10); + const invalidSignerThresholdHash = ethers.utils.keccak256(toUtf8Bytes(invalidSignerThreshold)).slice(0, 10); + const duplicateSignerHash = ethers.utils.keccak256(toUtf8Bytes(duplicateSigner)).slice(0, 10); + const notGovernanceHash = ethers.utils.keccak256(toUtf8Bytes(notGovernance)).slice(0, 10); + const notSelfHash = ethers.utils.keccak256(toUtf8Bytes(notSelf)).slice(0, 10); const errorHash = response.slice(0, 10); console.log('errorHash: ', errorHash); @@ -69,7 +88,7 @@ const handleFailedTxFn = async (context, event) => { case flowLimitExceededHash: warningOptions = ['FlowLimitExceeded', 'TokenManager']; console.log( - `Tx reverted due to error ${toUtf8Bytes(flowLimitExceeded)} with values flowLimit ${parseInt( + `Tx reverted due to error ${flowLimitExceeded} with values flowLimit ${parseInt( response.slice(10, 74), 16, )} and flowAmount ${parseInt(response.slice(74, 134), 16)} for address ${event.to}`, @@ -78,7 +97,7 @@ const handleFailedTxFn = async (context, event) => { case missingRoleHash: warningOptions = ['MissingRole', event.to]; console.log( - `Tx reverted due to error ${toUtf8Bytes(missingRole)} with values account ${response.slice(34, 74)} and role ${parseInt( + `Tx reverted due to error ${missingRole} with values account ${response.slice(34, 74)} and role ${parseInt( response.slice(74, 138), 16, )} for address ${event.to}`, @@ -87,7 +106,7 @@ const handleFailedTxFn = async (context, event) => { case missingAllRolesHash: warningOptions = ['MissingAllRoles', event.to]; console.log( - `Tx reverted due to error ${toUtf8Bytes(missingAllRoles)} with values account ${response.slice(34, 74)} and role ${parseInt( + `Tx reverted due to error ${missingAllRoles} with values account ${response.slice(34, 74)} and role ${parseInt( response.slice(74, 138), 16, )} for address ${event.to}`, @@ -96,21 +115,47 @@ const handleFailedTxFn = async (context, event) => { case missingAnyOfRolesHash: warningOptions = ['MissingAnyOfRoles', event.to]; console.log( - `Tx reverted due to error ${toUtf8Bytes(missingAnyOfRoles)} with values account ${response.slice( - 34, - 74, - )} and role ${parseInt(response.slice(74, 138), 16)} for address ${event.to}`, + `Tx reverted due to error ${missingAnyOfRoles} with values account ${response.slice(34, 74)} and role ${parseInt( + response.slice(74, 138), + 16, + )} for address ${event.to}`, ); break; case reEntrancyHash: warningOptions = ['ReEntrancy', event.to]; - console.log(`Tx reverted due to error ${toUtf8Bytes(reEntrancy)} for address ${event.to}`); + console.log(`Tx reverted due to error ${reEntrancy} for address ${event.to}`); break; case notServiceHash: warningOptions = ['NotService', 'TokenManager']; - console.log( - `Tx reverted due to error ${toUtf8Bytes(notService)} with value caller ${response.slice(34, 74)} for address ${event.to}`, - ); + console.log(`Tx reverted due to error ${notService} with value caller ${response.slice(34, 74)} for address ${event.to}`); + break; + case notSignerHash: + warningOptions = ['NotSigner', event.to]; + console.log(`Tx reverted due to error ${notSigner} for address ${event.to}`); + break; + case alreadyVotedHash: + warningOptions = ['AlreadyVoted', event.to]; + console.log(`Tx reverted due to error ${alreadyVoted} for address ${event.to}`); + break; + case invalidSignersHash: + warningOptions = ['InvalidSigners', event.to]; + console.log(`Tx reverted due to error ${invalidSigners} for address ${event.to}`); + break; + case invalidSignerThresholdHash: + warningOptions = ['InvalidSignerThreshold', event.to]; + console.log(`Tx reverted due to error ${invalidSignerThreshold} for address ${event.to}`); + break; + case duplicateSignerHash: + warningOptions = ['DuplicateSigner', event.to]; + console.log(`Tx reverted due to error ${duplicateSigner} with value account ${response.slice(34, 74)} for address ${event.to}`); + break; + case notGovernanceHash: + warningOptions = ['NotGovernance', 'InterchainGovernance']; + console.log(`Tx reverted due to error ${notGovernance} for address ${event.to}`); + break; + case notSelfHash: + warningOptions = ['NotSelf', 'InterchainGovernance']; + console.log(`Tx reverted due to error ${notSelf} for address ${event.to}`); break; default: console.log('No Error match found');