This video is available to students only

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.

Making Bank#

Let's create a simple Bank contract:

We start by creating a new contract called Bank, and we'll emit an event DepositMade, whenever the deposit function is called.

 

This page is a preview of Million Ether Homepage

No discussions yet