GovernorCreateProposal.sol
GovernorCreateProposal.sol is an executive law that enables the creation of governance proposals on a configured Governor contract. It provides a mechanism to create proposals that can be voted on through standard governance processes.
Overview
This law provides a mechanism to:
Create governance proposals on any Governor contract
Define proposal targets, values, and calldatas
Add human-readable descriptions to proposals
Integrate with standard governance frameworks
Track proposal creation
Configuration
When adopting a GovernorCreateProposal instance, one parameter must be provided:
governorContract
(address): The address of the Governor contract to create proposals on
Usage
Proposing an Action
When calling the law, four parameters must be provided:
targets
(address[]): Array of target contract addresses for the proposalvalues
(uint256[]): Array of ETH values to send with each callcalldatas
(bytes[]): Array of encoded function call datadescription
(string): Human-readable description of the proposal
Execution Flow
Parameter Validation
Verifies governor contract is configured
Validates proposal parameters
Checks array length consistency
Ensures description is not empty
Proposal Creation
Encodes proposal parameters
Creates call to Governor.propose function
Prepares execution data
State Management
Records proposal creation
Updates governance state
Tracks proposal history
Technical Specifications
State Variables
mapping(bytes32 lawHash => address governorContract) public governorContracts;
Functions
initializeLaw
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 creation parameters
handleRequest
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 creation request
Validates proposal parameters
Prepares call to Governor.propose
Returns execution data
Error Conditions
Configuration Errors
"GovernorCreateProposal: Governor contract not configured"
Invalid governor contract address
Parameter Errors
"GovernorCreateProposal: No targets provided"
"GovernorCreateProposal: Targets and values length mismatch"
"GovernorCreateProposal: Targets and calldatas length mismatch"
"GovernorCreateProposal: Description cannot be empty"
Validation Errors
Zero address governor contract
Empty targets array
Mismatched array lengths
Empty description
Current Deployments
421614
Arbitrum Sepolia
0xa797799EE0C6FA7d9b76eF52e993288a04982267
11155420
Optimism Sepolia
0xa797799EE0C6FA7d9b76eF52e993288a04982267
11155111
Ethereum Sepolia
0xa797799EE0C6FA7d9b76eF52e993288a04982267
Last updated