Skip to main content

Cloning the repository

Overview

This guide will walk you through the necessary steps to clone the repository, install dependencies, set up an Alchemy API key, and run a local Node with an Arbitrum Sepolia Fork. By following these steps, you will be able to simulate and interact with the Chromatic Protocol contracts.

Prerequisites

Before you begin, ensure that you have the following prerequisites installed and properly configured on your development environment:

  1. Yarn: Yarn is a package manager for JavaScript. Make sure you have Yarn installed. If you don't, you can refer to the Yarn documentation for installation instructions specific to your operating system.

  2. Foundry: Foundry is a development toolkit for Ethereum projects. Ensure that Foundry is properly installed and configured on your machine. Refer to the Foundry documentation for installation and setup instructions.

By having Yarn and Foundry installed, you can seamlessly run the Chromatic-Protocol scripts and leverage the full functionality of the project.

Step 1: Clone Repository & Dependencies installation

  1. Open a terminal or command prompt.
  2. Change to the directory where you want to clone the Chromatic-Protocol repository.
  3. Execute the following command to clone the repository:
$ git clone https://github.com/chromatic-protocol/contracts
  1. Once the cloning process is complete, change to the project directory:
$ cd contracts
  1. Install the project dependencies by running the following command:
$ yarn install
$ forge install

Step 2: Create Alchemy API Key and Set the .env File

The scripts of Chromatic-protocol contracts (tests, local chain, etc.) are written to operate by basically forking the Arbitrum Sepolia network(refer to hardhat.config.ts). To fork the Arbitrum Sepolia network, refer to the guide below to create an Alchemy API Key.

  1. To obtain the necessary Alchemy API Key, visit the Alchemy website and follow the instructions outlined in their Quickstart guide

  2. Within the project directory, create a new file called .env using your preferred text editor.

  3. Add the following line to the .env file, replacing <ALCHEMY_API_KEY> with your actual Alchemy API Key obtained in the previous step:

ALCHEMY_API_KEY=<ALCHEMY_API_KEY>

Note: The Chromatic-Protocol contracts scripts are designed to work with the Arbitrum Sepolia network fork by default. This means that when you run the project locally, it will connect to the Arbitrum Sepolia network fork, providing a simulated environment for testing and development purposes.

Step 3: Run local Node with Arbitrum Sepolia Fork

To simulate the Chromatic-Protocol and test its functionality, you will need to run a local Arbitrum Sepolia fork network. Follow these steps to set it up:

  1. In the project directory, open a terminal or command prompt.
  2. Execute the following command to start the local node with an Arbitrum Sepolia fork:
$ yarn chain

If the command is executed successfully, you should see the message this message in the console.

eth_chainId
eth_getTransactionByHash
✨ Create Market
✨ Done!

This indicates that the contracts required for the Chromatic-Protocol have been deployed successfully on the local node.