solidity/test/libsolidity/semanticTests/various/code_access_runtime.sol
Daniel Kirchner 44da8507b1 Change default EVM version to Shanghai.
Co-authored-by: Rodrigo Q. Saramago <rodrigoqsaramago@gmail.com>
2023-05-08 16:34:23 +02:00

28 lines
466 B
Solidity

contract D {
uint256 x;
constructor() {
x = 7;
}
function f() public view returns (uint256) {
return x;
}
}
contract C {
function test() public returns (uint256) {
D d = new D();
bytes32 hash;
assembly { hash := extcodehash(d) }
assert(hash == keccak256(type(D).runtimeCode));
return 42;
}
}
// ====
// EVMVersion: >=constantinople
// ----
// test() -> 42
// gas legacy: 100225