Event Access Token Contract
The Event Access Token Contract is a sub-component of the broader Built By DAO ecosystem. It is designed to manage token issuance for one-time or recurring events, such as concerts, seminars, community meetups, and other engagement activities. This contract must be deployed and initialized through the Umbrella Access Token Contract to ensure compliance and uniformity across all access token systems within the DAO. This guide will walk through the purpose, features, and process of using this contract effectively.
Overview and Purpose
The Event Access Token Contract is a non-transferable ERC721-based solution intended to provide temporary or continuous access permissions for DAO members. The key benefit of using this contract lies in its flexibility to offer either multi-use or single-use access tokens, ensuring that the unique needs of different events are covered.
The contract is built with various access control mechanisms, using roles like ADMIN_ROLE and EVENT_MANAGER_ROLE, and features security-focused components like ReentrancyGuard to prevent vulnerabilities. Furthermore, only authorized administrators and event managers can create or modify tokens, which helps in safeguarding the system's integrity.
Key Features Explained
1. Umbrella Contract Integration
The Event Access Token Contract is integrated within the DAO ecosystem through an Umbrella Access Token Contract. This umbrella contract is responsible for deploying and initializing the Event Access Token Contract. By centralizing the deployment process, it ensures consistency across different types of access tokens while enabling secure, standardized, and auditable token management.
The initialize() function is used during deployment to define the name, symbol, and umbrellaContract address for the token. This initialization process ensures that the contract is properly linked to the umbrella contract, allowing for subsequent minting and management of tokens by authorized users.
Deployment Note: During deployment, the initialize() function parameters need to be set for:
name (e.g., "DAO Event Token").
symbol (e.g., "DAE").
umbrellaContract address to identify the contract responsible for managing the sub-contract's operations.
2. Role-Based Access Control
The contract employs role-based access control to determine who can mint, manage, or burn event access tokens. The following roles are included:
UMBRELLA_CONTRACT_ROLE: Grants authority to deploy and initialize this sub-contract.
ADMIN_ROLE: Users with this role can burn tokens and manage high-level operations.
EVENT_MANAGER_ROLE: Users with this role can mint new tokens, thereby controlling who can gain access to specific events.
Role assignments must be defined through the Umbrella Access Token Contract to maintain consistent governance, minimizing the risk of unauthorized token creation or deletion.
3. Minting Event Access Tokens
The mintEventAccessToken() function allows minting of Event Access Tokens. Only those assigned the EVENT_MANAGER_ROLE can mint tokens. This function requires the following parameters:
to: The address that will receive the token.
isMultiUse: Boolean value indicating whether the token can be used multiple times or not.
duration: Specifies the length of time the token is valid (for one-time tokens).
The minted token will also have a metadata URI associated with it, which provides detailed information related to the event. For example, it could contain the event date, location, and description. During deployment, replace the placeholder URI ("https://metadata.uri/for/EventAccessToken"
) with an actual URL pointing to the event's metadata.
Minting Considerations:
Multi-Use Tokens: No expiration is set for multi-use tokens (
expirationTimestamp = 0
).Single-Use Tokens: Expire based on the provided duration, starting from the moment of minting (
block.timestamp + duration
).
4. Non-Transferable Tokens
The Event Access Tokens are non-transferable. This means they cannot be traded, transferred, or sold to another user. This is an intentional feature to preserve the security and exclusivity of event participation. The transfer function (_transfer()
) has been overridden to ensure that any transfer attempt fails, maintaining strict control over who has access to specific events.
5. Burning Tokens
Tokens can be burned via the burnEventAccessToken() function, which can only be called by the token owner or an admin. This feature ensures that expired or invalid tokens can be removed from circulation, avoiding unnecessary clutter and ensuring that only valid tokens are in use.
Usage Note: Burning is essential for managing single-use tokens after the event is over or if the holder no longer requires access. The burn operation helps keep the system clean and secure.
6. Token Validity Checks
The isTokenValid() function can be used to determine whether a token is still valid. This is especially useful for verifying event access at the gate.
Multi-Use Tokens are always valid unless explicitly burned.
Single-Use Tokens have an expiration timestamp and are only valid until that time elapses.
How to Deploy and Use the Clone
To deploy a clone of the Event Access Token Contract, follow these steps:
Step 1: Deploy the Umbrella Access Token Contract
First, deploy the Umbrella Access Token Contract. This contract will be responsible for managing all access tokens within the DAO, including the event access tokens. Assign appropriate roles such as DEFAULT_ADMIN_ROLE and REVIEWER_ROLE for controlling future deployments.
Step 2: Deploy the Event Access Token Contract
Deploy the Event Access Token Contract by cloning it through the Umbrella Access Token Contract.
During deployment, use the initialize() function to set up the contract's name, symbol, and link it to the umbrellaContract.
Ensure that only authorized addresses—like those holding the UMBRELLA_CONTRACT_ROLE—are used for deployment to avoid unauthorized contract creation.
Step 3: Mint Tokens
After deployment, mint tokens using the mintEventAccessToken() function.
Ensure the person minting the tokens has the EVENT_MANAGER_ROLE.
Set to, isMultiUse, and duration as per event requirements.
Replace the placeholder metadata URI with event-specific information for proper identification.
Step 4: Manage Tokens
Once tokens are minted, they can be used to manage event participation.
Check Validity: Use isTokenValid() to determine if the token is eligible for event access.
Burn Tokens: Tokens can be burned post-event or when no longer needed using burnEventAccessToken().
Example Use Case
Suppose the DAO is organizing a Community Skill Workshop:
Deploy the Event Access Token Contract via the Umbrella Access Token Contract.
Use the initialize() function to name it "DAO Workshop Token" and symbolize it as "DWT".
An authorized event manager then mints single-use tokens with a specific duration for the duration of the workshop.
Participants can use their tokens to gain entry, which will be validated by checking the token’s expiration timestamp.
Post-event, admins or the token holders can burn the tokens to finalize the process.
Summary
The Event Access Token Contract is designed to provide secure and flexible access to DAO events, with features like non-transferability, multi-use vs. single-use options, and strict role-based access control. By utilizing this contract under the Umbrella Access Token Contract, the DAO can ensure that event access remains exclusive, auditable, and compliant with community standards.
To use the clone effectively, always start by deploying the Umbrella Contract, initialize the sub-contract properly, and assign roles to the relevant members of the DAO to manage minting and burning operations securely. This ensures streamlined and transparent access control for events within the DAO ecosystem, facilitating a well-governed and community-focused operational environment.
Last updated