Socket
Book a DemoInstallSign in
Socket

@mstable/merkle-drop

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@mstable/merkle-drop

Merkle Drop

2.0.0
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
4
Weekly downloads
 
Created
Source

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"
          }
        ]
      }
    ]
  }
}

FAQs

Package last updated on 08 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.