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

@mstable/merkle-drop

v2.0.0

Published

Merkle Drop

Downloads

26

Readme

CI

@mstable/merkle-drop

A lightweight Merkle Drop contract.

This project uses Hardhat.

Basic workflow

  • Use the deployMerkleDrop task to deploy a MerkleDrop
  • Create a JSON balances file for each tranche
  • Use the seedNewAllocations task to add a new tranche with JSON balances

Pro workflow

  • Use MerkleDropTranches to track MerkleDrop contracts on the subgraph (task: registerMerkleDrop)
  • On frontends etc, use the subgraph and tranche URI to generate proofs for claims

Hardhat Tasks

Deploying MerkleDrop

yarn hardhat deployMerkleDrop --token 0x... --funders 0x...,0x...

Seeding new allocations (adding a tranche)

# From a local file:
yarn hardhat seedNewAllocations --merkle-drop 0x... --balances ./tranche0.json

# Or, fetch balances from a remote resource:
yarn hardhat seedNewAllocations --merkle-drop 0x... --balances https://raw.githubusercontent.com/mstable/stkBPT-merkle-drops/master/tranches/1/tranche-1.json

Deploying MerkleDropTranches

yarn hardhat deployMerkleDropTranches

Registering a MerkleDrop on MerkleDropTranches (useful for subgraphs)

yarn hardhat registerMerkleDrop --merkle-drop-tranches 0x... --merkle-drop 0x...

Adding a new tranche URI (useful for subgraphs)

yarn hardhat addTrancheURI --merkle-drop-tranches 0x... --merkle-drop 0x... --id 0  --balances ./tranche0.json

Installation in your project

yarn add @mstable/merkle-drop

Development

Local development

yarn
yarn compile
yarn typechain

Testing

yarn test

Coverage

yarn coverage

Linting

yarn lint

Subgraph

This project includes a subgraph: ./subgraph

See the Kovan Deployment here

Example usage

query {
  merkleDrops {
    id
    tranches {
      trancheId
      uri
      merkleRoot
      claims(where: { account_ends_with: "0x9167be9ece1a7f20c22ceadbe4fafafcd88d655d" }) {
        amount
        claimed
        account {
          lastClaimedTranche {
            trancheId
          }
        }
      }
    }
  }
}
{
  "data": {
    "merkleDrops": [
      {
        "id": "0x4278efcaef614b462d9193c7aa06e67a685bb586",
        "tranches": [
          {
            "claims": [
              {
                "account": {
                  "lastClaimedTranche": null
                },
                "amount": "20.22",
                "claimed": false
              }
            ],
            "merkleRoot": "0x893c9672ae7f772acf9e4f3f0eb86f071ced0ab52b2fc445d7147c2309d74024",
            "trancheId": 0,
            "uri": "ipfs://QmXAJS3xJLgnttfPzbD6G38bxMgEJ5me4MzFjXy1BiSDU2"
          }
        ]
      }
    ]
  }
}