solidity 出现 If you intended this as a fallback function or a function to handle plain ether transaction,use the "fallback" keyword or the "receive" keyword instead.原因是solidity升级版本,不支持function。
function() public payable {}
修改为
fallback() external payable{}
receive() external payable{}
参考:https://docs.soliditylang.org/en/v0.7.4/contracts.html#fallback-function