Skip to main content

How to create a TGR

TGRs are Token Gating Rules, the rules that determine which roles a member will be assigned based on the token-related criteria defined by the community admin.

For example, a TGR may grant access to a "VIP" role for members who hold a certain number of tokens.

info

Learn more about the different TGR types and Collab.Land's supported blockchains in the Key Features.

How to Create a TGR

To create a TGR in Discord, follow these steps:

  1. Log in to the Command Center at https://cc.collab.land using Discord.

  2. From the left panel, select the server in which you would like to create the TGR. Then, click on "TGRs".

  3. Click the "+ Select Role" button and choose the Discord role you would like to use for your TGR.

  4. You will be taken to the TGR configuration page. Fill in the fields to create your TGR. If any information provided is incorrect, an error message will appear. The fields include:

    • Description (optional): A description of your TGR that will only be displayed in the CC for reference purposes.

    • Chain type: The blockchain network that the token for this TGR is on. See the full list of Collab.Land-supported chains and corresponding token types.

    • Token type: The type of token used for the TGR.

    • Address: The contract address of your token.

    • Token ID (optional): Give the specific tokenIds of the tokens required to obtain the role.

caution

tokenId is required for TGRs that use ERC1155 tokens. Check out the ERC1155 TGR creation tutorial on the Collab.Land YouTube channel.

  • Balance: The minimum and maximum (optional) amount of tokens required to obtain the role.

  • Attributes (conditional): For specific tokens, such as NFTs, you can add metadata conditions that must be met in order for the member to receive the role. If your NFT contains metadata traits and values, you can enter them by clicking on the "Attributes" button and then "Add metadata".

  1. If you need to start over, click "Reset". This action is not reversible.

  2. Once you have filled in the fields, click "Save" to create your TGR.

Congratulations, you've created a TGR!

info

If you are using the tokenId field, you must provide Token IDs separated by commas, with no spaces. Using ranges with - are supported as well.

Supported Token ID formats

  • Range: 11-99

  • List: 1,2,3,4

  • List combined with range(s): 1,2,42-69,90,101-105

tip

If you have to enter many Token IDs or the list of IDs will change, you can enter a URL that links to a list of Token IDs in plaintext format.

  • URL list of Token ID(s):

    1. Create the list locally as a .txt file, using the same formats as above.

    2. Upload the .txt file to a hosting service such as Pinata, GitHub, IPFS, or S3 to generate the URL.

    3. Paste the host URL in the Token ID field.

Create a Balance-Based TGR

info

Balance-Based TGRs mean that a member will receive a role if they hold the minimum number of tokens or more.

This TGR type is commonly used for ERC20 gating and for holding a number of any tokens from an NFT collection.

  1. Follow the normal steps of creating a TGR as listed above

  2. Set the minimum amount of tokens (required)

  3. Set the maximum amount of tokens (not required).

  4. Click “Save”

Your balance-based TGR is ready! A complete balance-based TGR should look like this:

Create a balance-based TGR

Create a Attributes-Based TGR

This type of TGR is used to create roles based on ownership of specific kinds of NFTs from a collection.

For example, an admin can use an Attributes-Based TGR to check for a BAYC ape with blue fur in the member's wallet.

tip

Check out the tutorial for creating ERC721 Token Gating Rules using NFT Metadata on the Collab.Land YouTube channel.

  1. Follow the normal steps of creating a TGR as listed above

  2. Since you have chosen to create an Attributes-based TGR, when you picked the Token Type, an “Attributes” button has appeared next to the “Balance” option.

caution

The "Attributes" button will only appear if you are using an NFT TGR type. Selected type must be ERC721, ERC1155, or equivalent NFT standard.

  1. Select “Attributes”.

  2. Click on the “+ Add Metadata” button.

  3. A window will appear, allowing you to enter the Trait and its Value.

    Create metadata-based TGR
danger

Attributes-based TGRs must be EXACT matches to the Traits and Values specified in the contract's metadata.

  1. If you want to add multiple Traits:

    • Select AND if all the traits should match. If you choose the AND option (default) then the member will have to hold one NFT with all of the trait value pairs which have been listed here.

    • Select OR if at least one of the traits should match. If you choose the OR option, the member will have to hold one NFT with at least one of the trait value pairs which have been listed.

  2. Click on the “Add Trait” button.

  3. Click “Save”

Your Attributes-based TGR is ready! This is what it should look like:

Create an attributes-based TGR

How to find NFT Metadata Traits

tip

Check out our YouTube tutorial for how to find NFT metadata traits using OpenSea.