Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hardhat cannot console.log msg.data

fallback() external {
        console.log(msg.data);  
        (bool result, ) = address(delegate).delegatecall(msg.data);
        if (result) {
            console.log("SUCESS");
            this;
        }
}

returns

TypeError: Member "log" not found or not visible after argument-dependent lookup in type(library console).
        console.log(msg.data);
        ^---------^

is there a restriction on what kind of data that can be console.logged? what does argument-dependent lookup even mean?


1 Answers

the hardhat console library has other functions for different data types. msg.data is calldata so it will be bytes. try console.logBytes(msg.data);

here is the code for console.sol: https://github.com/nomiclabs/hardhat/blob/master/packages/hardhat-core/console.sol

like image 193
Michael Daigler Avatar answered Jul 23 '26 13:07

Michael Daigler