1.1.1 • Published 2 years ago

@sonne-finance/merkle-airdrop v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Merkle Airdrop

This repository contains the contracts for the Merkle Airdrop. The contracts are written in Solidity and are tested using Hardhat.

Overview

The Merkle Airdrop contract allows for airdrops to be done in a trustless manner. The contract is initialized with a Merkle root, which is a hash of all the airdrop recipients and their respective amounts. The contract then allows anyone to claim their airdrop by providing a Merkle proof that they are in the airdrop.

Building

Install Prerequisites

npm install

Run Tests

npm run test

Usage

npm i @sonne-finance/merkle-airdrop

### Setting the root for the airdrop

import { ethers } from 'ethers';
import { Airdrop, sendTx, setMerkleRoot } from '@sonne-finance/merkle-airdrop';

const setRoot = async () => {
    const data: Airdrop[] = [];

    const AIRDROP_ADDRESS = '';
    const WALLET: ethers.Wallet;
    const tx = await setMerkleRoot(data, { airdropAddress: AIRDROP_ADDRESS });
    await sendTx(tx, WALLET);
};

Claiming Airdrop

import { ethers } from 'ethers';
import { Airdrop, claim, sendTx } from '../client';

const claimAirdrop = async () => {
    const data: Airdrop[] = [];

    const AIRDROP_ADDRESS = '';
    const WALLET: ethers.Wallet;
    const tx = await claim(data, WALLET.address, { airdropAddress: AIRDROP_ADDRESS });
    await sendTx(tx, WALLET);
};
1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago