Hardhat cannot console.log msg.data
Asked Answered
V

1

7
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?

Viperous answered 24/12, 2021 at 23:50 Comment(0)
U
13

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

Uriah answered 7/1, 2022 at 19:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.