0

I got this below error while compiling the contract...

ParserError: Expected a state variable declaration. If you intended this as a 
fallback function or a function to handle plain ether transactions, use the
"fallback" keyword or the "receive" keyword instead. 
--> contracts/mintableERC20.sol:212:34: | 212 | function () external payable { | ^

The fallback function is as given below:

function () external payable {
    revert();
}
1
  • You should be able to remove the fallback function entirely. The default fallback function reverts when ether is sent to the contract. – Ismael Jun 4 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.