A basic NonReceivable contract template

Hi there, having designed a NonReceivable contract in our project, I thought maybe it could be made into the OZ repo as a basic abstract contract for future contracts that are not allowed to receive any Ethers.

// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;

abstract contract NonReceivable {
    error ReceiveDisabled();
    error FallbackDisabled();

    receive() external payable {
        revert ReceiveDisabled();

    fallback() external {
        revert FallbackDisabled();

contract Test is NonReceivable {

Hey @frangio, can you please take a look at this as well? Not sure if there is any potential issues. Would like to hear your comments.

This is not necessary, since rejecting ETH is already the default behavior of a contract in Solidity.

I see, indeed, just did a little test sending some ETHs to an empty contract, and got the error message below. Seems to be a new feature. Otherwise, there would not be many articles talking about mis-sending ETHs to contracts.

Error: Transaction reverted: function selector was not recognized and there’s no fallback nor receive function