HW03: Family wealth management

Problem statement

Implement a smart contract for shared wealth management for couples.

Example scenario

Alice and Bob create a contract with 10 ether initial balance. Every time they receive their salary, they transfer it to the contract. Every time they need money, they withdraw money from the contract, knowing that normally they can only withdraw 1 ether at a time.

One day, Bob needs to withdraw 10 ether. After they have discussed this, Alice approves a single withdraw over the limit setting 10 ether as the maximum withdraw amount. Bob can now withdraw 1 ether. If Bob tries to withdraw over the limit again, he will fail.

Contract interface

Contract skeleton

pragma solidity ^0.4.21;

contract WealthManager {

    // <contract_variables>

    // </contract_variables>

    function WealthManager(address partner2) public payable {
        // TODO
    }

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

    function sign(uint256 maxAmount) public {
        // TODO
    }

    function () public payable {
        // TODO
    }

}