Snapshot
Search…
Learn about the strategies

How to use strategies:

If you want coin-voting (1 token = 1 vote) you can use "erc20-balance-of", however you may want:
  • Delegate voting power using a delegation strategy
  • Weighting voting power using a quadratic strategy
  • NFT voting with an ERC-721 or ERC-1155 based strategies
  • Only allow certain members to vote using whitelist strategy
  • Calculate voting power from multiple chains with multichain strategy
You can combine up to 8 strategies on a single proposal (combination work as OR not AND opperator)
At the time of writing snapshot has over 150 voting strategies. Explore them here https://snapshot.org/#/strategies You can even preview actions using the playground button.

What is a strategy

A strategy is a JavaScript function that returns a score for a set of addresses. Strategies are being used on Snapshot to calculate the result for a proposal. A proposal can have multiple strategies. The default strategy is to calculate the balance of an ERC20 for each voter. A strategy can send a call to a node or subgraph.

Example strategy

Here is an example with the most common strategy called erc20-balance-of.
snapshot-strategies/index.ts at master · snapshot-labs/snapshot-strategies
GitHub
1
import { formatUnits } from "@ethersproject/units";
2
import { multicall } from "../../utils";
3
import { abi } from "./TestToken.json";
4
5
export async function strategy(
6
space,
7
network,
8
provider,
9
addresses,
10
options,
11
snapshot
12
) {
13
const blockTag = typeof snapshot === "number" ? snapshot : "latest";
14
const response = await multicall(
15
network,
16
provider,
17
abi,
18
addresses.map((address: any) => [options.address, "balanceOf", [address]]),
19
{ blockTag }
20
);
21
return Object.fromEntries(
22
response.map((value, i) => [
23
addresses[i],
24
parseFloat(formatUnits(value.toString(), options.decimals)),
25
])
26
);
27
}
Copied!
Strategies are defined in your space settings at https://snapshot.page/#/<SPACE ADDRESS>/settings. This is an example of how to add a strategy to calculate the voting power in BAL and BAL that is in Balancer pools, where they are providing liquidity.
The erc20-balance-of strategy setting:
1
{
2
"address": "0xba100000625a3754423978a60c9317c58a424e3D",
3
"symbol": "BAL",
4
"decimals": 18
5
}
Copied!
The balancer strategy setting:
1
{
2
"address": "0xba100000625a3754423978a60c9317c58a424e3D",
3
"symbol": "BAL BPT"
4
}
Copied!
Strategies can be used to create a score from on-chain data, the data does not necessary need to be monetary, you can imagine a strategy that calculate how many POAP you own or use any other data available on-chain to issue a score.

Other Common strategies

  • erc20-with-balance is an example of strategy that checks whether the participant has a minimum amount of token required to vote and assigns all the votes to 1. You need to add the parameter “minBalance” and set it equal to the minimum balance required to vote on a proposal. This value is set to 0 by default.
  • erc20-balance-of-delegate is used if you want to use a delegation contract along with erc20-balance-of.

Find more strategies here:

snapshot-strategies/src/strategies at master · snapshot-labs/snapshot-strategies
GitHub
Last modified 1mo ago