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

Function getRuntimeBytecode

contracts/scripts/util.ts:151–169  ·  view source on GitHub ↗
(bytecode)

Source from the content-addressed store, hash-verified

149}
150
151export async function getRuntimeBytecode(bytecode) {
152 // Check if bytecode is provided
153 if (!bytecode) {
154 throw new Error('No bytecode provided')
155 }
156 const ganacheServer = await startGanache()
157
158 const provider = new providers.JsonRpcProvider(
159 `http://127.0.0.1:${isolatedPort}`,
160 )
161 const wallet = new Wallet(process.env.PRIVATE_KEY, provider)
162 const contractFactory = new ContractFactory([], bytecode, wallet)
163 const contract = await contractFactory.deploy({ gasPrice: 0 })
164 await contract.deployed()
165
166 const runtimeBytecode = await provider.getCode(contract.address)
167 stopGanache(ganacheServer)
168 return runtimeBytecode
169}
170
171export async function getBytecodeFromFacet(facet) {
172 const facetName = facet.name

Callers 1

getBytecodeFromFacetFunction · 0.85

Calls 2

startGanacheFunction · 0.85
stopGanacheFunction · 0.85

Tested by

no test coverage detected