|
1 |
| -## Foundry |
| 1 | +# Merkle Airdrop System |
2 | 2 |
|
3 |
| -**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** |
| 3 | +The Merkle Airdrop system enables the distribution of tokens via airdrops in a secure and gas-efficient manner using Merkle proofs to verify claims. This repository contains the smart contracts, testing suite, and deployment scripts necessary for setting up and managing a Merkle Airdrop. |
4 | 4 |
|
5 |
| -Foundry consists of: |
| 5 | +## Features |
6 | 6 |
|
7 |
| -- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). |
8 |
| -- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. |
9 |
| -- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. |
10 |
| -- **Chisel**: Fast, utilitarian, and verbose solidity REPL. |
| 7 | +- **Secure Token Distribution**: Uses Merkle proofs to ensure that airdrops are claimed only by eligible addresses. |
| 8 | +- **Gas Efficiency**: Reduces the gas cost by allowing users to prove their token claim without the need for on-chain storage of all possible claimants. |
| 9 | +- **EIP712 Signing**: Implements EIP712 for secure and verifiable signatures. |
| 10 | +- **Comprehensive Tests**: Includes a full suite of tests to ensure functionality and robustness. |
| 11 | +- **Script Automation**: Scripts to generate airdrop input data and Merkle proofs for deployment. |
11 | 12 |
|
12 |
| -## Documentation |
| 13 | +## Prerequisites |
13 | 14 |
|
14 |
| -https://book.getfoundry.sh/ |
| 15 | +Before you begin, ensure you have the following installed: |
15 | 16 |
|
16 |
| -## Usage |
17 |
| - |
18 |
| -### Build |
| 17 | +- [Foundry](https://book.getfoundry.sh/getting-started/installation.html) for Solidity testing and deployment |
19 | 18 |
|
20 |
| -```shell |
21 |
| -$ forge build |
22 |
| -``` |
| 19 | +## Installation |
23 | 20 |
|
24 |
| -### Test |
| 21 | +Clone the repository and install dependencies: |
25 | 22 |
|
26 |
| -```shell |
27 |
| -$ forge test |
| 23 | +```bash |
| 24 | +git clone https://your-repository-url.git |
| 25 | +cd merkle-airdrop-system |
| 26 | +forge install |
28 | 27 | ```
|
29 | 28 |
|
30 |
| -### Format |
| 29 | +## Usage |
31 | 30 |
|
32 |
| -```shell |
33 |
| -$ forge fmt |
34 |
| -``` |
| 31 | +### Generating Merkle Proofs |
35 | 32 |
|
36 |
| -### Gas Snapshots |
| 33 | +Generate input data and Merkle proofs by running: |
37 | 34 |
|
38 |
| -```shell |
39 |
| -$ forge snapshot |
| 35 | +```bash |
| 36 | +forge script script/GenerateInput.s.sol |
| 37 | +forge script script/MakeMerkle.s.sol |
40 | 38 | ```
|
41 | 39 |
|
42 |
| -### Anvil |
| 40 | +### Running Tests |
43 | 41 |
|
44 |
| -```shell |
45 |
| -$ anvil |
| 42 | +Execute the tests with Foundry: |
| 43 | + |
| 44 | +```bash |
| 45 | +forge test |
46 | 46 | ```
|
47 | 47 |
|
48 |
| -### Deploy |
| 48 | +## Smart Contracts |
49 | 49 |
|
50 |
| -```shell |
51 |
| -$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> |
52 |
| -``` |
| 50 | +- **MerkleAirdrop.sol**: Main contract for handling the airdrop. |
| 51 | +- **MockToken.sol**: Mock ERC20 token for testing purposes. |
53 | 52 |
|
54 |
| -### Cast |
| 53 | +## Scripts |
55 | 54 |
|
56 |
| -```shell |
57 |
| -$ cast <subcommand> |
58 |
| -``` |
| 55 | +- **GenerateInput.s.sol**: Generates the input data for the Merkle tree. |
| 56 | +- **MakeMerkle.s.sol**: Generates the Merkle tree root and proofs from the input data. |
59 | 57 |
|
60 |
| -### Help |
| 58 | +## License |
61 | 59 |
|
62 |
| -```shell |
63 |
| -$ forge --help |
64 |
| -$ anvil --help |
65 |
| -$ cast --help |
66 |
| -``` |
| 60 | +Distributed under the MIT License. See `LICENSE` for more information. |
0 commit comments