HW09: Tokenized gym membership

Problem statement

Implement a smart contract for tokenized gym membership management.

Example scenario

Alice owns a gym. She creates an instance of this contract with 100 monthly pass tokens and transfers these tokens to the lucky winners of their recent contest.

The winners can trade with these passes, transferring them to other addresses if they want to.

Bob bought one of these passes from his friend, Claire. After this, every time Bob visits the gym, he shows his public address QR code to the receptionist, who scans it and validates Bob's membership through the smart contract. Bob's membership is valid for 30 days from the first time he went to the gym.

Contract interface

Contract skeleton

pragma solidity ^0.4.21;

contract GymMembership {

    // <contract_variables>

    // </contract_variables>

    function GymMembership(uint16 numPasses) public {
        // TODO
    }

    function transfer(uint16 passId, address to) public {
        // TODO
    }

    function validate(uint16 passId) public {
        // TODO
    }

}