HW05: Pocket money

Problem statement

Implement a smart contract for giving pocket money to a child.

Example scenario

Alice and Bob create a contract with 10 ether initial balance, giving access to their daughter, Claire. On the first day of every month, Claire withdraws 0.1 ether as her pocket money. If she tries to withdraw again during the month, she fails. If Alice or Bob needs some money, they can freely withdraw any amount from the contract.

Contract interface

Contract skeleton

pragma solidity ^0.4.21;

contract PocketMoney {

    // <contract_variables>

    // </contract_variables>

    function PocketMoney(address parent2, address child) public payable {
        // TODO
    }

    function withdraw(uint256 amount) public {
        // TODO
    }

    function () public payable {
        // TODO
    }

}