Pick a merkle distribution contract for the Minipay Airdrop
Closed this issue · 4 comments
Overview
We need a basic ERC20 token distributor based on a merkle-tree. This Uniswap Merkle Distributor is a good candidate but a bit more research can be done to pick the best one. It should fit the same baseline functionality as the Uniswap one.
Acceptance criteria
- Contract should be audited.
- Solidity >=0.8.
- Contract is picked and the decision is recorded as a comment in this issued.
UMA merkle distributor:
https://github.com/UMAprotocol/protocol/blob/master/packages/core/contracts/merkle-distributor/implementation/MerkleDistributor.sol
Can specify multiple merkles with unique reward outputs
- Solidity >= 0.8
https://github.com/balancer/erc20-redeemable
solidity 0.6.8;
https://github.com/pie-dao/vested-token-migration-app/blob/master/contracts/VestedTokenMigration.sol
Based on Aragon
Very old
Claude comparison of UMA vs Uniswap:
Still finding any relevant audits
Can you compare and list the functional differences between @MerkleDistributor.sol & @MerkleDistributor.sol
Certainly! I'll compare the two MerkleDistributor contracts and list the functional differences between them. I'll refer to the UMA version as "UMA MerkleDistributor" and the Uniswap version as "Uniswap MerkleDistributor".
1. Multiple Windows vs. Single Distribution:
- UMA MerkleDistributor supports multiple distribution windows, each with its own Merkle root and reward token.
- Uniswap MerkleDistributor has a single immutable Merkle root and token address set in the constructor.
2. Reward Token:
- UMA MerkleDistributor allows different ERC20 tokens for each window.
- Uniswap MerkleDistributor uses a single ERC20 token for all distributions.
Claim Structure:
- UMA MerkleDistributor uses a Claim struct with windowIndex, amount, accountIndex, account, and merkleProof.
- Uniswap MerkleDistributor passes these parameters directly in the claim function.
Claim Verification:
- UMA MerkleDistributor includes accountIndex in the leaf node hash.
- Uniswap MerkleDistributor uses index, account, and amount for the leaf node hash.
Batch Claims:
- UMA MerkleDistributor supports batch claims through the claimMulti function.
- Uniswap MerkleDistributor does not have batch claim functionality.
6. Admin Functions:
- UMA MerkleDistributor has admin functions like setWindow, deleteWindow, and withdrawRewards.
- Uniswap MerkleDistributor does not have any admin functions.
7. IPFS Hash:
- UMA MerkleDistributor stores an IPFS hash for each window.
- Uniswap MerkleDistributor does not store IPFS hashes.
Remaining Amount Tracking:
- UMA MerkleDistributor tracks the remaining amount of rewards for each window.
- Uniswap MerkleDistributor does not track remaining amounts.
9. Error Handling:
- UMA MerkleDistributor uses require statements for error checking.
- Uniswap MerkleDistributor uses custom errors (AlreadyClaimed and InvalidProof).
Inheritance:
- UMA MerkleDistributor inherits from MerkleDistributorInterface and Ownable.
- Uniswap MerkleDistributor only implements IMerkleDistributor.
11. Solidity Version:
- UMA MerkleDistributor uses Solidity ^0.8.0.
- Uniswap MerkleDistributor uses Solidity =0.8.17.
These differences show that the UMA MerkleDistributor is more feature-rich and flexible, supporting multiple distribution windows and administrative functions. The Uniswap MerkleDistributor, on the other hand, is simpler and more focused on a single distribution event.