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

Function simulateDeployerInsertion

tests/unit/deployer-nonce.test.ts:96–110  ·  view source on GitHub ↗
(contractManifest: Manifest, enabledContracts: readonly string[])

Source from the content-addressed store, hash-verified

94 describe('deployer insertion logic', () => {
95 // Simulate the deployer insertion logic from buildGenesis without the full pipeline.
96 const simulateDeployerInsertion = (contractManifest: Manifest, enabledContracts: readonly string[]) => {
97 const allocs: Record<string, GenesisAccountAlloc> = {}
98
99 for (const contractName of enabledContracts) {
100 const entry = contractManifest[contractName]
101 if (entry?.type === 'one-time-address') {
102 const [addr, alloc] = buildAccountAlloc({ address: entry.deployer, balance: 0n, nonce: 1n })
103 if (addr in allocs) {
104 throw new Error(`Duplicate deployer account: ${addr}`)
105 }
106 allocs[addr] = alloc
107 }
108 }
109 return allocs
110 }
111
112 it('inserts deployer allocs for all one-time-address contracts', () => {
113 const allocs = simulateDeployerInsertion(typedManifest, externalContracts)

Callers 1

Calls 1

buildAccountAllocFunction · 0.90

Tested by

no test coverage detected