This repository contains the core smart contracts for the Merkl solution.
The system consists of two primary contracts:
DistributionCreator: Allows DAOs and individuals to deposit rewards for incentivizing onchain actionsDistributor: Enables users to claim their earned rewards
Learn more about Merkl in the official documentation.
Install all dependencies by running:
bun iCopy the .env.example file to .env and populate it with your keys and RPC endpoints:
cp .env.example .envWarning: Always keep your confidential information secure and never commit .env files to version control.
Install Foundry using the official installer:
curl -L https://foundry.paradigm.xyz | bash
source /root/.zshrc
# or, if you're using bash: source /root/.bashrc
foundryupRun the complete test suite:
forge testRun a script without broadcasting transactions to the network:
yarn foundry:script <path_to_script> --rpc-url <network>Execute and broadcast transactions:
yarn foundry:deploy <path_to_script> --rpc-url <network>Scripts can be executed with or without parameters:
- With parameters: Pass values directly as command-line arguments
- Without parameters: Modify default values within the script file before running
Execute scripts using the following pattern:
# With parameters - pass values as arguments
forge script scripts/MockToken.s.sol:Deploy --rpc-url <network> --sender <address> --broadcast -i 1 \
--sig "run(string,string,uint8)" "MyToken" "MTK" 18
# Without parameters - modify default values in the script first
forge script scripts/MockToken.s.sol:Deploy --rpc-url <network> --sender <address> --broadcast -i 1
# Common options:
# --broadcast Broadcasts transactions to the network
# --sender <address> Address that will execute the script
# -i 1 Opens an interactive prompt to securely enter the sender's private keyforge script scripts/MockToken.s.sol:Deploy --rpc-url <network> --sender <address> --broadcast \
--sig "run(string,string,uint8)" "MyToken" "MTK" 18forge script scripts/MockToken.s.sol:Mint --rpc-url <network> --sender <address> --broadcast \
--sig "run(address,address,uint256)" <token_address> <recipient> 1000000000000000000forge script scripts/DistributionCreator.s.sol:SetRewardTokenMinAmounts --rpc-url <network> --sender <address> --broadcast \
--sig "run(address,uint256)" <reward_token_address> <min_amount>forge script scripts/DistributionCreator.s.sol:SetCampaignFees --rpc-url <network> --sender <address> --broadcast \
--sig "run(uint32,uint256)" <campaign_type> <fees>For scripts without parameters, modify the default values directly in the script file before execution:
// In scripts/MockToken.s.sol:Deploy
function run() external broadcast {
// MODIFY THESE VALUES TO SET YOUR DESIRED TOKEN PARAMETERS
string memory name = 'My Token'; // <- Customize token name
string memory symbol = 'MTK'; // <- Customize token symbol
uint8 decimals = 18; // <- Customize decimal places
_run(name, symbol, decimals);
}The Merkl smart contracts have been audited by Code4rena. View the Code4rena audit report for details.
Reach out to us on Twitter 🐦