Payable Contracts, payable Functions
A contract can own funds.
Remember how in the geth console we'd check the balances of our accounts?
What's happening here? That hash is the address of our account, and the Ethereum blockchain stores the number of Ether assigned to that account.
We can do the exact same thing with contracts! Remember that our contract is deployed to a particular address? That address is also the contracts account address. And that account can hold a balance.
Let's create a simple
We start by creating a new contract called
Bank, and we'll emit an event
DepositMade, whenever the
deposit function is called.