Skip to content

Commit

Permalink
feat: Puffer token wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed Dec 2, 2024
1 parent a702097 commit 15affbc
Show file tree
Hide file tree
Showing 34 changed files with 322 additions and 1,967 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Parameters
Licensor: Angle Labs, Inc.

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

Additional Use Grant: Any uses listed and defined at
merkl-license-grants.angle-labs.eth
Expand Down
86 changes: 30 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,101 +1,75 @@
# <img src="logo.svg" alt="Merkl Contracts" height="40px"> Merkl Contracts

[![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 the Merkl product developed by Angle.
This repository contains the smart contracts of Merkl.

It basically contains two contracts:

- `DistributionCreator`: to which DAOs and individuals can deposit their rewards to incentivize a pool
- `DistributionCreator`: to which DAOs and individuals can deposit their rewards to incentivize onchain actions
- `Distributor`: the contract where users can claim their rewards

You can learn more about the Merkl system in the [documentation](https://docs.angle.money/side-products/merkl).
You can learn more about the Merkl system in the [documentation](https://docs.merkl.xyz).

## Setup

### Install packages

You can install all dependencies by running

```bash
yarn
forge i
```
@@ -25,7 +25,7 @@ forge i

### Create `.env` file

In order to interact with non local networks, you must create an `.env` that has, for all supported networks (Ethereum, Polygon and Arbitrum):
In order to interact with non local networks, you must create an `.env` that has, for all supported networks:

- `MNEMONIC`
- `ETH_NODE_URI`
- `ETHERSCAN_API_KEY`

You can copy paste the `.env.example` file into `.env` and fill with your keys/RPCs.
@@ -84,18 +84,52 @@ forge update

Warning: always keep your confidential information safe.

### Tests

Contracts in this repo rely on Hardhat tests. You can run tests as follows:
## Verifying

```bash
# Whole test suite
yarn hardhat:test
Blast:

# Only one file
yarn hardhat:test ./test/hardhat/distributor/distributor.test.ts
```

You can also check the coverage of the tests with:

```bash
yarn hardhat:coverage
yarn etherscan blast --api-url https://api.blastscan.io --solc-input --license BUSL-1.1
```

### Deploying
Mantle:

```bash
yarn deploy mainnet
```
yarn etherscan mantle --api-url https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan/api --solc-input --license BUSL-1.1
```

## Foundry Installation
Mode:

```bash
curl -L https://foundry.paradigm.xyz | bash
```
yarn etherscan mode --api-url https://api.routescan.io/v2/network/mainnet/evm/34443/etherscan/api --solc-input --license BUSL-1.1
```

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

foundryup
```
yarn etherscan immutablezkevm --api-url https://explorer.immutable.com/api --solc-input --license BUSL-1.1
```

To install the standard library:
Scroll:

```bash
forge install foundry-rs/forge-std
```
yarn etherscan scroll --api-url https://api.scrollscan.com --solc-input --license BUSL-1.1
```

To update libraries:
Gnosis:

```bash
forge update
```
yarn etherscan gnosis --api-url https://api.gnosisscan.io --solc-input --license BUSL-1.1
```

## Verifying
Linea:

Blast: `yarn etherscan blast --api-url https://api.blastscan.io --solc-input --license BUSL-1.1`
Mantle: `yarn etherscan mantle --api-url https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan/api --solc-input --license BUSL-1.1`
Mode: `yarn etherscan mode --api-url https://api.routescan.io/v2/network/mainnet/evm/34443/etherscan/api --solc-input --license BUSL-1.1`
ImmutableZKEVM: `yarn etherscan immutablezkevm --api-url https://explorer.immutable.com/api --solc-input --license BUSL-1.1`
Scroll:`yarn etherscan scroll --api-url https://api.scrollscan.com --solc-input --license BUSL-1.1`
Gnosis:`yarn etherscan gnosis --api-url https://api.gnosisscan.io --solc-input --license BUSL-1.1`
Linea:`yarn etherscan linea --api-url https://api.lineascan.build --solc-input --license BUSL-1.1`
```
yarn etherscan linea --api-url https://api.lineascan.build --solc-input --license BUSL-1.1
```

## Audits

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

## Media

Don't hesitate to reach out on [Twitter](https://twitter.com/AngleProtocol) 🐦
Don't hesitate to reach out on [Twitter](https://x.com/merkl_xyz)
6 changes: 2 additions & 4 deletions contracts/DistributionCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";

import { IUniswapV3Pool } from "./interfaces/external/uniswap/IUniswapV3Pool.sol";

import "./utils/UUPSHelper.sol";
import { CampaignParameters } from "./struct/CampaignParameters.sol";
import { DistributionParameters } from "./struct/DistributionParameters.sol";
Expand Down Expand Up @@ -72,7 +70,7 @@ contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
uint256 public immutable CHAIN_ID = block.chainid;

/// @notice `Core` contract handling access control
ICore public core;
IAccessControlManager public core;

/// @notice Contract distributing rewards to users
address public distributor;
Expand Down Expand Up @@ -175,7 +173,7 @@ contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
CONSTRUCTOR
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/

function initialize(ICore _core, address _distributor, uint256 _fees) external initializer {
function initialize(IAccessControlManager _core, address _distributor, uint256 _fees) external initializer {
if (address(_core) == address(0) || _distributor == address(0)) revert ZeroAddress();
if (_fees >= BASE_9) revert InvalidParam();
distributor = _distributor;
Expand Down
4 changes: 2 additions & 2 deletions contracts/Distributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract Distributor is UUPSHelper {
IERC20 public disputeToken;

/// @notice `Core` contract handling access control
ICore public core;
IAccessControlManager public core;

/// @notice Address which created the dispute
/// @dev Used to store if there is an ongoing dispute
Expand Down Expand Up @@ -147,7 +147,7 @@ contract Distributor is UUPSHelper {

constructor() initializer {}

function initialize(ICore _core) external initializer {
function initialize(IAccessControlManager _core) external initializer {
if (address(_core) == address(0)) revert ZeroAddress();
core = _core;
}
Expand Down
Loading

0 comments on commit 15affbc

Please sign in to comment.