[
  {
    "name": "facets",
    "type": "function",
    "stateMutability": "pure",
    "inputs": [],
    "outputs": [
      {
        "type": "tuple[]",
        "components": [
          {
            "type": "address",
            "name": "facetAddress"
          },
          {
            "type": "bytes4[]",
            "name": "functionSelectors"
          }
        ]
      }
    ]
  },
  {
    "name": "facetFunctionSelectors",
    "type": "function",
    "stateMutability": "pure",
    "inputs": [
      {
        "type": "address",
        "name": "facet"
      }
    ],
    "outputs": [
      {
        "type": "bytes4[]",
        "name": "functionSelectors"
      }
    ]
  },
  {
    "name": "facetAddresses",
    "type": "function",
    "stateMutability": "pure",
    "inputs": [],
    "outputs": [
      {
        "type": "address[]",
        "name": "addresses"
      }
    ]
  },
  {
    "name": "facetAddress",
    "type": "function",
    "stateMutability": "pure",
    "inputs": [
      {
        "type": "bytes4",
        "name": "functionSelector"
      }
    ],
    "outputs": [
      {
        "type": "address"
      }
    ]
  },
  {
    "name": "emitDiamondCutEvent",
    "type": "function",
    "stateMutability": "nonpayable",
    "inputs": [],
    "outputs": [
      {
        "type": "bool"
      }
    ]
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "which",
        "type": "bytes32"
      }
    ],
    "name": "FeatureUnavailable",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      }
    ],
    "name": "InvalidAccountId",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      }
    ],
    "name": "InvalidPermission",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "origin",
        "type": "address"
      }
    ],
    "name": "OnlyAccountTokenProxy",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "target",
        "type": "address"
      }
    ],
    "name": "PermissionDenied",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "user",
        "type": "address"
      }
    ],
    "name": "PermissionNotGranted",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "PositionOutOfBounds",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ValueAlreadyInSet",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ValueNotInSet",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ZeroAddress",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "owner",
        "type": "address"
      }
    ],
    "name": "AccountCreated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "user",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "sender",
        "type": "address"
      }
    ],
    "name": "PermissionGranted",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "user",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "sender",
        "type": "address"
      }
    ],
    "name": "PermissionRevoked",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "createAccount",
    "outputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "requestedAccountId",
        "type": "uint128"
      }
    ],
    "name": "createAccount",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      }
    ],
    "name": "getAccountLastInteraction",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      }
    ],
    "name": "getAccountOwner",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      }
    ],
    "name": "getAccountPermissions",
    "outputs": [
      {
        "components": [
          {
            "internalType": "address",
            "name": "user",
            "type": "address"
          },
          {
            "internalType": "bytes32[]",
            "name": "permissions",
            "type": "bytes32[]"
          }
        ],
        "internalType": "struct IAccountModule.AccountPermissions[]",
        "name": "accountPerms",
        "type": "tuple[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getAccountTokenAddress",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "user",
        "type": "address"
      }
    ],
    "name": "grantPermission",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "user",
        "type": "address"
      }
    ],
    "name": "hasPermission",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "user",
        "type": "address"
      }
    ],
    "name": "isAuthorized",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      }
    ],
    "name": "notifyAccountTransfer",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      }
    ],
    "name": "renouncePermission",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "bytes32",
        "name": "permission",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "user",
        "type": "address"
      }
    ],
    "name": "revokePermission",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "expected",
        "type": "bytes32"
      },
      {
        "internalType": "bytes32",
        "name": "actual",
        "type": "bytes32"
      }
    ],
    "name": "MismatchAssociatedSystemKind",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "id",
        "type": "bytes32"
      }
    ],
    "name": "MissingAssociatedSystem",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "addr",
        "type": "address"
      }
    ],
    "name": "Unauthorized",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "kind",
        "type": "bytes32"
      },
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "id",
        "type": "bytes32"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "proxy",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "impl",
        "type": "address"
      }
    ],
    "name": "AssociatedSystemSet",
    "type": "event"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "id",
        "type": "bytes32"
      }
    ],
    "name": "getAssociatedSystem",
    "outputs": [
      {
        "internalType": "address",
        "name": "addr",
        "type": "address"
      },
      {
        "internalType": "bytes32",
        "name": "kind",
        "type": "bytes32"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "id",
        "type": "bytes32"
      },
      {
        "internalType": "string",
        "name": "name",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "symbol",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "uri",
        "type": "string"
      },
      {
        "internalType": "address",
        "name": "impl",
        "type": "address"
      }
    ],
    "name": "initOrUpgradeNft",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "id",
        "type": "bytes32"
      },
      {
        "internalType": "string",
        "name": "name",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "symbol",
        "type": "string"
      },
      {
        "internalType": "uint8",
        "name": "decimals",
        "type": "uint8"
      },
      {
        "internalType": "address",
        "name": "impl",
        "type": "address"
      }
    ],
    "name": "initOrUpgradeToken",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "id",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "endpoint",
        "type": "address"
      }
    ],
    "name": "registerUnmanagedSystem",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "implementation",
        "type": "address"
      }
    ],
    "name": "ImplementationIsSterile",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NoChange",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "contr",
        "type": "address"
      }
    ],
    "name": "NotAContract",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "addr",
        "type": "address"
      }
    ],
    "name": "NotNominated",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "UpgradeSimulationFailed",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "address",
        "name": "oldOwner",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "OwnerChanged",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "OwnerNominated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "self",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "implementation",
        "type": "address"
      }
    ],
    "name": "Upgraded",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "acceptOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getImplementation",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newNominatedOwner",
        "type": "address"
      }
    ],
    "name": "nominateNewOwner",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "nominatedOwner",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "owner",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "renounceNomination",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newImplementation",
        "type": "address"
      }
    ],
    "name": "simulateUpgradeTo",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newImplementation",
        "type": "address"
      }
    ],
    "name": "upgradeTo",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "indexed": false,
        "internalType": "bool",
        "name": "allowAll",
        "type": "bool"
      }
    ],
    "name": "FeatureFlagAllowAllSet",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "account",
        "type": "address"
      }
    ],
    "name": "FeatureFlagAllowlistAdded",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "account",
        "type": "address"
      }
    ],
    "name": "FeatureFlagAllowlistRemoved",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "indexed": false,
        "internalType": "address[]",
        "name": "deniers",
        "type": "address[]"
      }
    ],
    "name": "FeatureFlagDeniersReset",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "indexed": false,
        "internalType": "bool",
        "name": "denyAll",
        "type": "bool"
      }
    ],
    "name": "FeatureFlagDenyAllSet",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "bool",
        "name": "suspended",
        "type": "bool"
      }
    ],
    "name": "PerpMarketSuspended",
    "type": "event"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "account",
        "type": "address"
      }
    ],
    "name": "addToFeatureFlagAllowlist",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "enableAllFeatures",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      }
    ],
    "name": "getDeniers",
    "outputs": [
      {
        "internalType": "address[]",
        "name": "",
        "type": "address[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      }
    ],
    "name": "getFeatureFlagAllowAll",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      }
    ],
    "name": "getFeatureFlagAllowlist",
    "outputs": [
      {
        "internalType": "address[]",
        "name": "",
        "type": "address[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      }
    ],
    "name": "getFeatureFlagDenyAll",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "account",
        "type": "address"
      }
    ],
    "name": "isFeatureAllowed",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "internalType": "address",
        "name": "account",
        "type": "address"
      }
    ],
    "name": "removeFromFeatureFlagAllowlist",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "internalType": "address[]",
        "name": "deniers",
        "type": "address[]"
      }
    ],
    "name": "setDeniers",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "internalType": "bool",
        "name": "allowAll",
        "type": "bool"
      }
    ],
    "name": "setFeatureFlagAllowAll",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "feature",
        "type": "bytes32"
      },
      {
        "internalType": "bool",
        "name": "denyAll",
        "type": "bool"
      }
    ],
    "name": "setFeatureFlagDenyAll",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "suspendAllFeatures",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "_synthetix",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "constructor"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "synthetixCore",
        "type": "address"
      }
    ],
    "name": "InvalidCoreAddress",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "MarketNotFound",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OverflowInt256ToInt128",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OverflowInt256ToUint256",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OverflowUint128ToInt128",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OverflowUint256ToInt256",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OverflowUint256ToUint128",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OverflowUint256ToUint64",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "skew",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "fundingRate",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "fundingVelocity",
        "type": "int128"
      }
    ],
    "name": "FundingRecomputed",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "id",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "bytes32",
        "name": "name",
        "type": "bytes32"
      }
    ],
    "name": "MarketCreated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint128",
        "name": "size",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "skew",
        "type": "int128"
      }
    ],
    "name": "MarketSizeUpdated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "keeperFee",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint64",
        "name": "commitmentTime",
        "type": "uint64"
      }
    ],
    "name": "OrderCanceled",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "skew",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "uint128",
        "name": "utilizationRate",
        "type": "uint128"
      }
    ],
    "name": "UtilizationRecomputed",
    "type": "event"
  },
  {
    "inputs": [
      {
        "components": [
          {
            "internalType": "bytes32",
            "name": "name",
            "type": "bytes32"
          },
          {
            "internalType": "uint32",
            "name": "minDelegateTime",
            "type": "uint32"
          }
        ],
        "internalType": "struct IPerpMarketFactoryModule.CreatePerpMarketParameters",
        "name": "data",
        "type": "tuple"
      }
    ],
    "name": "createMarket",
    "outputs": [
      {
        "internalType": "uint128",
        "name": "",
        "type": "uint128"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getActiveMarketIds",
    "outputs": [
      {
        "internalType": "uint128[]",
        "name": "",
        "type": "uint128[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getMarketDigest",
    "outputs": [
      {
        "components": [
          {
            "components": [
              {
                "internalType": "address",
                "name": "collateralAddress",
                "type": "address"
              },
              {
                "internalType": "uint256",
                "name": "available",
                "type": "uint256"
              }
            ],
            "internalType": "struct IPerpMarketFactoryModule.DepositedCollateral[]",
            "name": "depositedCollaterals",
            "type": "tuple[]"
          },
          {
            "internalType": "bytes32",
            "name": "name",
            "type": "bytes32"
          },
          {
            "internalType": "int128",
            "name": "skew",
            "type": "int128"
          },
          {
            "internalType": "uint128",
            "name": "size",
            "type": "uint128"
          },
          {
            "internalType": "uint256",
            "name": "oraclePrice",
            "type": "uint256"
          },
          {
            "internalType": "int128",
            "name": "fundingVelocity",
            "type": "int128"
          },
          {
            "internalType": "int128",
            "name": "fundingRate",
            "type": "int128"
          },
          {
            "internalType": "uint128",
            "name": "utilizationRate",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "remainingLiquidatableSizeCapacity",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "lastLiquidationTime",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "totalTraderDebtUsd",
            "type": "uint128"
          },
          {
            "internalType": "uint256",
            "name": "totalCollateralValueUsd",
            "type": "uint256"
          },
          {
            "internalType": "int128",
            "name": "debtCorrection",
            "type": "int128"
          }
        ],
        "internalType": "struct IPerpMarketFactoryModule.MarketDigest",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getUtilizationDigest",
    "outputs": [
      {
        "components": [
          {
            "internalType": "uint128",
            "name": "lastComputedUtilizationRate",
            "type": "uint128"
          },
          {
            "internalType": "uint64",
            "name": "lastComputedTimestamp",
            "type": "uint64"
          },
          {
            "internalType": "uint128",
            "name": "currentUtilizationRate",
            "type": "uint128"
          },
          {
            "internalType": "uint256",
            "name": "utilization",
            "type": "uint256"
          }
        ],
        "internalType": "struct IPerpMarketFactoryModule.UtilizationDigest",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "minimumCredit",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "",
        "type": "uint128"
      }
    ],
    "name": "name",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "recomputeFunding",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "recomputeUtilization",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "reportedDebt",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes32",
        "name": "ethOracleNodeId",
        "type": "bytes32"
      }
    ],
    "name": "setEthOracleNodeId",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "contract IPyth",
        "name": "pyth",
        "type": "address"
      }
    ],
    "name": "setPyth",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "implementation",
        "type": "address"
      }
    ],
    "name": "setRewardDistributorImplementation",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bytes4",
        "name": "interfaceId",
        "type": "bytes4"
      }
    ],
    "name": "supportsInterface",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "string",
        "name": "parameter",
        "type": "string"
      },
      {
        "internalType": "string",
        "name": "reason",
        "type": "string"
      }
    ],
    "name": "InvalidParameter",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      }
    ],
    "name": "GlobalMarketConfigured",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      }
    ],
    "name": "MarketConfigured",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "getMarketConfiguration",
    "outputs": [
      {
        "components": [
          {
            "internalType": "contract IPyth",
            "name": "pyth",
            "type": "address"
          },
          {
            "internalType": "bytes32",
            "name": "ethOracleNodeId",
            "type": "bytes32"
          },
          {
            "internalType": "address",
            "name": "rewardDistributorImplementation",
            "type": "address"
          },
          {
            "internalType": "uint64",
            "name": "pythPublishTimeMin",
            "type": "uint64"
          },
          {
            "internalType": "uint64",
            "name": "pythPublishTimeMax",
            "type": "uint64"
          },
          {
            "internalType": "uint64",
            "name": "minOrderAge",
            "type": "uint64"
          },
          {
            "internalType": "uint64",
            "name": "maxOrderAge",
            "type": "uint64"
          },
          {
            "internalType": "uint256",
            "name": "minKeeperFeeUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "maxKeeperFeeUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint128",
            "name": "keeperProfitMarginUsd",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperProfitMarginPercent",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperSettlementGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperCancellationGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperLiquidationGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperFlagGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperLiquidateMarginGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "address",
            "name": "keeperLiquidationEndorsed",
            "type": "address"
          },
          {
            "internalType": "uint128",
            "name": "collateralDiscountScalar",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "minCollateralDiscount",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "maxCollateralDiscount",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "utilizationBreakpointPercent",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "lowUtilizationSlopePercent",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "highUtilizationSlopePercent",
            "type": "uint128"
          }
        ],
        "internalType": "struct PerpMarketConfiguration.GlobalData",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getMarketConfigurationById",
    "outputs": [
      {
        "components": [
          {
            "internalType": "bytes32",
            "name": "oracleNodeId",
            "type": "bytes32"
          },
          {
            "internalType": "bytes32",
            "name": "pythPriceFeedId",
            "type": "bytes32"
          },
          {
            "internalType": "uint128",
            "name": "makerFee",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "takerFee",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "maxMarketSize",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "maxFundingVelocity",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "skewScale",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "fundingVelocityClamp",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "minCreditPercent",
            "type": "uint128"
          },
          {
            "internalType": "uint256",
            "name": "minMarginUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "minMarginRatio",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "incrementalMarginScalar",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "maintenanceMarginScalar",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "maxInitialMarginRatio",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "liquidationRewardPercent",
            "type": "uint256"
          },
          {
            "internalType": "uint128",
            "name": "liquidationLimitScalar",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "liquidationWindowDuration",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "liquidationMaxPd",
            "type": "uint128"
          }
        ],
        "internalType": "struct PerpMarketConfiguration.Data",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "components": [
          {
            "internalType": "uint64",
            "name": "pythPublishTimeMin",
            "type": "uint64"
          },
          {
            "internalType": "uint64",
            "name": "pythPublishTimeMax",
            "type": "uint64"
          },
          {
            "internalType": "uint64",
            "name": "minOrderAge",
            "type": "uint64"
          },
          {
            "internalType": "uint64",
            "name": "maxOrderAge",
            "type": "uint64"
          },
          {
            "internalType": "uint256",
            "name": "minKeeperFeeUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "maxKeeperFeeUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint128",
            "name": "keeperProfitMarginPercent",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperProfitMarginUsd",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperSettlementGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperCancellationGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperLiquidationGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperFlagGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "keeperLiquidateMarginGasUnits",
            "type": "uint128"
          },
          {
            "internalType": "address",
            "name": "keeperLiquidationEndorsed",
            "type": "address"
          },
          {
            "internalType": "uint128",
            "name": "collateralDiscountScalar",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "minCollateralDiscount",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "maxCollateralDiscount",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "utilizationBreakpointPercent",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "lowUtilizationSlopePercent",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "highUtilizationSlopePercent",
            "type": "uint128"
          }
        ],
        "internalType": "struct IMarketConfigurationModule.GlobalMarketConfigureParameters",
        "name": "data",
        "type": "tuple"
      }
    ],
    "name": "setMarketConfiguration",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "components": [
          {
            "internalType": "uint128",
            "name": "marketId",
            "type": "uint128"
          },
          {
            "internalType": "bytes32",
            "name": "oracleNodeId",
            "type": "bytes32"
          },
          {
            "internalType": "bytes32",
            "name": "pythPriceFeedId",
            "type": "bytes32"
          },
          {
            "internalType": "uint128",
            "name": "makerFee",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "takerFee",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "maxMarketSize",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "maxFundingVelocity",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "skewScale",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "fundingVelocityClamp",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "minCreditPercent",
            "type": "uint128"
          },
          {
            "internalType": "uint256",
            "name": "minMarginUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "minMarginRatio",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "incrementalMarginScalar",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "maintenanceMarginScalar",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "maxInitialMarginRatio",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "liquidationRewardPercent",
            "type": "uint256"
          },
          {
            "internalType": "uint128",
            "name": "liquidationLimitScalar",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "liquidationWindowDuration",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "liquidationMaxPd",
            "type": "uint128"
          }
        ],
        "internalType": "struct IMarketConfigurationModule.ConfigureByMarketParameters",
        "name": "data",
        "type": "tuple"
      }
    ],
    "name": "setMarketConfigurationById",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "uint32",
        "name": "minDelegationTime",
        "type": "uint32"
      }
    ],
    "name": "setMinDelegationTime",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      }
    ],
    "name": "AccountNotFound",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "AccountSplitProportionTooLarge",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "AccountSplitProportionTooSmall",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "CanLiquidatePosition",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "CollateralFound",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "DuplicateEntries",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "InsufficientMargin",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "hook",
        "type": "address"
      }
    ],
    "name": "InvalidHook",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "InvalidPositionSide",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OrderFound",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OverflowInt128ToUint128",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "PositionFlagged",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "PositionFound",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "PositionNotFound",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ZeroProportion",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "fromId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "toId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "AccountSplit",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "fromId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "toId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "AccountsMerged",
    "type": "event"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getAccountDigest",
    "outputs": [
      {
        "components": [
          {
            "components": [
              {
                "internalType": "address",
                "name": "collateralAddress",
                "type": "address"
              },
              {
                "internalType": "uint256",
                "name": "available",
                "type": "uint256"
              },
              {
                "internalType": "uint256",
                "name": "oraclePrice",
                "type": "uint256"
              }
            ],
            "internalType": "struct IPerpAccountModule.DepositedCollateral[]",
            "name": "depositedCollaterals",
            "type": "tuple[]"
          },
          {
            "internalType": "uint256",
            "name": "collateralUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint128",
            "name": "debtUsd",
            "type": "uint128"
          },
          {
            "components": [
              {
                "internalType": "uint128",
                "name": "accountId",
                "type": "uint128"
              },
              {
                "internalType": "uint128",
                "name": "marketId",
                "type": "uint128"
              },
              {
                "internalType": "uint256",
                "name": "remainingMarginUsd",
                "type": "uint256"
              },
              {
                "internalType": "uint256",
                "name": "healthFactor",
                "type": "uint256"
              },
              {
                "internalType": "uint256",
                "name": "notionalValueUsd",
                "type": "uint256"
              },
              {
                "internalType": "int256",
                "name": "pnl",
                "type": "int256"
              },
              {
                "internalType": "int128",
                "name": "accruedFunding",
                "type": "int128"
              },
              {
                "internalType": "uint128",
                "name": "accruedUtilization",
                "type": "uint128"
              },
              {
                "internalType": "uint256",
                "name": "entryPythPrice",
                "type": "uint256"
              },
              {
                "internalType": "uint256",
                "name": "entryPrice",
                "type": "uint256"
              },
              {
                "internalType": "uint256",
                "name": "oraclePrice",
                "type": "uint256"
              },
              {
                "internalType": "int128",
                "name": "size",
                "type": "int128"
              },
              {
                "internalType": "uint256",
                "name": "im",
                "type": "uint256"
              },
              {
                "internalType": "uint256",
                "name": "mm",
                "type": "uint256"
              }
            ],
            "internalType": "struct IPerpAccountModule.PositionDigest",
            "name": "position",
            "type": "tuple"
          }
        ],
        "internalType": "struct IPerpAccountModule.AccountDigest",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getPositionDigest",
    "outputs": [
      {
        "components": [
          {
            "internalType": "uint128",
            "name": "accountId",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "marketId",
            "type": "uint128"
          },
          {
            "internalType": "uint256",
            "name": "remainingMarginUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "healthFactor",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "notionalValueUsd",
            "type": "uint256"
          },
          {
            "internalType": "int256",
            "name": "pnl",
            "type": "int256"
          },
          {
            "internalType": "int128",
            "name": "accruedFunding",
            "type": "int128"
          },
          {
            "internalType": "uint128",
            "name": "accruedUtilization",
            "type": "uint128"
          },
          {
            "internalType": "uint256",
            "name": "entryPythPrice",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "entryPrice",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "oraclePrice",
            "type": "uint256"
          },
          {
            "internalType": "int128",
            "name": "size",
            "type": "int128"
          },
          {
            "internalType": "uint256",
            "name": "im",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "mm",
            "type": "uint256"
          }
        ],
        "internalType": "struct IPerpAccountModule.PositionDigest",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "fromId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "toId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "mergeAccounts",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "fromId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "toId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "proportion",
        "type": "uint128"
      }
    ],
    "name": "splitAccount",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "ArrayLengthMismatch",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "DebtFound",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "available",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "InsufficientCollateral",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "distributor",
        "type": "address"
      }
    ],
    "name": "InvalidRewardDistributor",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "max",
        "type": "uint256"
      }
    ],
    "name": "MaxCollateralExceeded",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      }
    ],
    "name": "MissingRequiredCollateral",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NilCollateral",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NoDebt",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      }
    ],
    "name": "UnsupportedCollateral",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "ZeroAmount",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint128",
        "name": "oldDebt",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint128",
        "name": "newDebt",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint128",
        "name": "paidFromUsdCollateral",
        "type": "uint128"
      }
    ],
    "name": "DebtPaid",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "collaterals",
        "type": "uint256"
      }
    ],
    "name": "MarginCollateralConfigured",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      }
    ],
    "name": "MarginDeposit",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      }
    ],
    "name": "MarginWithdraw",
    "type": "event"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "getDiscountedCollateralPrice",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getMarginCollateralConfiguration",
    "outputs": [
      {
        "components": [
          {
            "internalType": "address",
            "name": "collateralAddress",
            "type": "address"
          },
          {
            "internalType": "bytes32",
            "name": "oracleNodeId",
            "type": "bytes32"
          },
          {
            "internalType": "uint128",
            "name": "maxAllowable",
            "type": "uint128"
          },
          {
            "internalType": "uint128",
            "name": "skewScale",
            "type": "uint128"
          },
          {
            "internalType": "address",
            "name": "rewardDistributor",
            "type": "address"
          }
        ],
        "internalType": "struct IMarginModule.ConfiguredCollateral[]",
        "name": "",
        "type": "tuple[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getMarginDigest",
    "outputs": [
      {
        "components": [
          {
            "internalType": "uint256",
            "name": "discountedMarginUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "marginUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "discountedCollateralUsd",
            "type": "uint256"
          },
          {
            "internalType": "uint256",
            "name": "collateralUsd",
            "type": "uint256"
          }
        ],
        "internalType": "struct Margin.MarginValues",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getMarginLiquidationOnlyReward",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "uint256",
        "name": "oraclePrice",
        "type": "uint256"
      }
    ],
    "name": "getNetAssetValue",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getWithdrawableMargin",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      },
      {
        "internalType": "int256",
        "name": "amountDelta",
        "type": "int256"
      }
    ],
    "name": "modifyCollateral",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "amount",
        "type": "uint128"
      }
    ],
    "name": "payDebt",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "collateralAddress",
        "type": "address"
      },
      {
        "internalType": "uint128",
        "name": "maxAllowable",
        "type": "uint128"
      }
    ],
    "name": "setCollateralMaxAllowable",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address[]",
        "name": "collateralAddresses",
        "type": "address[]"
      },
      {
        "internalType": "bytes32[]",
        "name": "oracleNodeIds",
        "type": "bytes32[]"
      },
      {
        "internalType": "uint128[]",
        "name": "maxAllowables",
        "type": "uint128[]"
      },
      {
        "internalType": "uint128[]",
        "name": "skewScales",
        "type": "uint128[]"
      },
      {
        "internalType": "address[]",
        "name": "rewardDistributors",
        "type": "address[]"
      }
    ],
    "name": "setMarginCollateralConfiguration",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "withdrawAllCollateral",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "hook",
        "type": "address"
      }
    ],
    "name": "DuplicateHook",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "InsufficientLiquidity",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "InvalidPrice",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "MaxHooksExceeded",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "MaxMarketSizeExceeded",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "NilOrder",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OrderNotFound",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OrderNotReady",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OrderNotStale",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "OrderStale",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "int128",
        "name": "sizeDelta",
        "type": "int128"
      },
      {
        "internalType": "uint256",
        "name": "price",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "limitPrice",
        "type": "uint256"
      }
    ],
    "name": "PriceToleranceExceeded",
    "type": "error"
  },
  {
    "inputs": [
      {
        "internalType": "int128",
        "name": "sizeDelta",
        "type": "int128"
      },
      {
        "internalType": "uint256",
        "name": "price",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "limitPrice",
        "type": "uint256"
      }
    ],
    "name": "PriceToleranceNotExceeded",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint64",
        "name": "commitmentTime",
        "type": "uint64"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "sizeDelta",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "estimatedOrderFee",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "estimatedKeeperFee",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "bytes32",
        "name": "trackingCode",
        "type": "bytes32"
      }
    ],
    "name": "OrderCommitted",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint64",
        "name": "settlementTime",
        "type": "uint64"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "sizeDelta",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "orderFee",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "keeperFee",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "accruedFunding",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "uint128",
        "name": "accruedUtilization",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "int256",
        "name": "pnl",
        "type": "int256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "fillPrice",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint128",
        "name": "accountDebt",
        "type": "uint128"
      }
    ],
    "name": "OrderSettled",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "hook",
        "type": "address"
      }
    ],
    "name": "OrderSettlementHookExecuted",
    "type": "event"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "bytes",
        "name": "priceUpdateData",
        "type": "bytes"
      }
    ],
    "name": "cancelOrder",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "cancelStaleOrder",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "int128",
        "name": "sizeDelta",
        "type": "int128"
      },
      {
        "internalType": "uint256",
        "name": "limitPrice",
        "type": "uint256"
      },
      {
        "internalType": "uint128",
        "name": "keeperFeeBufferUsd",
        "type": "uint128"
      },
      {
        "internalType": "address[]",
        "name": "hooks",
        "type": "address[]"
      },
      {
        "internalType": "bytes32",
        "name": "trackingCode",
        "type": "bytes32"
      }
    ],
    "name": "commitOrder",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "int128",
        "name": "size",
        "type": "int128"
      }
    ],
    "name": "getFillPrice",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getOraclePrice",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getOrderDigest",
    "outputs": [
      {
        "components": [
          {
            "internalType": "int128",
            "name": "sizeDelta",
            "type": "int128"
          },
          {
            "internalType": "uint64",
            "name": "commitmentTime",
            "type": "uint64"
          },
          {
            "internalType": "uint256",
            "name": "limitPrice",
            "type": "uint256"
          },
          {
            "internalType": "uint128",
            "name": "keeperFeeBufferUsd",
            "type": "uint128"
          },
          {
            "internalType": "address[]",
            "name": "hooks",
            "type": "address[]"
          },
          {
            "internalType": "bool",
            "name": "isStale",
            "type": "bool"
          },
          {
            "internalType": "bool",
            "name": "isReady",
            "type": "bool"
          }
        ],
        "internalType": "struct IOrderModule.OrderDigest",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "int128",
        "name": "sizeDelta",
        "type": "int128"
      },
      {
        "internalType": "uint128",
        "name": "keeperFeeBufferUsd",
        "type": "uint128"
      }
    ],
    "name": "getOrderFees",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "orderFee",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "keeperFee",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "bytes",
        "name": "priceUpdateData",
        "type": "bytes"
      }
    ],
    "name": "settleOrder",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "CannotLiquidateMargin",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "CannotLiquidatePosition",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "LiquidationZeroCapacity",
    "type": "error"
  },
  {
    "inputs": [],
    "name": "PositionNotFlagged",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "keeperReward",
        "type": "uint256"
      }
    ],
    "name": "MarginLiquidated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "flagger",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "flagKeeperReward",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "flaggedPrice",
        "type": "uint256"
      }
    ],
    "name": "PositionFlaggedLiquidation",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "indexed": true,
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "sizeBeforeLiquidation",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "int128",
        "name": "remainingSize",
        "type": "int128"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "keeper",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "address",
        "name": "flagger",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "liqKeeperFee",
        "type": "uint256"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "liquidationPrice",
        "type": "uint256"
      }
    ],
    "name": "PositionLiquidated",
    "type": "event"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "flagPosition",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getHealthFactor",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getLiquidationFees",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "flagKeeperReward",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "liqKeeperFee",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      },
      {
        "internalType": "int128",
        "name": "sizeDelta",
        "type": "int128"
      }
    ],
    "name": "getLiquidationMarginUsd",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "im",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "mm",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "getRemainingLiquidatableSizeCapacity",
    "outputs": [
      {
        "internalType": "uint128",
        "name": "maxLiquidatableCapacity",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "remainingCapacity",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "lastLiquidationTimestamp",
        "type": "uint128"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "isMarginLiquidatable",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "isPositionLiquidatable",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "liquidateMarginOnly",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint128",
        "name": "accountId",
        "type": "uint128"
      },
      {
        "internalType": "uint128",
        "name": "marketId",
        "type": "uint128"
      }
    ],
    "name": "liquidatePosition",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "ZeroLength",
    "type": "error"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "distributor",
        "type": "address"
      }
    ],
    "name": "RewardDistributorCreated",
    "type": "event"
  },
  {
    "inputs": [
      {
        "components": [
          {
            "internalType": "uint128",
            "name": "poolId",
            "type": "uint128"
          },
          {
            "internalType": "address[]",
            "name": "collateralTypes",
            "type": "address[]"
          },
          {
            "internalType": "string",
            "name": "name",
            "type": "string"
          },
          {
            "internalType": "address",
            "name": "token",
            "type": "address"
          }
        ],
        "internalType": "struct IPerpRewardDistributorFactoryModule.CreatePerpRewardDistributorParameters",
        "name": "data",
        "type": "tuple"
      }
    ],
    "name": "createRewardDistributor",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "hooks",
        "type": "uint256"
      }
    ],
    "name": "SettlementHookConfigured",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "getSettlementHookConfiguration",
    "outputs": [
      {
        "components": [
          {
            "internalType": "address[]",
            "name": "whitelistedHookAddresses",
            "type": "address[]"
          },
          {
            "internalType": "uint32",
            "name": "maxHooksPerOrder",
            "type": "uint32"
          }
        ],
        "internalType": "struct ISettlementHookModule.SettlementHookConfigureParameters",
        "name": "",
        "type": "tuple"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "hook",
        "type": "address"
      }
    ],
    "name": "isSettlementHookWhitelisted",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "components": [
          {
            "internalType": "address[]",
            "name": "whitelistedHookAddresses",
            "type": "address[]"
          },
          {
            "internalType": "uint32",
            "name": "maxHooksPerOrder",
            "type": "uint32"
          }
        ],
        "internalType": "struct ISettlementHookModule.SettlementHookConfigureParameters",
        "name": "data",
        "type": "tuple"
      }
    ],
    "name": "setSettlementHookConfiguration",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "hooks",
        "type": "uint256"
      }
    ],
    "name": "SplitAccountConfigured",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "getEndorsedSplitAccounts",
    "outputs": [
      {
        "internalType": "address[]",
        "name": "addresses",
        "type": "address[]"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "addr",
        "type": "address"
      }
    ],
    "name": "isEndorsedForSplitAccount",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address[]",
        "name": "addresses",
        "type": "address[]"
      }
    ],
    "name": "setEndorsedSplitAccounts",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]