[
  {
    "type": "function",
    "name": "DOMAIN_SEPARATOR",
    "inputs": [],
    "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "MAX_PENALTY_FACTOR",
    "inputs": [],
    "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "MAX_REFUND_CLEARANCE",
    "inputs": [],
    "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "MAX_SETTLER_FEE",
    "inputs": [],
    "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "MIN_REFUND_CLEARANCE",
    "inputs": [],
    "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "ONE",
    "inputs": [],
    "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "balances",
    "inputs": [
      { "name": "user", "type": "address", "internalType": "address" },
      { "name": "token", "type": "address", "internalType": "address" }
    ],
    "outputs": [
      { "name": "amount", "type": "uint256", "internalType": "uint256" }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "batchSettle",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" },
      { "name": "isCompleted", "type": "bool[]", "internalType": "bool[]" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "cancelTask",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "create",
    "inputs": [
      {
        "name": "params",
        "type": "tuple",
        "internalType": "struct DataTypes.CreateTaskParams",
        "components": [
          { "name": "payload", "type": "bytes32", "internalType": "bytes32" },
          { "name": "committer", "type": "address", "internalType": "address" },
          { "name": "settler", "type": "address", "internalType": "address" },
          { "name": "joinGate", "type": "address", "internalType": "address" },
          {
            "name": "periodSeconds",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "penaltyConfig",
            "type": "tuple",
            "internalType": "struct DataTypes.PenaltyConfig",
            "components": [
              {
                "name": "resetType",
                "type": "uint8",
                "internalType": "enum DataTypes.PenaltyResetType"
              },
              {
                "name": "resetPeriod",
                "type": "uint256",
                "internalType": "uint256"
              },
              {
                "name": "factor",
                "type": "uint256",
                "internalType": "uint256"
              },
              { "name": "amount", "type": "uint256", "internalType": "uint256" }
            ]
          },
          {
            "name": "paymentConfig",
            "type": "tuple",
            "internalType": "struct DataTypes.PaymentConfig",
            "components": [
              {
                "name": "settlerFee",
                "type": "uint256",
                "internalType": "uint256"
              },
              {
                "name": "amountPerPeriod",
                "type": "uint256",
                "internalType": "uint256"
              },
              { "name": "token", "type": "address", "internalType": "address" }
            ]
          },
          { "name": "joinGateData", "type": "bytes", "internalType": "bytes" },
          {
            "name": "refundClearance",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "preFundingAmount",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "creationDeadline",
            "type": "uint256",
            "internalType": "uint256"
          }
        ]
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "createAndJoin",
    "inputs": [
      {
        "name": "params",
        "type": "tuple",
        "internalType": "struct DataTypes.CreateTaskParams",
        "components": [
          { "name": "payload", "type": "bytes32", "internalType": "bytes32" },
          { "name": "committer", "type": "address", "internalType": "address" },
          { "name": "settler", "type": "address", "internalType": "address" },
          { "name": "joinGate", "type": "address", "internalType": "address" },
          {
            "name": "periodSeconds",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "penaltyConfig",
            "type": "tuple",
            "internalType": "struct DataTypes.PenaltyConfig",
            "components": [
              {
                "name": "resetType",
                "type": "uint8",
                "internalType": "enum DataTypes.PenaltyResetType"
              },
              {
                "name": "resetPeriod",
                "type": "uint256",
                "internalType": "uint256"
              },
              {
                "name": "factor",
                "type": "uint256",
                "internalType": "uint256"
              },
              { "name": "amount", "type": "uint256", "internalType": "uint256" }
            ]
          },
          {
            "name": "paymentConfig",
            "type": "tuple",
            "internalType": "struct DataTypes.PaymentConfig",
            "components": [
              {
                "name": "settlerFee",
                "type": "uint256",
                "internalType": "uint256"
              },
              {
                "name": "amountPerPeriod",
                "type": "uint256",
                "internalType": "uint256"
              },
              { "name": "token", "type": "address", "internalType": "address" }
            ]
          },
          { "name": "joinGateData", "type": "bytes", "internalType": "bytes" },
          {
            "name": "refundClearance",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "preFundingAmount",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "creationDeadline",
            "type": "uint256",
            "internalType": "uint256"
          }
        ]
      },
      { "name": "joinGateData", "type": "bytes", "internalType": "bytes" },
      { "name": "v", "type": "uint8", "internalType": "uint8" },
      { "name": "r", "type": "bytes32", "internalType": "bytes32" },
      { "name": "s", "type": "bytes32", "internalType": "bytes32" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "deposit",
    "inputs": [
      { "name": "token", "type": "address", "internalType": "address" },
      { "name": "amount", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "depositAndTopUp",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" },
      { "name": "amount", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "getTask",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [
      {
        "name": "",
        "type": "tuple",
        "internalType": "struct DataTypes.Task",
        "components": [
          { "name": "committer", "type": "address", "internalType": "address" },
          {
            "name": "counterparty",
            "type": "address",
            "internalType": "address"
          },
          { "name": "payload", "type": "bytes32", "internalType": "bytes32" },
          { "name": "settler", "type": "address", "internalType": "address" },
          { "name": "joinGate", "type": "address", "internalType": "address" },
          { "name": "startDate", "type": "uint256", "internalType": "uint256" },
          {
            "name": "periodSeconds",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "penaltyConfig",
            "type": "tuple",
            "internalType": "struct DataTypes.PenaltyConfig",
            "components": [
              {
                "name": "resetType",
                "type": "uint8",
                "internalType": "enum DataTypes.PenaltyResetType"
              },
              {
                "name": "resetPeriod",
                "type": "uint256",
                "internalType": "uint256"
              },
              {
                "name": "factor",
                "type": "uint256",
                "internalType": "uint256"
              },
              { "name": "amount", "type": "uint256", "internalType": "uint256" }
            ]
          },
          {
            "name": "paymentConfig",
            "type": "tuple",
            "internalType": "struct DataTypes.PaymentConfig",
            "components": [
              {
                "name": "settlerFee",
                "type": "uint256",
                "internalType": "uint256"
              },
              {
                "name": "amountPerPeriod",
                "type": "uint256",
                "internalType": "uint256"
              },
              { "name": "token", "type": "address", "internalType": "address" }
            ]
          },
          {
            "name": "cancelledAtPeriod",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "refundClearance",
            "type": "uint256",
            "internalType": "uint256"
          }
        ]
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "getTaskStats",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [
      {
        "name": "",
        "type": "tuple",
        "internalType": "struct DataTypes.TaskStats",
        "components": [
          {
            "name": "lastSettledPeriod",
            "type": "uint256",
            "internalType": "uint256"
          },
          { "name": "funds", "type": "uint256", "internalType": "uint256" },
          {
            "name": "failureCount",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "lastFailedPeriod",
            "type": "uint256",
            "internalType": "uint256"
          }
        ]
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "join",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" },
      { "name": "joinGateData", "type": "bytes", "internalType": "bytes" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "nextTaskId",
    "inputs": [],
    "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "periodsOutcome",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" },
      { "name": "period", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [
      {
        "name": "status",
        "type": "uint8",
        "internalType": "enum DataTypes.TaskPeriodStatus"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "refund",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "refundAndWithdraw",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "settle",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" },
      { "name": "isCompleted", "type": "bool", "internalType": "bool" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "taskStats",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [
      {
        "name": "lastSettledPeriod",
        "type": "uint256",
        "internalType": "uint256"
      },
      { "name": "funds", "type": "uint256", "internalType": "uint256" },
      { "name": "failureCount", "type": "uint256", "internalType": "uint256" },
      {
        "name": "lastFailedPeriod",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "topUp",
    "inputs": [
      { "name": "taskId", "type": "uint256", "internalType": "uint256" },
      { "name": "amount", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "withdraw",
    "inputs": [
      { "name": "token", "type": "address", "internalType": "address" },
      { "name": "amount", "type": "uint256", "internalType": "uint256" }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "event",
    "name": "CommitterRefunded",
    "inputs": [
      {
        "name": "taskId",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "committer",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "amount",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "Deposited",
    "inputs": [
      {
        "name": "user",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "token",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "amount",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "TaskCancelled",
    "inputs": [
      {
        "name": "taskId",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "TaskCreated",
    "inputs": [
      {
        "name": "taskId",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "committer",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "TaskJoined",
    "inputs": [
      {
        "name": "taskId",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "user",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "TaskPeriodSettled",
    "inputs": [
      {
        "name": "taskId",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "period",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "isCompleted",
        "type": "bool",
        "indexed": false,
        "internalType": "bool"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "ToppedUp",
    "inputs": [
      {
        "name": "taskId",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "committer",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "amount",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "Withdrawn",
    "inputs": [
      {
        "name": "user",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "token",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "amount",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  { "type": "error", "name": "AlreadyJoined", "inputs": [] },
  { "type": "error", "name": "CancelledPeriod", "inputs": [] },
  { "type": "error", "name": "DuplicatePenalty", "inputs": [] },
  { "type": "error", "name": "ECDSAInvalidSignature", "inputs": [] },
  {
    "type": "error",
    "name": "ECDSAInvalidSignatureLength",
    "inputs": [
      { "name": "length", "type": "uint256", "internalType": "uint256" }
    ]
  },
  {
    "type": "error",
    "name": "ECDSAInvalidSignatureS",
    "inputs": [{ "name": "s", "type": "bytes32", "internalType": "bytes32" }]
  },
  { "type": "error", "name": "FeeTooHigh", "inputs": [] },
  { "type": "error", "name": "GateNotContract", "inputs": [] },
  { "type": "error", "name": "InsufficientFunds", "inputs": [] },
  { "type": "error", "name": "InvalidAmount", "inputs": [] },
  { "type": "error", "name": "InvalidAmountPerPeriod", "inputs": [] },
  { "type": "error", "name": "InvalidCommitter", "inputs": [] },
  { "type": "error", "name": "InvalidCreationDeadline", "inputs": [] },
  { "type": "error", "name": "InvalidPenaltyFactor", "inputs": [] },
  { "type": "error", "name": "InvalidPenaltyResetPeriod", "inputs": [] },
  { "type": "error", "name": "InvalidPeriod", "inputs": [] },
  { "type": "error", "name": "InvalidPreFundingAmount", "inputs": [] },
  { "type": "error", "name": "InvalidRefundClearance", "inputs": [] },
  { "type": "error", "name": "InvalidSettler", "inputs": [] },
  { "type": "error", "name": "InvalidSignature", "inputs": [] },
  { "type": "error", "name": "NotAllowed", "inputs": [] },
  { "type": "error", "name": "NotAllowedByGate", "inputs": [] },
  { "type": "error", "name": "NotAuthorized", "inputs": [] },
  {
    "type": "error",
    "name": "SafeERC20FailedOperation",
    "inputs": [
      { "name": "token", "type": "address", "internalType": "address" }
    ]
  },
  { "type": "error", "name": "TaskAlreadyCancelled", "inputs": [] },
  { "type": "error", "name": "TaskNotCreated", "inputs": [] }
]
