Skip to content

Latest commit

 

History

History
executable file
·
74 lines (49 loc) · 2.02 KB

README.md

File metadata and controls

executable file
·
74 lines (49 loc) · 2.02 KB

Snapshot strategies

Development

Install dependencies

yarn

Build package

yarn build

Test strategy with predefined tests

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 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

  • 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 than on the input, or should return checksum addresses.
  • Make sure 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.