New answers tagged

0

An update to @eth's example for solidity v6: function definitions must be public keccak256 in place of sha3 call arguments use abi.encode() address() to get contract address pragma solidity ^0.6.0; contract D { uint public n; address public sender; function callSetN(address _e, uint _n) public { _e.call(abi.encode(bytes4(keccak256("...


2

This is because memory variables are treated as pointers from in solidity assembly - and that pointer points to the start in memory of the variable. The way arrays are stored in memory in Solidity is with the first 0x20 (32) bytes being the length of the data in the array, and then the actual data directly following, which is why add(bytecode, 0x20) is ...


Top 50 recent answers are included