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.
Learn more about the different TGR types and Collab.Land's supported blockchains in the Key Features.
Use the Role Composition miniapp to create TGRs that require holding a combination of different tokens. For example, you could require the possession of both a fungible token (ERC20
) and an NFT (ERC721
or ERC1155
) for access to a role.
How to Create a TGR
To create a TGR in Discord, follow these steps:
Log in to the Command Center at https://cc.collab.land using Discord.
From the left panel, select the server in which you would like to create the TGR. Then, click on "TGRs".
Click the "+ Select Role" button and choose the Discord role you would like to use for your TGR.
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
tokenId
s of the tokens required to obtain the role.
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".
If you need to start over, click "Reset". This action is not reversible.
Once you have filled in the fields, click "Save" to create your TGR.
Congratulations, you've created a TGR!
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
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):
Create a Balance-Based TGR
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.
Follow the normal steps of creating a TGR as listed above
Set the minimum amount of tokens (required)
Set the maximum amount of tokens (not required)
Click “Save”
Your balance-based TGR is ready! A complete balance-based TGR should look like this:
Create a Attributes-Based TGR (NFT only)
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.
Check out the tutorial for creating ERC721 Token Gating Rules using NFT Metadata on the Collab.Land YouTube channel.
Follow the normal steps of creating a TGR as listed above
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.
The "Attributes" button will only appear if you are using an NFT TGR type. Selected type must be ERC721
, ERC1155
, or equivalent NFT standard.
Select “Attributes”.
Click on the “+ Add Metadata” button.
A window will appear, allowing you to enter the
Trait
and itsValue
.
Attributes-based TGRs must be EXACT matches to the Trait
s and Value
s specified in the contract's metadata.
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.
Click on the “Add Trait” button.
Click “Save”
Your Attributes-based TGR is ready! This is what it should look like:
How to find NFT Metadata Traits
Check out our YouTube tutorial for how to find NFT metadata traits using OpenSea.