diff --git a/tenderly-suite/add-to-project-action/add-to-project/addToProject.js b/tenderly-suite/add-to-project-action/add-to-project/addToProject.js index c9a49389..154e2b3b 100644 --- a/tenderly-suite/add-to-project-action/add-to-project/addToProject.js +++ b/tenderly-suite/add-to-project-action/add-to-project/addToProject.js @@ -1,17 +1,19 @@ +const { ethers } = require('ethers'); const axios = require('axios').default; -const TOKEN_MANAGER_DEPLOYED_TOPIC0 = '0x5284c2478b9c1a55e973429331078be39b5fb3eeb9d87d10b34d65a4c89ee4eb'; - const addToProjectFn = async (context, event) => { if (!event || !event.logs || !context || !context.metadata) { throw new Error('INVALID_INPUT_FOR_ACTION'); } + const { tokenManagerDeployed } = await context.storage.getJson('EventsABI'); + const tokenManagerDeployedHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(tokenManagerDeployed)); + const logs = event.logs; const contracts = []; for (let index = 0; index < logs.length; ++index) { - if (logs[index].topics[0] === TOKEN_MANAGER_DEPLOYED_TOPIC0) { + if (logs[index].topics[0] === tokenManagerDeployedHash) { if (logs[index].data.length < 66) { throw new Error('INVALID_LOG_DATA_LENGTH'); }