TeamManager
Overview
The TeamManager contract is a specialized token distribution system for the Lendefi DAO, designed to handle team member compensation through configurable vesting schedules. It allocates 18% of the total token supply to team members with controlled vesting parameters, providing both flexibility and security in managing team token allocations.
Architecture
Contract Structure
Inheritance Model: Implements a comprehensive inheritance structure combining upgradeability, access control, reentrancy protection, and pausability
Allocation Management: Tracks and enforces a fixed percentage (18%) allocation of total token supply
Individual Vesting: Creates separate vesting contract instances for each team member
Configurable Parameters: Allows customization of vesting schedules within predefined constraints
Token Distribution Model
Fixed Allocation: 18% of total token supply reserved for team members
Vesting Parameters:
Cliff periods: 90-365 days (3 months to 1 year)
Vesting durations: 365-1460 days (1-4 years)
Custom Vesting Contracts: Deploys dedicated TeamVesting contracts for each member
Technical Assessment
Strengths
Security Features:
Role-based access control with distinct roles (PAUSER_ROLE, MANAGER_ROLE, UPGRADER_ROLE)
Reentrancy protection on fund-moving functions
Input validation with clear error messages
Pausability for emergency situations
UUPS upgrade pattern with version tracking
Parameter Validation:
Zero-address validation for critical parameters
Bounds checking for cliff and duration values
Allocation limit enforcement
Duplicate beneficiary prevention
Implementation Quality:
Clean function organization with logical separation
Event emissions for critical actions
Explicit error messages with custom errors
Safe token transfers using SafeERC20
Governance Integration:
Timelock control for key management functions
Guardian role for emergency actions
Version tracking for upgrade transparency
Potential Concerns
Limited Management Functions:
No mechanism to remove or adjust team member allocations
No recovery function for incorrect allocations
No batch operations for efficient team management
Centralization Risks:
Heavy reliance on timelock and guardian roles
No time-delayed operations for sensitive functions
Vesting Limitations:
Once created, vesting contracts cannot be modified
No partial vesting revocation capability for exiting team members
No mechanism to handle team restructuring events
Technical Considerations:
TeamVesting contract dependency is critical but separate
No explicit handling for token rebasing or fee-on-transfer tokens
Custom error messages not fully standardized
Code Quality & Documentation
Documentation: Excellent NatSpec documentation with detailed parameter descriptions
Security Annotations: Clear security-related annotations in comments
Event Emissions: Appropriate event for critical state changes
Error Handling: Consistent use of custom errors with descriptive messages
Code Organization: Well-structured with logical sections and clear naming
Inherits: ITEAMMANAGER, Initializable, PausableUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, UUPSUpgradeable
Creates and deploys team vesting contracts
Implements a secure and upgradeable team manager for the DAO
Notes:
security-contact: security@nebula-labs.xyz
copyright: Copyright (c) 2025 Nebula Holding Inc. All rights reserved.
oz-upgrades:
State Variables
TEAM_ALLOCATION_PERCENT
Team allocation percentage of total supply (18%)
MIN_CLIFF
Minimum cliff period (6 months)
MAX_CLIFF
Maximum cliff period (2 years)
MIN_DURATION
Minimum vesting duration (1 year)
MAX_DURATION
Maximum vesting duration (4 years)
PAUSER_ROLE
AccessControl Pauser Role
MANAGER_ROLE
AccessControl Manager Role
UPGRADER_ROLE
AccessControl Upgrader Role
ecosystemToken
governance token instance
supply
amount of ecosystem tokens in the contract
totalAllocation
amount of tokens allocated so far
timelock
timelock address
version
number of UUPS upgrades
allocations
token allocations to team members
vestingContracts
vesting contract addresses for team members
__gap
gap for future storage variables
Functions
receive
Prevents receiving Ether
constructor
Note: oz-upgrades-unsafe-allow: constructor
initialize
Initializes the team manager contract
*Sets up the initial state of the contract with core functionality:
Initializes upgradeable base contracts
Sets up access control roles
Configures token and supply parameters*
Notes:
requires-role: None - can only be called once during initialization
security: Implements initializer modifier to prevent re-initialization
security: Validates all input addresses are non-zero
events-emits: Initialized(msg.sender)
throws: CustomError("ZERO_ADDRESS_DETECTED") if any input address is zero
Parameters
token
address
The address of the ecosystem token contract
timelock_
address
The address of the timelock controller
guardian
address
The address of the admin who will receive DEFAULT_ADMIN_ROLE
pause
Pauses all contract operations
Prevents execution of state-modifying functions
Notes:
requires-role: PAUSER_ROLE
security: Inherits OpenZeppelin's PausableUpgradeable
events-emits: {Paused} event from PausableUpgradeable
throws: Unauthorized if caller lacks PAUSER_ROLE
unpause
Resumes all contract operations
Re-enables execution of state-modifying functions
Notes:
requires-role: PAUSER_ROLE
security: Inherits OpenZeppelin's PausableUpgradeable
events-emits: {Unpaused} event from PausableUpgradeable
throws: Unauthorized if caller lacks PAUSER_ROLE
addTeamMember
Create and fund a vesting contract for a new team member
Notes:
requires: beneficiary must not be zero address
requires: cliff must be between MIN_CLIFF and MAX_CLIFF
requires: duration must be between MIN_DURATION and MAX_DURATION
requires: amount must not exceed remaining supply
throws: CustomError("SUPPLY_LIMIT") if allocation exceeds supply
throws: CustomError("INVALID_BENEFICIARY") if beneficiary is zero address
throws: CustomError("INVALID_CLIFF") if cliff period is invalid
throws: CustomError("INVALID_DURATION") if duration is invalid
throws: CustomError("ALREADY_ADDED") if beneficiary already has allocation
Parameters
beneficiary
address
The address of the team member
amount
uint256
The amount of tokens to vest
cliff
uint256
The cliff period in seconds
duration
uint256
The vesting duration in seconds after cliff
_authorizeUpgrade
Authorizes and processes contract upgrades
Internal override for UUPS upgrade authorization
*Performs:
Validates caller has UPGRADER_ROLE
Increments contract version
Emits upgrade event with details*
Notes:
throws: Unauthorized if caller lacks UPGRADER_ROLE
emits: Upgrade event with upgrader address and new implementation
security: Role-based access control via UPGRADER_ROLE
security: Version tracking for upgrade management
security: Inherits OpenZeppelin's UUPSUpgradeable pattern
Parameters
newImplementation
address
Address of the new implementation contract
Last updated