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

Function contractDeployByteCode

tests/localdev/native_transfer.test.ts:500–518  ·  view source on GitHub ↗
(runtime: Hex)

Source from the content-addressed store, hash-verified

498 '0x55', // SSTORE(0, created_addr)
499 ])
500 const contractDeployByteCode = (runtime: Hex) => {
501 const size = BigInt(runtime.length - 2) / 2n
502 if (size > 0xffn) throw new Error('runtime too big for PUSH1 deployer')
503 const sz = toHex(size, { size: 1 })
504
505 // Minimal deployer (12 bytes): CODECOPY runtime → RETURN
506 // prettier-ignore
507 const deployer = concat([
508 '0x60', sz, // PUSH1 sz = runtime_size
509 '0x60', '0x0c', // PUSH1 12 = deployer_size
510 '0x60', '0x00', // PUSH1 0
511 '0x39', // CODECOPY(0, 12, size)
512 '0x60', sz, // PUSH1 size
513 '0x60', '0x00', // PUSH1 0
514 '0xf3', // RETURN(0, size)
515 ])
516
517 return concat([deployer, runtime])
518 }
519
520 const creatorAddr = await sender
521 .deployContract({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected