preface

Solidity updates are really fast, with different syntax for each version, and the old versions of the blog have all kinds of errors as soon as they are compiled, so I’ve decided to either use the generic solcjs compiler or be diligent about finding documentation for solidity 0.8 with the latest documentation: Here are some of the problems I encountered with Solidity 0.8:

Q&A

  • Error: TypeError: Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.
  --> HelloWorld.sol:18:19:
   |
18 |             addr: msg.sender,
   |                   ^^^^^^^^^^
Copy the code
  • Solution: Solidity 0.8 versionmsg.senderfromaddress payableType toaddressThe following is the description of the document:So we need to cast MSG. Sender to:
    Human memory human = Human({
            addr: payable(msg.sender),
            name:_name,
            age:_age,
            sex:_sex
        });
    Copy the code
  • Waiting for bloggers to update…