Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
{
"files": "*.sol",
"options": {
"printWidth": 120,
"printWidth": 145,
"singleQuote": false,
"bracketSpacing": true
"bracketSpacing": true,
"explicitTypes": "always"
}
}
]
Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

First of all thank you for your interest in this repository!

This is only the beginning of the Angle protocol and codebase, and anyone is welcome to improve it.
This is only the beginning of the Merkl solution and codebase, and anyone is welcome to improve it.

To submit some code, please work in a fork, reach out to explain what you've done and open a Pull Request from your fork.

Feel free to reach out in the [#developers channel](https://discord.gg/HcRB8QMeKU) of our Discord Server if you need a hand!
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.

Parameters

Licensor: Angle Labs, Inc.
Licensor: Merkl SAS.

Licensed Work: Merkl Smart Contracts
The Licensed Work is (c) 2025 Angle Labs, Inc.
The Licensed Work is (c) 2025 Merkl SAS.

Additional Use Grant: Any uses listed and defined at
merkl-license-grants.angle-labs.eth
Expand Down
89 changes: 55 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,131 +1,152 @@
[![CI](https://github.com/AngleProtocol/merkl-contracts/actions/workflows/ci.yml/badge.svg)](https://github.com/AngleProtocol/merkl-contracts/actions)
[![Coverage](https://codecov.io/gh/AngleProtocol/merkl-contracts/branch/main/graph/badge.svg)](https://codecov.io/gh/AngleProtocol/merkl-contracts)

This repository contains the smart contracts of Merkl.
This repository contains the core smart contracts for the Merkl solution.

It basically contains two contracts:
The system consists of two primary contracts:

- `DistributionCreator`: to which DAOs and individuals can deposit their rewards to incentivize onchain actions
- `Distributor`: the contract where users can claim their rewards
- `DistributionCreator`: Allows DAOs and individuals to deposit rewards for incentivizing onchain actions
- `Distributor`: Enables users to claim their earned rewards

You can learn more about the Merkl system in the [documentation](https://docs.merkl.xyz).
Learn more about Merkl in the [official documentation](https://docs.merkl.xyz).

## Setup

### Install packages

You can install all dependencies by running
Install all dependencies by running:

```bash
bun i
```

### Create `.env` file

You can copy paste `.env.example` file into `.env` and fill with your keys/RPCs.
Copy the `.env.example` file to `.env` and populate it with your keys and RPC endpoints:

Warning: always keep your confidential information safe.
```bash
cp .env.example .env
```

**Warning:** Always keep your confidential information secure and never commit `.env` files to version control.

### Foundry Installation

Install Foundry using the official installer:

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

source /root/.zshrc
# or, if you're under bash: source /root/.bashrc
# or, if you're using bash: source /root/.bashrc

foundryup
```

## Tests

Run the complete test suite:

```bash
# Whole test suite
forge test
```

## Deploying

Run without broadcasting:
### Simulate deployment (dry run)

Run a script without broadcasting transactions to the network:

```bash
yarn foundry:script <path_to_script> --rpc-url <network>
```

Run with broadcasting:
### Deploy to network

Execute and broadcast transactions:

```bash
yarn foundry:deploy <path_to_script> --rpc-url <network>
```

## Scripts

Scripts can be executed in two ways:
Scripts can be executed with or without parameters:

1. With parameters: directly passing values as arguments
2. Without parameters: modifying the default values in the script
1. **With parameters:** Pass values directly as command-line arguments
2. **Without parameters:** Modify default values within the script file before running

### Running Scripts

Execute scripts using the following pattern:

```bash
# With parameters
# 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)
# 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 the transactions to the network
# --sender <address> The address which will execute the script
# -i 1 Open an interactive prompt to enter private key of the sender when broadcasting
# --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 key
```

### Examples

#### Deploy a mock ERC20 token

```bash
# Deploy a Mock Token
forge script scripts/MockToken.s.sol:Deploy --rpc-url <network> --sender <address> --broadcast \
--sig "run(string,string,uint8)" "MyToken" "MTK" 18
```

# Mint tokens
#### Mint tokens to an address

```bash
forge script scripts/MockToken.s.sol:Mint --rpc-url <network> --sender <address> --broadcast \
--sig "run(address,address,uint256)" <token_address> <recipient> 1000000000000000000
```

# Set minimum reward token amount
#### Configure minimum reward token amount

```bash
forge script scripts/DistributionCreator.s.sol:SetRewardTokenMinAmounts --rpc-url <network> --sender <address> --broadcast \
--sig "run(address,uint256)" <reward_token_address> <min_amount>
```

#### Set campaign fees

# Set fees for campaign
```bash
forge script scripts/DistributionCreator.s.sol:SetCampaignFees --rpc-url <network> --sender <address> --broadcast \
--sig "run(uint32,uint256)" <campaign_type> <fees>

# Toggle token whitelist status
forge script scripts/DistributionCreator.s.sol:ToggleTokenWhitelist --rpc-url <network> --sender <address> --broadcast \
--sig "run(address)" <token_address>
```

For scripts without parameters, you can modify the default values directly in the script file:
### Modifying Default Script Parameters

For scripts without parameters, modify the default values directly in the script file before execution:

```solidity
// In scripts/MockToken.s.sol:Deploy
function run() external broadcast {
// MODIFY THESE VALUES TO SET YOUR DESIRED TOKEN PARAMETERS
string memory name = 'My Token'; // <- modify this
string memory symbol = 'MTK'; // <- modify this
uint8 decimals = 18; // <- modify this
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);
}
```

## Audits

The Merkl smart contracts have been audited by Code4rena, find the audit report [here](https://code4rena.com/reports/2023-06-angle).
The Merkl smart contracts have been audited by Code4rena. View the [Code4rena audit report](https://code4rena.com/reports/2023-06-angle) for details.

## Access Control

![Access Control Schema](docs/access_control.svg)

## Media

Don't hesitate to reach out on [Twitter](https://x.com/merkl_xyz) 🐦
Reach out to us on [Twitter](https://x.com/merkl_xyz) 🐦
Loading