diff --git a/src/govv3/checks/targetsVerified.ts b/src/govv3/checks/targetsVerified.ts index ed7140d..9e17929 100644 --- a/src/govv3/checks/targetsVerified.ts +++ b/src/govv3/checks/targetsVerified.ts @@ -2,7 +2,7 @@ // adjusted for viem & aave governance v3 import { Hex, PublicClient } from 'viem'; import { ProposalCheck } from './types'; -import { TenderlySimulationResponse } from '../../utils/tenderlyClient'; +import { TenderlySimulationResponse, tenderly } from '../../utils/tenderlyClient'; import { PayloadsController } from '../payloadsController'; import { isKnownAddress } from '../utils/checkAddress'; import { flagKnownAddress } from '../utils/markdownUtils'; @@ -49,6 +49,13 @@ async function checkVerificationStatuses( const contract = getContract(sim, addr); info.push(`- ${addr}: Contract (verified) (${contract?.contract_name}) ${flagKnownAddress(isAddrKnown)}`); } else { + try { + if (isAddrKnown && isAddrKnown.length > 0) { + await tenderly.pingAddress(addr); + } + } catch (e) { + console.log('error pinging tenderly'); + } info.push(`- ${addr}: Contract (not verified) ${flagKnownAddress(isAddrKnown)}`); } } diff --git a/src/utils/tenderlyClient.ts b/src/utils/tenderlyClient.ts index f26c7f5..7327198 100644 --- a/src/utils/tenderlyClient.ts +++ b/src/utils/tenderlyClient.ts @@ -11,6 +11,7 @@ import { zeroAddress, PublicClient, Chain, + Address, } from 'viem'; import { EOA } from './constants'; import { logError, logInfo, logSuccess, logWarning } from './logger'; @@ -261,6 +262,24 @@ class Tenderly { this.PROJECT = project; } + /** + * Tenderly does a quite bad job with contract verification & simulation. + * When you simulate sth, touching a contract noone ever accessed via the dashboard it will not be available for state decoding. + * This method simply pings the dashboard to fetch the code from etherscan etc. so it will be available in the **next** simulation. + * @param chainId + * @param address + * @returns + */ + pingAddress = async (address: Address) => { + return fetch(`${this.TENDERLY_BASE}/search?query=${address}&quickSearch=true`, { + method: 'GET', + headers: new Headers({ + 'Content-Type': 'application/json', + 'X-Access-Key': this.ACCESS_TOKEN, + }), + }); + }; + trace = async (chainId: number, txHash: string): Promise => { const response = await fetch(`${this.TENDERLY_BASE}/public-contract/${chainId}/trace/${txHash}`, { method: 'GET',