Skip to main content
Bumped by Community user
Bumped by Community user
edited tags
Link
Rob Hitchens
  • 55.6k
  • 11
  • 91
  • 146

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?

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?

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?

Source Link

Code Example from “Mastering Ethereum: Building Smart Contracts and DApps” doesn't work

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?