Hats Protocol Docs
hatsprotocol.xyzGithub
  • ๐Ÿ‘‹Welcome to Hats Protocol
  • ๐ŸงขGetting Started with Hats
  • โญQuick Start
  • Using The Hats App
    • ๐Ÿค Essentials For Hat Wearers
    • ๐ŸŽฉCreating My First Hat
    • ๐Ÿง™Admins: Creating, Issuing, and Revising Hats
    • ๐Ÿ‘ฅWhat Hats Do I Need?
    • ๐ŸŒณDrafting, Exporting, and Deploying Tree Changes
    • ๐Ÿ—๏ธSetting a Hat's Basic Properties
    • ๐ŸฅณAdding Wearers
    • ๐Ÿ”Connecting Hats w/ Permissions & Authorities
      • Types of Hat-Powered Authorities
      • Connecting Hats to Token Gates
        • Hats Protocol Contract Addresses
        • Finding a Hat's Token ID
      • Documenting Hat Powers & Responsibilities
    • ๐ŸŒŸRevocation & Eligibility: Requirements for Wearers
    • โšกDeactivating & Reactivating Hats
    • โœ…Making Hats Claimable
    • ๐Ÿ”—Linking Trees Together
    • โ›“๏ธHats Protocol Supported Chains
    • โ“Glossary & FAQ
  • Hats Integrations
    • ๐Ÿ”Permissions & Authorities
      • Coordinape
      • Council Voting Vault
      • Charmverse
      • Discord
        • Collab.Land --> Discord
        • Guild.xyz --> Discord
      • Farcaster Casting Rights
      • Fileverse
      • Google Workspace
      • Hats Account
      • Role-Based Compensation
      • Safe Multisig Signing Authority
      • Telegram
        • Collab.Land --> Telegram
        • Guild.xyz --> Telegram
      • Snapshot: Voting, Weight & Proposal Creation
      • Wonderverse
    • ๐ŸŒŸEligibility & Accountability Criteria
      • Agreement Eligibility
      • Allow-List Eligibility
      • CoLinks Eligibility
      • ERC20 Eligibility
      • ERC721 Eligibility
      • ERC1155 Eligibility
      • Hat-Wearing Eligibility
      • Hats Election Eligibility
      • JokeRace Eligibility
      • Pass-Through (Hat-Based) Eligibility
      • Staking Eligibility
      • Subscription or Membership Fee (Unlock Protocol)
      • Gitcoin Passport Eligibility
    • โšกActivation & Deactivation Criteria
      • Seasonal/ Time-Expiry Toggle
      • Pass-Through (Hat-Based) Toggle
    • ๐Ÿ‘ทHatter Modules
      • Multi Claims Hatter
      • DAOhaus Moloch v3 Membership & Share Allocation
  • For Developers
    • ๐Ÿ‘ทHats Protocol, for Developers
      • Hat Properties
      • Wearing a Hat
      • Hat Admins & Hatter Contracts
      • Hats Trees
      • Hat IDs
      • Linking Hats Trees
      • Eligibility Modules
      • Toggle Modules
      • Hat Mutability and Editing
      • Creating Hats
      • Minting Hats
      • Transfering Hats
      • Renouncing Hats
      • Batch Actions
      • Hat Image URIs
      • ERC1155 Compatibility
      • โ›“๏ธSupported Chains
    • ๐Ÿค–v1 Protocol Spec
      • Hats.sol
      • HatsEvents.sol
      • HatsErrors.sol
      • HatsIdUtilities.sol
      • Interfaces
        • IHats.sol
        • IHatsIdUtilities.sol
        • IHatsEligibility.sol
        • IHatsToggle.sol
    • ๐Ÿ–ฅ๏ธv1 SDK
      • Core
        • Getting Started
        • Onchain Reads
        • Onchain Writes
        • Multicall
        • Claiming Hats
        • Utilities
      • Subgraph
        • Getting Started
        • Fetching Hats
        • Fetching Wearers
        • Fetching Trees
        • Misc
        • Types
      • Hat Details
        • Getting Started
        • Usage
    • ๐Ÿ”ญv1 Subgraphs
    • ๐ŸงฉHats Modules
      • ๐Ÿ”ŒModules SDK
        • Getting Started
        • Get Available Modules
        • Create New Instance/s
        • Composing Modules
        • Interact With Instances
        • Utilities
        • Types
      • โš’๏ธBuilding Hats Modules
        • Inside a Hats Module
          • Immutable Arguments
          • Module Setup
          • Versioning
        • Creating New Modules
        • How Module Instances Are Deployed
        • Modules Registry
        • About Module Chains
    • ๐Ÿ”Hats Signer Gate v2
    • ๐Ÿ‘’Hats Signer Gate SDK
      • Getting Started
      • Creating New Instances
      • Hats Signer Gate
      • Multi Hats Signer Gate
      • HSG & MHSG Handlers
    • ๐Ÿ’ผHats Account SDK
      • 1 of N Hats Account
        • Getting Started
        • Creating New Instances
        • Executing From An Instance
        • Constants
        • Types
    • ๐ŸŒHats Security Audits
  • Legal
    • Terms
      • Terms of Service
      • Acceptable Use
      • Privacy Policy
      • Cookie Policy
      • Attribution
Powered by GitBook
On this page
  • Module
  • Role
  • WriteFunction
  • WriteFunctionArg
  • ModuleCreationArgs
  • ModuleCreationArg
  • Registry
  • ModuleParameter
  • ArgumentTsType
  • Ruleset
  1. For Developers
  2. Hats Modules
  3. Modules SDK

Types

Module

Represents a module object, compatible with the registry's module objects.

{
  name: string; // module's name
  details: string[]; // array of strings representing paragraphs that describe the module to end users.
  links: { // relevant links about the module
    label: string; // link's name
    link: string; // URL
  }[];
  parameters: { // module's dispaly parameters, chosen by its creator as relevant for dispaly to end users
    label: string; // parameter's name
    functionName: string; // name of the view or pure function that gets the parameter value
    displayType: string; // a free-text field that tells front ends how to generate a proper UI component for the parameter
  }[];
  type: { // type of module
    eligibility: boolean;
    toggle: boolean;
    hatter: boolean;
  };
  tags: {
    description: string;
    label: string;
    value: string;
  }[];
  implementationAddress: string; // module's implementation address, equal in every network
  deployments: { // networks the implementation is deployed and supported
    chainId: string; // chain's ID
    block: string; // block number of the deployment transaction
  }[];
  creationArgs: ModuleCreationArgs; // the arguments that are passed to the module factory's creation function
  customRoles: Role[]; // module's custom roles
  writeFunctions: WriteFunction[]; // module's write functions
  abi: Abi; // module's ABI
}

Role

A module's custom role. Each module role is associated with a hat and grants permissions to the hat's wearer(s) to call certain functions on the module contract.

There are two special roles with a reserved ID that are automatically added to each module:

  1. public role, associated with functions that are permitted to any caller

  2. hatAdmins role, associated with functions that are permitted to the target hat's admins

{
  id: string; // role's ID
  name: string; // role's name
  criteria: string; // The name of the contract function which can be used to retrieve the role's hat
  hatAdminsFallback?: boolean; // 'true' indicates that the role is granted to the target hat's admin(s) if/when the role's criteria function returns zero.
}

WriteFunction

The module's write functions. Each write function is associated with a role and grants permissions to the role's wearer(s) to call the function on the module contract.

{
  roles: string[]; // IDs of the roles that have the authority to call the function
  functionName: string; // the name of the function in the contract
  label: string; // the name to be displayed to end users
  description: string; // a description of the function to be displayed to end users
  primary?: boolean; // 'true' indicates that this function is the primary function of the roles it is associated with. Front ends can use this information to display the function more prominently for each role
  args: WriteFunctionArg[]; // the arguments of the function
}

WriteFunctionArg

Module write function argument.

{
  name: string; // arg's name 
  description: string; // arg's description
  type: string; // arg's solidity type, e.g. 'uint256'
  displayType: string; // a free-text field that tells front ends how to generate a proper UI component for the parameter
  optional?: boolean; // setting to 'true' indicates that this input is optional
}

ModuleCreationArgs

  • useHatId - By default, new instances should be created with the hatId value set to the target hat's ID. A false value here indicates that the module's hatId value should be set to zero.

  • In both the immutable and mutable array properties, the order of the arguments must match the order expected by the contract.

{
  useHatId: boolean; 
  immutable: ModuleCreationArg[];
  mutable: ModuleCreationArg[];
}

ModuleCreationArg

{
  name: string; // arg's name
  description: string; // arg's description
  type: string; // arg's solidity type, e.g. 'uint256'
  example: unknown; // example value 
  displayType: string; // a free-text field that tells front ends how to generate a proper UI component for the parameter
  optional?: boolean;
}

Registry

{
  modules: Module[];
}

ModuleParameter

{
  label: string;
  value: unknown;
  solidityType: string;
  displayType: string;
}

ArgumentTsType

| "number"
| "bigint"
| "string"
| "boolean"
| "number[]"
| "bigint[]"
| "string[]"
| "boolean[]"
| "unknown";

Ruleset

A modules ruleset is an array of module instances which are chained together with an 'AND' logical operator.

{
  module: Module; // the module's object from the registry
  address: `0x${string}`; // the module's instance address
}[]
PreviousUtilitiesNextBuilding Hats Modules

Last updated 1 year ago

The arguments that are passed to the module . The arguments are divided into two arrays: immutable and mutable. The immutable array contains arguments that are set once when the module instance is created and cannot be changed. The mutable array contains arguments that can be changed after the module instance is created.

Immutable/mutable argument, provided in the module's .

A object.

Module parameter object, as returned by the function.

A Typescript type, as returned by the .

๐Ÿงฉ
๐Ÿ”Œ
Hats Modules Registry
creation arguments
factory's creation function
getInstanceParameters
solidityToTypescriptType function