contract MyContract{
}
With Ethereum-wallet on the Morden testnet, if I try to send or deposit ETH, it gives an exception.
In browser-solidity, if I call the fallback function with msg.value = 10, it also throws an exception.
contract MyContract{
}
With Ethereum-wallet on the Morden testnet, if I try to send or deposit ETH, it gives an exception.
In browser-solidity, if I call the fallback function with msg.value = 10, it also throws an exception.
You will have to mark the fallback function () with the payable modifier for the contract to receive ethers.
From Solidity Version 0.4.0:
This release deliberately breaks backwards compatibility mostly to enforce some safety features. The most important change is that you have to explicitly specify if functions can receive ether via the payable modifier. Furthermore, more situations cause exceptions to be thrown.
Minimal changes to be made for upgrade:
- Add payable to all functions that want to receive Ether (including the constructor and the fallback function).
- Change _ to _; in modifiers.
- Add version pragma to each file: pragma solidity ^0.4.0;
...