Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Conversation

@devshib93
Copy link

Add ERC20 Quadratic Voting Strategy

What does this PR do?

Adds a new quadratic voting strategy for ERC20 tokens that applies square root to token balances, reducing the voting power of large holders while maintaining proportional representation for smaller holders.

Changes Made

  • ✅ Add erc20-quadratic-voting strategy implementation
  • ✅ Apply votingPower = √(tokenBalance) formula
  • ✅ Include comprehensive documentation and examples
  • ✅ Register strategy in main index.ts
  • ✅ Pass all validation tests

How it Works

The strategy calculates voting power using the square root of token balances:

Token Balance Linear Voting Power Quadratic Voting Power
100 tokens 100 10
400 tokens 400 20
900 tokens 900 30
1600 tokens 1600 40

Benefits

  1. Decentralization: Prevents large token holders from dominating governance
  2. Fairness: Gives smaller holders meaningful voting power
  3. Simplicity: Easy to understand and implement
  4. Compatibility: Works with any ERC20 token

Testing

  • ✅ Strategy loads correctly
  • ✅ Examples are valid
  • ✅ Performance is acceptable (< 10 seconds)
  • ✅ Works with multiple addresses

Usage Example

{
  "strategies": [
    [
      "erc20-quadratic-voting",
      {
        "address": "0x6b175474e89094c44da98b954eedeac495271d0f",
        "symbol": "DAI",
        "decimals": 18
      }
    ]
  ]
}

Checklist

  • Strategy is unique and not a duplicate
  • Strategy uses snapshot for voting power calculation
  • Strategy has maximum 5 requests
  • Strategy doesn't send request for each voter
  • Strategy doesn't add new dependencies
  • Strategy returns same casing for addresses
  • Strategy voting power doesn't depend on other addresses
  • Example includes at least 1 address with positive score
  • Example uses snapshot block number in the past
  • Strategy takes less than 10 seconds to resolve
  • Strategy works with 500 addresses

- Add simple quadratic voting implementation using square root
- Apply votingPower = √(tokenBalance) formula
- Include comprehensive documentation and examples
- Register strategy in main index.ts
- Pass all validation tests
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! i think math strategy should work for you in this case, you tried already?

@devshib93
Copy link
Author

Yes, I have tried with erc20-balance-of-cv, and it is same. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants