[
  {
    "type": "function",
    "name": "createHabit",
    "stateMutability": "nonpayable",
    "inputs": [
      { "name": "amount", "type": "uint96" },
      { "name": "frequency", "type": "uint8" },
      { "name": "chainId", "type": "uint32" },
      { "name": "method", "type": "string" }
    ],
    "outputs": [{ "name": "habitId", "type": "uint256" }]
  },
  {
    "type": "function",
    "name": "updateHabit",
    "stateMutability": "nonpayable",
    "inputs": [
      { "name": "habitId", "type": "uint256" },
      { "name": "amount", "type": "uint96" },
      { "name": "frequency", "type": "uint8" },
      { "name": "chainId", "type": "uint32" },
      { "name": "method", "type": "string" }
    ],
    "outputs": []
  },
  {
    "type": "function",
    "name": "confirmCycle",
    "stateMutability": "nonpayable",
    "inputs": [{ "name": "habitId", "type": "uint256" }],
    "outputs": []
  },
  {
    "type": "function",
    "name": "setArchived",
    "stateMutability": "nonpayable",
    "inputs": [
      { "name": "habitId", "type": "uint256" },
      { "name": "archived", "type": "bool" }
    ],
    "outputs": []
  },
  {
    "type": "function",
    "name": "getHabits",
    "stateMutability": "view",
    "inputs": [{ "name": "user", "type": "address" }],
    "outputs": [
      {
        "name": "",
        "type": "tuple[]",
        "components": [
          { "name": "amount", "type": "uint96" },
          { "name": "frequency", "type": "uint8" },
          { "name": "chainId", "type": "uint32" },
          { "name": "createdAt", "type": "uint64" },
          { "name": "updatedAt", "type": "uint64" },
          { "name": "archived", "type": "bool" },
          { "name": "method", "type": "string" },
          { "name": "cycles", "type": "uint64[]" }
        ]
      }
    ]
  },
  {
    "type": "function",
    "name": "getHabit",
    "stateMutability": "view",
    "inputs": [
      { "name": "user", "type": "address" },
      { "name": "habitId", "type": "uint256" }
    ],
    "outputs": [
      {
        "name": "",
        "type": "tuple",
        "components": [
          { "name": "amount", "type": "uint96" },
          { "name": "frequency", "type": "uint8" },
          { "name": "chainId", "type": "uint32" },
          { "name": "createdAt", "type": "uint64" },
          { "name": "updatedAt", "type": "uint64" },
          { "name": "archived", "type": "bool" },
          { "name": "method", "type": "string" },
          { "name": "cycles", "type": "uint64[]" }
        ]
      }
    ]
  },
  {
    "type": "function",
    "name": "habitCount",
    "stateMutability": "view",
    "inputs": [{ "name": "user", "type": "address" }],
    "outputs": [{ "name": "", "type": "uint256" }]
  },
  {
    "type": "function",
    "name": "cycleCount",
    "stateMutability": "view",
    "inputs": [
      { "name": "user", "type": "address" },
      { "name": "habitId", "type": "uint256" }
    ],
    "outputs": [{ "name": "", "type": "uint256" }]
  },
  {
    "type": "function",
    "name": "lastCycleTime",
    "stateMutability": "view",
    "inputs": [
      { "name": "user", "type": "address" },
      { "name": "habitId", "type": "uint256" }
    ],
    "outputs": [{ "name": "", "type": "uint64" }]
  },
  {
    "type": "function",
    "name": "habitFrequency",
    "stateMutability": "view",
    "inputs": [
      { "name": "user", "type": "address" },
      { "name": "habitId", "type": "uint256" }
    ],
    "outputs": [{ "name": "", "type": "uint8" }]
  },
  {
    "type": "event",
    "name": "HabitCreated",
    "inputs": [
      { "name": "user", "type": "address", "indexed": true },
      { "name": "habitId", "type": "uint256", "indexed": true },
      { "name": "amount", "type": "uint96", "indexed": false },
      { "name": "frequency", "type": "uint8", "indexed": false },
      { "name": "chainId", "type": "uint32", "indexed": false },
      { "name": "method", "type": "string", "indexed": false }
    ]
  },
  {
    "type": "event",
    "name": "HabitUpdated",
    "inputs": [
      { "name": "user", "type": "address", "indexed": true },
      { "name": "habitId", "type": "uint256", "indexed": true },
      { "name": "amount", "type": "uint96", "indexed": false },
      { "name": "frequency", "type": "uint8", "indexed": false },
      { "name": "chainId", "type": "uint32", "indexed": false },
      { "name": "method", "type": "string", "indexed": false }
    ]
  },
  {
    "type": "event",
    "name": "HabitArchived",
    "inputs": [
      { "name": "user", "type": "address", "indexed": true },
      { "name": "habitId", "type": "uint256", "indexed": true },
      { "name": "archived", "type": "bool", "indexed": false }
    ]
  },
  {
    "type": "event",
    "name": "CycleConfirmed",
    "inputs": [
      { "name": "user", "type": "address", "indexed": true },
      { "name": "habitId", "type": "uint256", "indexed": true },
      { "name": "timestamp", "type": "uint64", "indexed": false },
      { "name": "totalCycles", "type": "uint256", "indexed": false }
    ]
  },
  { "type": "error", "name": "HabitNotFound", "inputs": [] },
  { "type": "error", "name": "InvalidAmount", "inputs": [] },
  { "type": "error", "name": "InvalidMethod", "inputs": [] },
  { "type": "error", "name": "InvalidChain", "inputs": [] },
  { "type": "error", "name": "TooManyHabits", "inputs": [] },
  { "type": "error", "name": "CycleTooSoon", "inputs": [] },
  { "type": "error", "name": "Archived", "inputs": [] }
]
