Skip to content

bleu/cow-airdrop-contract-deployer

Repository files navigation

Airdrop Contract Deployer

Use this project to deploy your ERC20 airdrop contracts. It follows the patttern interpreted by the CoW Aidrop Hooks dapp. To learn more about CoW Hooks, click here or take a look at the Swap with hooks page.

In order to deploy the contract and build the needed off-chain data of your airdrop, you will need to input a .csv file containing two columns: Address (the token receivers) and Airdrop (the amount of tokens of each one).

This contract uses the merkle proof system (see more about here) to check the claim legitimacy.

After following the steps below, you should have a folder containing the folder that the CoW frontend application will nedd to access to verify the users possible claims (see example here). If your wish is that your contract should appear in the CoW Airdrop Hooks application, you should make your folder available through a http request (possibly using github, for example).

Dependencies

  • yarn

Usage

1. Install modules

yarn install

2. Move your input .csv file with airdrop allocations to /input-folder and fill the .env with its name

An example .csv file can be seen here

The output should look like this plus a merkleRoot.json file

3. Process files. Convert the .csv into a folder containing the merkleProof, the chunks and the mapping.json file

yarn preprocess

4. Set up contract constructor variables in .env file:

  • set MERKLE_ROOT to the merkleRoot generated in /mock-airdrop-data/merkleRoot.json
  • set TOKEN_ADDRESS to the contract address in the network you want to deploy of the token to be used

5. Compile contract

npx hardhat compile

6. Deploy contract

  • Declare your network RPC URL and private key in the .env file
  • change /hardhat.config.ts to support the network you want to deploy
npx hardhat ignition deploy ignition/modules/MerkleDistributor.ts --deployment-id <id_of_your_choice>

The parameter <id_of_your_choice> is optional and you can use to make it easier to verify the contract later

7. Verify contract

Declare your Etherscan API key in the .env file

npx hardhat ignition verify <optional_id_of_your_choice>

Integrate with CoW Aidrop Hooks

If you want your airdrop to be claimable from CoW Airdrop Hooks, you can contact CoW community using Discord!

Just make sure you have the airdrop and token contract addresses for each network you deployed!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published