Contract Owner and require
Adding an Owner#
A common pattern in Solidity contracts is specifying an
The idea is this: when we create the contract, in the contract's constructor, we'll store the address of the account that created this contract. That account becomes the owner. When the contract is destroyed, we'll send the funds back to that owner.
Here's how we modify our bank to have an owner:
One problem with our destroy function is that anyone can call that function. We don't have any constraints on who can call
destroy and selfdestruct our contract!