GovernorExecuteProposal.sol

GovernorExecuteProposal.sol is an executive law that enables the execution of governance proposals on a configured Governor contract. It provides a mechanism to execute proposals that have succeeded in the governance process.

Overview

This law provides a mechanism to:

  • Execute governance proposals that have succeeded

  • Validate proposal state before execution

  • Execute proposal actions directly

  • Integrate with standard governance frameworks

  • Track proposal execution

Configuration

When adopting a GovernorExecuteProposal instance, one parameter must be provided:

  1. governorContract (address): The address of the Governor contract to execute proposals on

Usage

Proposing an Action

When calling the law, four parameters must be provided:

  1. targets (address[]): Array of target contract addresses for the proposal

  2. values (uint256[]): Array of ETH values to send with each call

  3. calldatas (bytes[]): Array of encoded function call data

  4. description (string): Human-readable description of the proposal

Execution Flow

  1. Parameter Validation

    • Verifies governor contract is configured

    • Validates proposal parameters

    • Checks array length consistency

    • Ensures description is not empty

  2. Proposal Validation

    • Gets proposal ID from governor contract

    • Validates proposal exists

    • Checks proposal state is "Succeeded"

    • Ensures proposal is ready for execution

  3. Proposal Execution

    • Returns proposal actions for direct execution

    • Bypasses governor contract execution

    • Executes actions directly

  4. State Management

    • Records proposal execution

    • Updates governance state

    • Tracks execution history

Technical Specifications

State Variables

mapping(bytes32 lawHash => address governorContract) public governorContracts;

Functions

initializeLaw

function initializeLaw(
    uint16 index,
    string memory nameDescription,
    bytes memory inputParams,
    bytes memory config
) public override
  • Initializes law with configuration parameters

  • Sets up Governor contract address

  • Configures proposal execution parameters

handleRequest

function handleRequest(
    address caller,
    address powers,
    uint16 lawId,
    bytes memory lawCalldata,
    uint256 nonce
) public view virtual override returns (
    uint256 actionId,
    address[] memory targets,
    uint256[] memory values,
    bytes[] memory calldatas
)
  • Processes the proposal execution request

  • Validates proposal parameters and state

  • Prepares proposal actions for execution

  • Returns execution data

Error Conditions

  1. Configuration Errors

    • "GovernorExecuteProposal: Governor contract not configured"

    • Invalid governor contract address

  2. Parameter Errors

    • "GovernorExecuteProposal: No targets provided"

    • "GovernorExecuteProposal: Targets and values length mismatch"

    • "GovernorExecuteProposal: Targets and calldatas length mismatch"

    • "GovernorExecuteProposal: Description cannot be empty"

  3. Proposal Errors

    • "GovernorExecuteProposal: Proposal not found"

    • "GovernorExecuteProposal: Proposal not succeeded"

    • Invalid proposal state

  4. Validation Errors

    • Zero address governor contract

    • Empty targets array

    • Mismatched array lengths

    • Empty description

Current Deployments

Chain ID
Chain Name
Address

421614

Arbitrum Sepolia

0xa797799EE0C6FA7d9b76eF52e993288a04982267

11155420

Optimism Sepolia

0xa797799EE0C6FA7d9b76eF52e993288a04982267

11155111

Ethereum Sepolia

0xa797799EE0C6FA7d9b76eF52e993288a04982267

Last updated