contract TransferAuthorizations is Ownable, ITransferAuthorizations {

    /**
     * @dev The first key is the `from` address. The second key is the `to` address.
     *      The uint value of the mapping is the epoch time (seconds since 1/1/1970)
     *      of the expiration of the approved transfer.
     */
    mapping(address => mapping(address => uint)) public authorizations;

    /**
     * @dev This controller is the only contract allowed to call the `set` function.
     */
    address public controller;

    event TransferAuthorizationSet(address from, address to, uint expiry);

    function setController(address _controller) public onlyOwner {
        controller = _controller;
    }

    modifier onlyController() {
        assert(msg.sender == controller);
        _;
    }

    /**
     * @dev Sets the authorization for a transfer to occur between the 'from' and
     *      'to' addresses, to expire at the 'expiry' time.
     * @param from The address from which funds would be transferred.
     * @param to The address to which funds would be transferred. This can be
     *           the zero address to allow transfers to any address.
     * @param expiry The epoch time (seconds since 1/1/1970) at which point this
     *               authorization will no longer be valid.
     */
    function set(address from, address to, uint expiry) public onlyController {
        require(from != 0);
        authorizations[from][to] = expiry;
        emit TransferAuthorizationSet(from, to, expiry);
    }

    /**
     * @dev Returns the expiration time for the transfer authorization between the
     *      given addresses. Returns 0 if not allowed.
     * @param from The address from which funds would be transferred.
     * @param to The address to which funds would be transferred. This can be
     *           the zero address to allow transfers to any address.
     */
    function get(address from, address to) public view returns (uint) {
        return authorizations[from][to];
    }
}
function get(address from, address to) public view returns (uint) {
    return authorizations[from][to];
}

/**
 * @dev Returns the expiration time for the transfer authorization between the
 *      given addresses. Returns 0 if not allowed.
 * @param from The address from which funds would be transferred.
 * @param to The address to which funds would be transferred. This can be
 *           the zero address to allow transfers to any address.
 */