I'm reading the Ethereum book of Gavin Wood right know and the following code example gives an error message when I try to compile it with truffle:
pragma solidity ^0.4.22;
contract calledContract {
event callEvent(address sender, address origin, address from);
function calledFunction() public {
emit callEvent(msg.sender, tx.origin, this);
}
}
library calledLibrary {
event callEvent(address sender, address origin, address from);
function calledFunction() public {
emit callEvent(msg.sender, tx.origin, this);
}
}
contract caller {
function make_calls(calledContract _calledContract) public {
// Calling calledContract and calledLibrary directly
_calledContract.calledFunction();
calledLibrary.calledFunction();
// Low-level calls using the address object for calledContract
require(address(_calledContract).
call(bytes4(keccak256("calledFunction()"))));
require(address(_calledContract).
delegatecall(bytes4(keccak256("calledFunction()"))));
}
}
https://github.com/ethereumbook/ethereumbook/tree/develop/code/truffle/CallExamples
It gives the following error message:
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined
Any ideas?