MCPcopy Create free account
hub / github.com/circlefin/arc-node / load

Method load

scripts/genesis/context.ts:57–83  ·  view source on GitHub ↗
(_network: Network, chainId: number)

Source from the content-addressed store, hash-verified

55
56export class ContractLoader {
57 static load(_network: Network, chainId: number) {
58 // call forge script to get the contract code
59 fs.mkdirSync(cacheDir, { recursive: true })
60 const outputPath = path.join(cacheDir, `storage-code.${chainId}.json`)
61 console.log(`Write storage code to ${outputPath}...`)
62 const result = spawnSync(
63 'forge',
64 [
65 'script',
66 './contracts/scripts/ArtifactHelper.s.sol',
67 '--sig',
68 'run(uint256,string,address)',
69 `${chainId}`,
70 outputPath,
71 validatorRegistryAddress,
72 ],
73 { cwd: projectRoot, stdio: 'inherit' },
74 )
75 if (result.status !== 0) {
76 throw new Error(`Failed to generate storage code`)
77 }
78 const data = schemaContractRepo.parse(JSON.parse(fs.readFileSync(outputPath, 'utf-8')))
79 const manifest = schemaManifest.parse(
80 JSON.parse(fs.readFileSync(path.join(projectRoot, 'assets/artifacts/manifest.json'), 'utf-8')),
81 )
82 return new ContractLoader(data, manifest)
83 }
84
85 constructor(
86 public repo: ContractRepo,

Callers 7

runMethod · 0.80
createBuilderContextFunction · 0.80
loadFunction · 0.80
txs_countMethod · 0.80
chain_bytesMethod · 0.80
height_startedMethod · 0.80

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected