Connecting Hats to Token Gates
Last updated
Last updated
Hats are ERC1155 tokens, so they can be plugged into token gates to grant the wearers of that hat specific authorities, as long as 1) the wearerโs address is still eligible to wear the hat, and 2) the hat is still active.
You can think of it this way: token gates have two parts, the token and the gate. Hats provides the token, which gets plugged into the necessary gates, to give the hat wearer access to the proper authorities.
To connect a hat to a token-gate, locate the token-gating permissions for the platform or application you wish to use. In many cases, the process requires that you create a specific role in the platform that has special permissions associated with that role, and then add a specific requirement necessary for a user to hold that role (e.g., holding a particular Hats token). See the Hat-Gated Authorities section of these docs for guides for connecting hats to specific authorities and platforms.
At Guild.xyz, for example, which provides token-gating for Discord, Telegram, Github, and Google Workspace, you will create a role within your Guild, provide that Guild role with specific "rewards" (aka permissions), and then add a requirement that an address must have possession of a particular NFT to hold that Guild role.
To connect a hat to a token-gate, you will need to add an NFT (ERC1155) requirement. Then, you'll need to enter two details:
The Hats token ID (sometimes called a Custom ID) for the appropriate hat. This token ID will be the same for all wearers of a single hat.
See below for these details.
Hats Protocol Contract AddressesFinding a Hat's Token IDFinally, associate your Hats tree with the Guild/s:
Select "Edit Tree"
Locate and select the tree's top-hat
Select the "Hat Basics" section
Set the Guild name/s in the "Guilds" field
Now, Guild authorities will be automatically displayed on the relevant hats.