课程: Building an Ethereum Blockchain App: 8 Supply Chain Smart Contract dApp

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Token smart contract functions, part 2

Token smart contract functions, part 2

- There are four more functions. The balance of function is really easy. You send it an address and it simply returns the balances of owner of that address. And we see how mappings work, mappings basically return the value of what we give it. So let's scroll up a little bit for balances. I'm going to give it an owner, which is an address data type. So let's go back to the mapping for balances. Here's the mapping for balances. Mapping, the balances mapping maps an address to a uint 256. So in other words, it maps an address to a number. So if I give it an address, it's going to give me a number back. All right, let's scroll back down to the balance of, so I give it an address and it returns a number, which is the balance of that owner. That's how mappings work. The approved function is where we actually create that PO amount. I keep going back to the PO example because it's just an ongoing running example. Keep in…

内容