MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / getOnChainBytecodeFromFacets

Function getOnChainBytecodeFromFacets

contracts/scripts/util.ts:228–245  ·  view source on GitHub ↗
(facets)

Source from the content-addressed store, hash-verified

226// Loop through each contract address in the facets
227// query web3 api to get deployed bytecode
228export async function getOnChainBytecodeFromFacets(facets) {
229 const deployedBytecode = {}
230 for (let contractAddress in facets) {
231 try {
232 // Fetch the bytecode of the contract
233 const bytecode = await ethers.provider.getCode(contractAddress)
234 deployedBytecode[bytecode] = contractAddress
235 // Log the bytecode to the console
236 } catch (error) {
237 // Print any errors to stderr
238 console.error(
239 `Error fetching bytecode for ${contractAddress}:`,
240 error.message,
241 )
242 }
243 }
244 return deployedBytecode
245}
246
247/**
248 * Filters the input array to only return strings that start with '0x'.

Callers 3

Calls

no outgoing calls

Tested by

no test coverage detected