npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@prophouse/offchain-strategies

v0.1.4

Published

## Development

Downloads

8

Readme

Prop House offchain 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.