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

Function buildAccountAlloc

scripts/genesis/types.ts:54–75  ·  view source on GitHub ↗
(config: AllocConfig)

Source from the content-addressed store, hash-verified

52}
53
54export const buildAccountAlloc = (config: AllocConfig): [Address, GenesisAccountAlloc] => {
55 const { address, balance, nonce, code, storage } = schemaAllocConfig.parse(config)
56 let storageMap: Record<Bytes32, Bytes32> | undefined
57 if (storage != null) {
58 storageMap = {} as Record<Bytes32, Bytes32>
59 for (const [key, value] of storage ?? []) {
60 if (key in storageMap) {
61 throw new Error(`Duplicate storage key: ${key}`)
62 }
63 storageMap[key] = value
64 }
65 }
66 return [
67 address,
68 {
69 balance: toHex(balance),
70 nonce: nonce === 0n ? undefined : toHex(nonce),
71 code,
72 storage: storageMap,
73 },
74 ]
75}
76
77export const buildImplContractAlloc = async (
78 ctx: BuilderContext,

Callers 5

buildGenesisFunction · 0.90
buildImplContractAllocFunction · 0.85
buildSystemContractAllocFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by 1