MCPcopy Create free account
hub / github.com/base/base / value_call_contract_initcode

Function value_call_contract_initcode

crates/execution/metering/src/meter.rs:999–1033  ·  view source on GitHub ↗
(target: Address)

Source from the content-addressed store, hash-verified

997 }
998
999 fn value_call_contract_initcode(target: Address) -> Bytes {
1000 // Runtime:
1001 // CALL(gas(), target, 1 wei, 0, 0, 0, 0)
1002 // STOP
1003 let mut runtime = Vec::new();
1004 runtime.extend_from_slice(&[0x60, 0x00]); // out size
1005 runtime.extend_from_slice(&[0x60, 0x00]); // out offset
1006 runtime.extend_from_slice(&[0x60, 0x00]); // in size
1007 runtime.extend_from_slice(&[0x60, 0x00]); // in offset
1008 runtime.extend_from_slice(&[0x60, 0x01]); // value
1009 runtime.push(0x73); // PUSH20 target
1010 runtime.extend_from_slice(target.as_slice());
1011 runtime.push(0x5a); // GAS
1012 runtime.push(0xf1); // CALL
1013 runtime.push(0x00); // STOP
1014
1015 assert!(runtime.len() <= u8::MAX as usize);
1016 let runtime_len = runtime.len() as u8;
1017
1018 let mut initcode = Vec::new();
1019 initcode.extend_from_slice(&[
1020 0x60,
1021 runtime_len,
1022 0x60,
1023 0x0a,
1024 0x5f,
1025 0x39, // CODECOPY(0, 10, runtime_len)
1026 0x60,
1027 runtime_len,
1028 0x5f,
1029 0xf3, // RETURN(0, runtime_len)
1030 ]);
1031 initcode.extend_from_slice(&runtime);
1032 Bytes::from(initcode)
1033 }
1034
1035 async fn deploy_value_call_contract(
1036 harness: &TestHarness,

Callers 1

Calls 3

newFunction · 0.50
pushMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected