Skip to content

thematters/airdrops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airdops

A fork from merkle-airdrop-starter and merkle-distributor, but with snapshots!

Setup

# Install dependencies
npm install

Install Foundry for contract development and deployment.

Take Snapshots

To take snapshots from POAPs and token contracts, please config scripts/snapshots/config.json.

# `./data/the-space-initial-airdrop` is the output directory
npm run snapshot -- ./data/the-space-initial-airdrop

POAP

Distribute amount of tokens to POAP owners.

We use POAP subgraph of The Graph as the source.

Note: Limits on 1000 addresses, needs support for pagination.

npm run snapshot:poapOwners -- ./data/the-space-initial-airdrop

Token Owners (ERC-721, ERC-20, ERC-1155)

Distribute amount of tokens to token owners.

For Owners of a Collection

We use Alchemy Transfers API and getNFTsForCollection as the source.

npm run snapshot:collectionOwners -- ./data/the-space-initial-airdrop

For Owners of a Token ID

We use getOwnersForToken as the source.

npm run snapshot:tokenOwners -- ./data/the-space-initial-airdrop

Transfers

Distribute amount of tokens based on transfer count.

npm run snapshot:transfers -- ./data/the-space-initial-airdrop

Generate Merkle Root

After snapshots are taken, we can generate merkle root (outputs to data/the-space-initial-airdrop/merkle.json).

Note: You can also put owner addresses (JSON file) to data/the-space-initial-airdrop folder as from different sources and update data/the-space-initial-airdrop/config manually.

# `./data/the-space-initial-airdrop` is the inputs (owner addresses) and outputs (proofs)
npm run generate:merkle -- ./data/the-space-initial-airdrop

Deployment

Now we can update the merkle root to .env.* file, and deploy the contract to desired network.

cp .env.polygon-mumbai.example .env.polygon-mumbai

make deploy NETWORK=polygon-mumbai

Test

cp .env.polygon-mumbai.example .env.polygon-mumbai

make test NETWORK=polygon-mumbai

Static Analysis

https://book.getfoundry.sh/config/static-analyzers.html#static-analyzers

pip3 install slither-analyzer
pip3 install solc-select
solc-select install 0.8.13
solc-select use 0.8.13
slither contracts/Airdrop.sol