def decode_int(v):
    """Decodes integer value from hex string. Helper function useful when decoding data from contracts.

    :param str v: Hexadecimal string
    :return: Decoded number
    :rtype: num
    """
    if v[0:2] == '0x':
        return int(v.replace('0x', ''), 16)
    else:
        return int(v)