project screenshot 1
project screenshot 2
project screenshot 3

Sponsored Voting: Governor Extension

Extending OpenZeppelin Governor contract to sponsor the gas fees of proposal votes

Sponsored Voting: Governor Extension

Created At

ETHGlobal Tokyo

Project Description

This governor extension introduces proposal vote sponsorship to DAO governance token holders. This makes it easier for protocol users to participate in governance, which in turn fosters equitability and diversity. It does so by adding ERC-4337 compliant paymaster functionality to the OpenZeppelin governor contract. And because it uses the OpenZeppelin governor, it's interoperable with a bunch of existing UIs and tooling. With this extension, governance token holders with 0 ETH in their wallet can cast votes on DAO proposals! Future work could include:

  • expand the scope of what can be sponsored (e.g. proposal execution)
  • support more vote methods (currently only castVote supported)
  • give governor a way to punish griefing
  • harden paymaster validation logic, include better unit tests
  • helper library for forge users

How it's Made

This project is a foundry project written in solidity that imports the @openzeppelin/contracts as well as the Ethereum Foundation's infinitism/account-abstraction contracts. It composes them in a new, original contract called GovernorSponsoredVoting.sol. Tests are written to prove that token holders with 0 ETH in their wallet can indeed cast their vote on a proposal, with gas paid entirely by the governor contract's new paymaster capabilities. However, there is 1 remaining block.number call (to fix) that prevents the UserOperation from getting included in a goerli bundle.

I cut a whole bunch of corners, for example:

  • only support castVote and not other relevant vote methods
  • only support BasicAccount style execute
  • hardcoded paymaster address in trampoline, as currently trampoline wants a paymaster url instead
  • can currently be griefed by malicious account who calls with innocent calldata but whose implementation spends the gas on something irrelevant. See TODO on blacklisting / reverting in 2nd postOp. I tried to mark TODOs in appropriate places. Would love to keep working on this!
background image mobile

Join the mailing list

Get the latest news and updates