solidstate-network/solidstate-solidity

This contract has a payable fallback function, but no receive ether function.

jewelsonn opened this issue · 1 comments

I get this warning if I compile it through truffle

My Contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { SolidStateDiamond } from "@solidstate/contracts/proxy/diamond/SolidStateDiamond.sol";

contract Diamond is SolidStateDiamond {} 

The Error:

Compilation warnings encountered:

    Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
 --> @solidstate/contracts/proxy/diamond/fallback/IDiamondFallback.sol:7:1:
  |
7 | interface IDiamondFallback is IDiamondBase {
  | ^ (Relevant source part starts here and spans across multiple lines).
Note: The payable fallback function is defined here.
 --> @solidstate/contracts/proxy/IProxy.sol:8:5:
  |
8 |     fallback() external payable;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

,Warning: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.
  --> @solidstate/contracts/proxy/diamond/fallback/DiamondFallback.sol:15:1:
   |
15 | abstract contract DiamondFallback is
   | ^ (Relevant source part starts here and spans across multiple lines).
Note: The payable fallback function is defined here.
  --> @solidstate/contracts/proxy/Proxy.sol:19:5:
   |
19 |     fallback() external payable virtual {
   |     ^ (Relevant source part starts here and spans across multiple lines).

This error is meaningless. If you want to suppress it, there might be a plugin you can use (there is one for Hardhat, not sure about Truffle). You could also add something like this:

receive () external {
  revert('unimplemented');
}