YS Governor

The YS Governor contract manages protocol-level governance through a decentralized voting mechanism. It uses OpenZeppelin's Governor pattern to enable secure, transparent decision-making for protocol parameters and upgrades.

Overview

The YS Governor implements a complete governance system that allows YSToken holders to propose and vote on protocol changes. All proposals are subject to a timelock, ensuring that changes cannot be executed immediately and providing time for review.

Governance Components

The Governor contract combines several OpenZeppelin extensions:

  • Governor: Base governance functionality
  • GovernorCountingSimple: Simple majority voting
  • GovernorVotes: Vote weighting based on token balance
  • GovernorVotesQuorumFraction: Quorum requirement (4%)
  • GovernorTimelockControl: Timelock integration for proposal execution

Voting Parameters

The Governor is configured with the following parameters:

  • Voting Delay: 1 day - Time between proposal creation and voting start
  • Voting Period: 1 week - Duration of the voting period
  • Proposal Threshold: 1000 YS tokens - Minimum tokens required to create a proposal
  • Quorum: 4% - Minimum percentage of total token supply that must vote

Governance Token

The Governor uses YSToken (ERC20Votes) for voting:

  • Token balance determines voting power
  • Uses snapshot-based voting (historical balances)
  • Supports delegation of voting power
  • Implements ERC20Permit for gasless approvals

Proposal Lifecycle

  1. Proposal Creation: Any address with at least 1000 YS tokens can create a proposal
  2. Voting Delay: 1 day passes before voting begins
  3. Voting Period: Token holders vote for 1 week
  4. Quorum Check: At least 4% of total supply must vote
  5. Timelock Queue: If passed, proposal is queued in the timelock
  6. Execution: After timelock delay, proposal can be executed

Timelock Integration

All proposals are executed through a TimelockController:

  • Provides a delay between proposal approval and execution
  • Allows for review and potential cancellation
  • Ensures no immediate execution of governance decisions
  • Adds an extra layer of security

Clock Mode

The Governor uses timestamp-based clock mode:

  • Voting periods are measured in seconds (not blocks)
  • More predictable across different networks
  • Compatible with various block times
  • Uses block.timestamp for all time calculations

Governance Functions

The Governor can execute proposals that:

  • Update protocol parameters in the Factory
  • Add or remove tokens from the whitelist
  • Upgrade pool or factory implementations
  • Update governance timelock addresses
  • Modify fee structures
  • Pause/unpause protocol components

Proposal Structure

Each proposal contains:

  • Targets: Array of contract addresses to call
  • Values: Array of ETH values to send (typically 0)
  • Calldatas: Array of function call data
  • Description: Human-readable description of the proposal

Voting Power

Voting power is determined by:

  • Token balance at the time of proposal creation (snapshot)
  • Delegated voting power (if tokens are delegated)
  • Historical balance snapshots for past proposals

Security Features

  • Quorum Requirement: Prevents small groups from passing proposals
  • Timelock Delay: Provides time for review and potential cancellation
  • Proposal Threshold: Prevents spam proposals
  • Voting Period: Ensures adequate time for participation
  • Snapshot Voting: Prevents manipulation through token transfers during voting

Integration with Protocol

The Governor controls:

  • SplitRiskPoolFactory: Token whitelisting, pool parameters
  • Pool Upgrades: Implementation contract updates
  • Protocol Fees: Fee rate and recipient updates
  • Emergency Controls: Pause/unpause functionality

Example Use Cases

  • Adding new tokens to the whitelist
  • Adjusting maximum commission rates
  • Updating pool implementation contracts
  • Changing protocol fee rates
  • Emergency protocol pauses