Overview
Agora DAO implements a simple yet effective membership system where users can join DAOs by calling thejoinDao() function. When a user joins, they automatically receive the USER_ROLE and are tracked in both the DAO’s and factory’s user counters.
Joining a DAO
The membership flow is straightforward and requires only a single transaction:AgoraDao.sol:35-44
The
joinDao() function is permissionless - anyone can call it to join a DAO. There are no approval requirements or whitelist checks.Membership requirements
Before joining, the contract validates:- Not already a member: User must not already have the
USER_ROLE - Not the admin: The DAO creator/admin cannot join as a regular user
- Valid address:
msg.sendermust be a valid Ethereum address
Role assignment process
When a user successfully joins, the internal_joinDaoUser() function handles role assignment:
Rol.sol:110-123
- Grants the
USER_ROLEusing OpenZeppelin’s AccessControl - Adds the user to the role tracking mapping
- Records the user’s position in the role array
- Emits a
RoleRegisteredevent
User tracking
Agora DAO maintains multiple user counters:DAO-level counter
AgoraDao.sol:21
Factory-level counter
AgoraDaoFactory.sol:30
addUserCounter() function ensures each address is only counted once:
AgoraDaoFactory.sol:103-108
A user is only counted once in the factory’s global counter, even if they join multiple DAOs.
Member benefits and permissions
Once a user joins and receives theUSER_ROLE, they gain access to:
Voting rights
Participate in DAO governance and proposals
Proposal creation
Create basic proposals for the DAO
Dashboard access
View DAO dashboard and analytics
Discussion participation
Engage in DAO discussions and forums
The exact permissions depend on your DAO’s configuration. The
USER_ROLE provides baseline access that can be extended with additional roles.Role hierarchy
In Agora DAO, members can have multiple roles simultaneously:- Admin: Can assign all roles, manage DAO settings
- Auditor: Can audit transactions and proposals, assign non-admin roles
- Task Manager: Can create and manage tasks
- Proposal Manager: Can manage proposals and voting
- User: Base member with voting and basic proposal rights
Querying membership
Check if an address is a DAO member:Rol.sol:28-30
Events
The membership system emits events for tracking:UserJoined event
AgoraDao.sol:25
user: The address that joineduserID: Their user counter ID in the DAO
RoleRegistered event
Rol.sol:20
role: The role bytes (USER_ROLE)user: The address receiving the roleexecutor: address(0) for self-join operations
Frontend integration example
Here’s how to implement a “Join DAO” button in your React application:Membership management
Unlike role assignment, membership joining is self-service:- Users call
joinDao()themselves - No admin approval required
- Instant membership upon transaction confirmation
- Gas paid by the joining user
Next steps
Role management
Learn about assigning additional roles to members
Task management
Discover how members can contribute through tasks
Rewards
Understand the reward system for active members