HumanResources
Overview
HumanResources re-imagines contributor compensation by bringing payroll onchain, managing token-based vesting schedules for protocol team members. Unlike traditional systems, it creates transparent, immutable compensation agreements through individually deployed Contributor contracts.
Key Functions:
Contract Deployment: Creates personalized Contributor contracts with customized vesting schedules, cliff periods, and unlock timelines
Compensation Management: Handles RIPE token minting and distribution according to vesting schedules through the Ripe Gov Vault
Security Controls: Two-phase deployment with time-locks prevents rushed decisions and ensures careful compensation commitments
Lifecycle Management: Facilitates minting paychecks, transferring vested tokens, and handling cancellations with refunds
Protocol Tracking: Provides aggregate visibility into total compensation committed and claimed for sustainable tokenomics
The system uses Vyper's create_from_blueprint for gas-efficient deployments, implements sophisticated validation based on protocol-wide HR limits, supports manager/owner separation, and includes emergency cancellation functions.
Architecture & Dependencies
HumanResources is built as a Department with modular architecture:
Core Module Dependencies
LocalGov: Provides governance functionality with access control
DeptBasics: Department fundamentals (can mint RIPE only)
TimeLock: Time-locked changes for contributor deployment
Addys Module
Location:
contracts/modules/Addys.vyPurpose: Provides protocol-wide address resolution
Documentation: See Addys Technical Documentation
Key Features:
Access to all protocol contract addresses
Resolution of Ledger, RipeGovVault, VaultBook, etc.
Validation for authorized callers
Exported Interface: Address utilities via
addys.__interface__
External Contract Interfaces
Ledger: Tracks contributors and available RIPE for HR
RipeGovVault: Manages vested RIPE token positions
RipeToken: RIPE token minting and burning
Teller: Deposits tokens into vaults
Lootbox: Updates deposit points for engagement
VaultBook: Resolves vault addresses
MissionControl: Provides HR configuration and templates
Module Initialization
Department Configuration
Data Structures
ContributorTerms Struct
Complete specification for a contributor's compensation:
HrConfig Struct (from MissionControl)
Protocol-wide HR limits and configuration:
State Variables
Pending Operations
pendingContributor: HashMap[uint256, ContributorTerms]- Maps action ID to pending terms
Constants
RIPE_GOV_VAULT_ID: constant(uint256) = 2- Vault for contributor positions
System Architecture Diagram
Constructor
__init__
Initializes HumanResources with governance and timelock settings.
Parameters
_ripeHq
address
RipeHq contract for protocol integration
_minConfigTimeLock
uint256
Minimum blocks for contributor deployment
_maxConfigTimeLock
uint256
Maximum blocks for contributor deployment
Deployment Behavior
Initializes as a Department that can only mint RIPE
Sets up governance through RipeHq
Configures timelock bounds for operations
Example Usage
Contributor Management Functions
initiateNewContributor
Starts the process of deploying a new Contributor contract with specified terms.
Parameters
_owner
address
Who receives the vested tokens
_manager
address
Who can manage the contributor contract
_compensation
uint256
Total RIPE tokens to vest
_startDelay
uint256
Seconds until vesting starts
_vestingLength
uint256
Total vesting duration in seconds
_cliffLength
uint256
Cliff period in seconds
_unlockLength
uint256
When tokens become transferable
_depositLockDuration
uint256
Lock duration in blocks for vault
Returns
uint256
Action ID for the pending deployment
Access
Only callable by governance
Validation
Compensation must not exceed available RIPE for HR
Terms must comply with HrConfig limits
Cliff ≤ Unlock ≤ Vesting length
Addresses must be valid
Events Emitted
NewContributorInitiated- Contains all terms and confirmation block
Example Usage
confirmNewContributor
Confirms and deploys a pending Contributor contract after timelock.
Parameters
_aid
uint256
Action ID from initiation
Returns
bool
True if deployment successful
Process Flow
Re-validation: Terms still valid with current config
Timelock Check: Sufficient time has passed
Blueprint Deploy: Creates Contributor from template
Ledger Update: Registers contributor and compensation
Cleanup: Clears pending data
Events Emitted
NewContributorConfirmed- Includes deployed address and terms
cancelNewContributor
Cancels a pending contributor deployment.
Contributor Operations
cashRipeCheck
Called by Contributor contracts to mint and deposit vested RIPE.
Parameters
_amount
uint256
Amount of RIPE to mint
_lockDuration
uint256
Lock duration in blocks
Access
Only callable by registered HR contributors
Process
Mints RIPE tokens to HumanResources
Approves Teller for deposit
Deposits into Ripe Gov Vault for caller
Resets approval to zero
transferContributorRipeTokens
Transfers a contributor's vested position to their owner.
Process
Validates caller is HR contributor
Transfers position in Ripe Gov Vault
Updates Ledger for new owner
Updates Lootbox points
refundAfterCancelPaycheck
Handles refunds when a contributor's paycheck is cancelled.
Parameters
_amount
uint256
Unvested amount to refund
_shouldBurnPosition
bool
Whether to burn existing position
Validation Functions
areValidContributorTerms
Public validation of contributor terms.
Validation Rules
Template Exists: HR config has contributor template
Compensation Valid:
Greater than zero
Within available RIPE balance
Below max compensation limit
Time Periods:
Cliff > 0 and >= minimum
Vesting > 0 and within min/max
Unlock ≤ Vesting
Cliff ≤ Unlock
Start delay ≤ maximum
Addresses: Owner and manager not empty
View Functions
canModifyHrContributor
Checks if an address can modify contributor contracts.
Returns true for Switchboard addresses.
hasRipeBalance
Checks if a contributor has RIPE in the gov vault.
getTotalClaimed
Returns total RIPE claimed by all contributors.
Iterates through all contributors summing claimed amounts.
getTotalCompensation
Returns total RIPE allocated to all contributors.
Events
Deployment Events
NewContributorInitiated- Deployment startedNewContributorConfirmed- Contributor deployedNewContributorCancelled- Deployment cancelled
All events include complete ContributorTerms and action details.
Security Considerations
Access Control
Governance Only: Contributor deployment restricted
Contributor Registry: Only registered contributors can mint
Switchboard Override: Emergency admin capabilities
Economic Security
Balance Checks: Cannot exceed available RIPE
Time Locks: Prevents rushed deployments
Validation: Re-checks on confirmation
Integration Safety
Blueprint Deploy: Gas-efficient, deterministic
Approval Management: Resets after operations
Event Logging: Full transparency
Common Integration Patterns
Deploying a Contributor
Monitoring Contributors
Last updated