• Stars
    star
    215
  • Rank 183,925 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Snapshot voting strategies

Snapshot strategies

Development

Install dependencies

yarn

Build package

yarn build

Test strategy with predefined tests (params from examples.json file)

Note: If you're writing a new strategy, make sure to add it to strategies/index.ts before testing*

# Test default strategy (erc20-balance-of)
yarn test
# Test strategy with name
yarn test --strategy=erc20-received
yarn test --strategy=eth-balance
# Test with more addresses from addresses.json
yarn test --strategy=eth-balance --more=200

Test validation with predefined tests (params from examples.json file)

yarn test:validation --validation=basic

Test strategy with different parameters

Change values inside test/scores.ts and run

ts-node test/scores.ts

Checklist for adding a new voting strategy or validation strategy

Here is a simple checklist to look at when reviewing a PR for a new strategy:

Overview

  • The strategy must be unique.
  • If the strategy does only a single call with an address as input, it's preferable to use the strategy "contract-call" instead of creating a new one.
  • For validations better to use basic validation and use existing strategies

Code

  • Strategies should always use a snapshot to calculate user's voting power. As a result the voting power should not change throughout the proposal duration.
  • There should be a maximum of 5 requests, a request can use "fetch" a "subgraphRequest" or "multicall".
  • The strategy should not send a request for each voters, this doesn't scale.
  • The strategy PR should not add any new dependency.
  • The score returned by the strategy should use the same casing for address as on the input, or should return checksum addresses.
  • Make sure that voting power of one address does not depend on other addresses.

Example

  • Example must include at least 1 address with a positive score.
  • Example must use a snapshot block number in the past.

Test

Recommended

  • Add a README.md file that describes the strategy and provides an example of parameters.
  • Use string ABI instead of object.

License

MIT.

More Repositories

1

snapshot

Interface for Snapshot. Join us on Discord http://discord.snapshot.org
Vue
9,215
star
2

snapshot.js

A TypeScript SDK for Snapshot
TypeScript
226
star
3

snapshot-spaces

SCSS
212
star
4

sx-starknet

Core smart contracts of Snapshot X for Starknet
Cairo
113
star
5

snapshot-hub

GraphQL API for Snapshot
TypeScript
103
star
6

stamp

Avatars for web3
TypeScript
76
star
7

snapshot-docs

34
star
8

sx-ui

An open source interface for Snapshot X protocol.
Vue
32
star
9

lock

TypeScript
30
star
10

score-api

TypeScript
24
star
11

snapshot-sequencer

TypeScript
24
star
12

checkpoint

Checkpoint is a library for indexing data of StarkNet contracts.
TypeScript
22
star
13

sx-evm

Core smart contracts of Snapshot X for EVM
Solidity
20
star
14

snapshot-sidekick

TypeScript
18
star
15

pineapple

TypeScript
17
star
16

sx.js

TypeScript
17
star
17

boost

A protocol for token distribution
Solidity
12
star
18

snapshot-app

TypeScript
12
star
19

snapshot-subgraph

TypeScript
12
star
20

snapshot-plugins

TypeScript
11
star
21

sx-api

TypeScript
11
star
22

sx-monorepo

Snapshot monorepo
TypeScript
11
star
23

snapshot-webhook

Snapshot notification service.
TypeScript
9
star
24

pineapple.js

TypeScript
8
star
25

envelop-ui

Vue
7
star
26

envelop

TypeScript
7
star
27

mana

Meta transaction relayer for Starknet and EVM chains.
TypeScript
6
star
28

guest

Connect to web3 apps with any address
Vue
5
star
29

s.js

5
star
30

boost.js

TypeScript
4
star
31

blockfinder

Timestamp to block number in a GraphQL API
TypeScript
4
star
32

snapshot-relayer

Relayer for Safe signed messages
TypeScript
4
star
33

subgrapher

Subgraph proxy with smart caching
TypeScript
4
star
34

boost-guard

Rust
4
star
35

api-checkpoint

TypeScript
3
star
36

highlight

TypeScript
3
star
37

networks

Vue
3
star
38

snapshot-docs-vitepress

TypeScript
3
star
39

drop

3
star
40

boost-subgraph

TypeScript
3
star
41

sx-cli

TypeScript
3
star
42

checkpoint-ui

Vue
2
star
43

starknet-verifier

Cairo
2
star
44

brovider

TypeScript
2
star
45

starknet-proxy

TypeScript
2
star
46

starknet-delegation

Cairo
2
star
47

checkpoint-template

An example template to help you get started with Checkpoint.
TypeScript
2
star
48

hookah

TypeScript
2
star
49

ui

2
star
50

webhook-ui

2
star
51

poster-subgraph

Solidity
1
star
52

delegates-subgraph

TypeScript
1
star
53

delegates-api

TypeScript
1
star
54

discord-helpdesk

TypeScript
1
star
55

snapshot-networks

1
star
56

lobby

1
star
57

collection

1
star
58

evm-slot-key-verification

Verify the key of an Ethereum storage slot in Cairo
TypeScript
1
star
59

token-api-checkpoint

1
star
60

workers

JavaScript
1
star
61

brand

A collection of all our logos and other branding images
1
star
62

starknet-poster

Cairo
1
star
63

keycard.js

TypeScript
1
star
64

turbo

1
star
65

keycard

TypeScript
1
star
66

boost-docs

1
star
67

contracts

Solidity
1
star
68

sx-docs

1
star
69

tune

Vue
1
star
70

config

JavaScript
1
star
71

boost-ui

Vue
1
star
72

axiom-relayer

TypeScript
1
star
73

sx-subgraph

TypeScript
1
star