Conductive web3 Token Gate is a service that allows any user holding your token in a wallet to submit their profile. The service will verify that the user owns the wallet and then store the profile data in a database, from where it can be accessed by your application later, or exported directly.
The service provides a way to filter tokens by ID or by held quantity.
Frontend included with service has some options for customization, but you are not limited to it. You can use your own frontend or integrate the service with your existing application, using the API.
Code can be run in two ways:
- Using docker-compose
docker-compose up
- Using Google Cloud Functions
There are
cloudbuild.yml
files in each directory. You can use them to deploy the function to Google Cloud Functions, and upload built files to Google Cloud Storage. Read more about it here.
When running locally or in docker, specify environment variables in backend/.env
:
DATABASE_NAME=...
DATABASE_USER=...
DATABASE_PASSWORD=...
DATABASE_HOST=...
DATABASE_PORT=...
SECRET_KEY=... (any secure random string, will be used for jwt signing)
ETHERSCAN_API_KEY=... (leave blank if you are not planning to use ethereum mainnet)
BSCSCAN_API_KEY=... (leave blank if you are not planning to use binance smart chain)
POLYGONSCAN_API_KEY=... (leave blank if you are not planning to use polygon)
RPC_ENDPOINTS={"1": "https://..."} (map chain id to RPC url)
Database migrations can be applied with the following command:
docker-compose run --rm backend pem migrate
Postgres materialized views can be created with the following command:
docker-compose run --rm backend python run_command.py init-views
Context is a combination of organization and smart contract. Each context will have its own verification link, and its own set of rules, such as token ID whitelist, token threshold, etc.
Organization is a group of people, that can be identified by its name. Each organization can have multiple contexts.
list of token IDs that are required to be present in the wallet to submit a profile. In case it is empty, any token ID is allowed.
Minimum amount of tokens that are required to be present in the wallet to submit a profile.
Some text that is displayed in the form may be changed. There are substitute variables available for those templates.
{balance}
- total balance of token (across all IDs for 721/1155),
{threshold}
- token threshold in this context
{claimable_balance}
- balance across whitelisted IDs if there are any, if not, equal to {balance}
There are 4 roles in the system:
- superadmin
- admin
- user
- anonymous user
superadmin can create and manage organizations. It includes editing list of admins and contexts.
admin can only view analytical data in the dashboard and export verified user profiles as CSV.
User is any verified visitor of the website that connected a wallet. User can submit a profile if they have enough required tokens in wallet.
Anonymous user is any visitor of the website that didn't connect a wallet. Anonymous user can't do much except for connecting a wallet and becoming one of the above roles.