To my understanding address(addr).code
and memory[...]
are in different places and since code memory is read-only, a usual call
doesn't seem to be able to achieve this, but is there any other way to e.g. execute code passed as function parameter?
function execute(bytes calldata _code) {
magically_call(_code)
}
I mean theoretically one could implement an EVM bytecode interpreter, but that would be quite an expensive contract...