nonpayable
Nonpayable is a function mutability specifier in Solidity that marks a function as able to modify state but not accept Ether. A nonpayable function will reject any incoming Ether sent with the call, causing the transaction to revert if value is provided.
In contrast, a payable function is explicitly allowed to receive Ether. The nonpayable modifier is used to
Nonpayable functions are commonly used for internal logic, administrative actions, or state-changing operations that should not
It is important to distinguish nonpayable functions from the contract’s fallback and receive functions. Ether can
// This function cannot receive Ether
function increment() external nonpayable {
}
}
In summary, nonpayable explicitly disallows sending Ether to a function, while payable permits it; both are