snapshot
Blog
  • Welcome to Snapshot docs
  • User guides
    • Spaces
      • What is a space?
      • Create a space
        • Register an ENS domain
        • Alternative way to create a space
      • Settings
      • Sub-spaces
      • Space verification
      • Space hibernation
      • Add a custom domain
      • Add a skin
      • Space roles
      • Space badges
      • Snapshot Pro
      • Space handbook
        • Most common
        • Voting threshold
        • Anti-whale
        • Sybil resistance, scam & spam prevention
        • Liquidity / staking pool
        • Delegation
        • NFT voting
          • Most common: ERC-721
          • Multi-token: ERC-1155
          • POAP - Proof of Attendance
        • Custom calculations
    • Create a proposal
    • Voting
      • Vote on a proposal
      • Delegate your voting power
    • Voting strategies
    • Validation strategies
    • Using Safe multi-sig
    • Delegation
  • Developer Guides
    • Create a voting strategy
    • Create a validation strategy
    • Identify integrator activity
    • Add a network
  • Tools
    • Tools overview
    • Snapshot.js
    • API
      • API Keys
    • Webhooks
    • Subgraphs
    • Mobile notifications
    • Bots
  • Snapshot X
    • Overview
    • User guides
      • Create a space
      • Proposals
      • Voting
      • Safe execution setup
    • Protocol
      • Overview
      • Space actions
      • Space controller actions
      • Authenticators
      • Proposal validations
      • Voting strategies
      • Starknet specifics
      • Execution strategies
      • Audits
    • Services
      • Architecture
      • API
      • SX.js
      • UI
      • Mana
  • V1 interface
    • Email notifications
    • Plugins
      • What is a plugin?
      • Create a plugin
      • oSnap
      • SafeSnap
      • POAP
      • Quorum
      • Domino notifications
      • Galxe
    • Boost
  • Community
    • Help center
    • Discord
    • X (Twitter)
    • GitHub
Powered by GitBook
On this page
  • 1. Navigate to the src\validations.
  • 2. Create a copy of the basic strategy folder and rename it to the name of your voting validation.
  • 3. Customize the logic of your voting validation.
  • 4. Test your validation
  • 4. Make sure you pass the checklist
  • 5. Create a pull request

Was this helpful?

Edit on GitHub
Export as PDF
  1. Developer Guides

Create a validation strategy

Create a validation strategy and use it in your own space

PreviousCreate a voting strategyNextIdentify integrator activity

Last updated 6 months ago

Was this helpful?

To add your own voting validation strategy on Snapshot you need to fork the snapshot-strategies repository and create a pull request.

1. Navigate to the src\validations.

└── src
    └── validations
        └── basic

2. Create a copy of the basic strategy folder and rename it to the name of your voting validation.

3. Customize the logic of your voting validation.

If you are not sure about the Validation class, have a look at its definition:

4. Test your validation

To make sure your validation passes all tests, run:

npm run test --validation=<VALIDATION NAME> // replace <VALIDATION NAME>

4. Make sure you pass the checklist

Have a look here on the requirements for adding a new validation strategy and make sure you fulfill the points in the checklist:

5. Create a pull request

The team will then review your PR and after it's approved and merged it will be available to choose in your space settings.

The validation name has to be included in the in the validationClasses variable.

index.ts
https://github.com/snapshot-labs/snapshot-strategies#checklist-for-adding-a-new-strategy
https://github.com/snapshot-labs/snapshot-strategies
https://github.com/snapshot-labs/snapshot-strategies/blob/master/src/validations/validation.ts
export default class Validation {
  public id = '';
  public github = '';
  public version = '';
  public title = '';
  public description = '';

  public author: string;
  public space: string;
  public network: string;
  public snapshot: number | 'latest';
  public params: any;

  constructor(
    author: string,
    space: string,
    network: string,
    snapshot: number | 'latest',
    params: any
  ) {
    this.author = author;
    this.space = space;
    this.network = network;
    this.snapshot = snapshot;
    this.params = params;
  }

  async validate(): Promise<boolean> {
    return true;
  }
}