I sent ETH to the address of deployment contract,and I mining.But I find this address still doesn't have ETH. Can I send ETH to the address of the deployment contract?
1 Answer
If you're sending ETH to a contract, it triggers the fallback function in the contract. If the fallback function isn't payable
(or isn't defined), the transaction will fail and your contract won't get any ether.
You can either create a payable fallback function, or you can create another function in the contract and mark it as payable
. Then you can call that function and pass the ETH to the contract.
You can read more about fallback functions in this answer