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

Function getBytecodeFromFacet

contracts/scripts/util.ts:171–193  ·  view source on GitHub ↗
(facet)

Source from the content-addressed store, hash-verified

169}
170
171export async function getBytecodeFromFacet(facet) {
172 const facetName = facet.name
173 const libs = facet.libs
174 const factoryFileName = findFileInDir(
175 `${facetName}__factory.ts`,
176 `./typechain/factories/`,
177 )
178 if (factoryFileName === null) {
179 throw new Error('Typescript bindings for Facet not found')
180 }
181 const bytecodeNeedsLink =
182 getBytecodeFromFacetTypeChainFilename(factoryFileName)
183 let libs2 = {}
184 // Loop through each key in the libs
185 for (let key in libs) {
186 let newKey = `src/lib/${key}.sol:${key}`
187 libs2[newKey] = libs[key]
188 }
189
190 // Link the bytecode with the libraries
191 const bytecode = linker.linkBytecode(bytecodeNeedsLink, libs2)
192 return await getRuntimeBytecode(bytecode)
193}
194
195function getBytecodeFromFacetTypeChainFilename(fileName) {
196 try {

Callers 1

upgradeFacetFunction · 0.85

Calls 3

findFileInDirFunction · 0.85
getRuntimeBytecodeFunction · 0.85

Tested by

no test coverage detected