HW18: Renovation fund (*)

Problem statement

Implement a smart contract for a managing the renovation fund of a shared flat.

Example scenario

Alice is the representative of a shared flat. She adds Bob, Claire, and Dan as residents.

After a while, Alice creates a proposal for repairing the roof. For this, she creates a pdf with all the details, which she uploads to the cloud. Then she submits the proposal to the smart contract, including a link to the pdf, the hash of the pdf for validation, the needed amount of ether, and a deadline.

Sometime before the deadline, Bob and Dan decide to vote "yes" for this proposal. This way, 2/3 of the residents agree with the proposal, so it is accepted. After the deadline, Alice can redeem the proposed amount to implement the proposal.

Later, Alice can submit new proposals, and the residents can vote for them just like before.

Contract interface

Contract skeleton

pragma solidity ^0.4.21;

contract RenovationFund {

    // <contract_variables>

    // </contract_variables>

    function RenovationFund() public {
        // TODO
    }

    function addResident(address resident) public {
        // TODO
    }

    function removeResident(address resident) public {
        // TODO
    }

    function submitProposal(uint256 amount, string link, string hash, uint256 deadline) public {
        // TODO
    }

    function vote(uint16 proposalId, bool voteYes) public {
        // TODO
    }

    function executeProposal() public {
        // TODO
    }

    function () public payable {
        // TODO
    }

}