这是indexloc提供的服务,不要输入任何密码
Skip to content

ducanh2706/merkle-airdrop-yul-assembly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Merkle Airdrop in Yul Assembly

Overview

A fully Yul assembly implementation of a token airdrop contract. It leverages Merkle Tree proofs to verify eligible claimer addresses and EIP-712 signatures to authorize claims, providing a gas-efficient and low-level approach to secure token distribution.

Features

  • Verify user eligibility for token claim via Merkle Tree proofs
  • Enforce EIP-712 signed messages for secure claim authorization
  • Immutable storage of Merkle root and airdrop token address in bytecode
  • Minimal, gas-optimized logic written entirely in Yul assembly

File Structure

  • src/MerkleAirdrop.yul The core airdrop contract written in Yul. Implements functions to:

    • claim(...): Validate proofs & signatures, mark claims, and transfer tokens
    • getMerkleRoot(), getAirdropToken(), getMessageHash(), hasClaimed(): Read-only helpers
    • EIP-712 domain & message hashing
    • Merkle proof verification and safe ERC-20 transfer
  • test/helper/YulDeployer.t.sol A Foundry helper contract for deploying fully Yul-based contracts within tests. Modified from CodeForcer/foundry-yul.

  • test/MerkleAirdrop.t.sol Minimal unit tests for MerkleAirdrop.yul covering basic view methods and claim flow.

Prerequisites

Install Foundry

curl -L https://foundry.paradigm.xyz | bash
foundryup

Install Solidity Compiler

macOS

brew update
brew tap ethereum/ethereum
brew install solidity
solc --version

Linux

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt update
sudo apt install solc
solc --version

Testing

Use Foundry to run the test suite:

forge test

Warning

This project is for educational purposes only and should not be used in production. The code has not been security audited.

License

MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published