> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerzero.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Recreating Deployments

> Use Recreating Deployments with LayerZero V2. Developer tools for building and debugging omnichain applications. LayerZero enables crosschain messaging.

This guide is intended for situations where you might have lost access to the original project code, or the deployment was made outside of a project initialized by [create-lz-oapp](./guide). It explains how to reconstruct the expected deployments layout so you can use the Hardhat helper tasks.

Under the hood, create-lz-oapp uses [Hardhat Deploy](https://github.com/wighawag/hardhat-deploy) v1 to manage deployments. All EVM deployments follow Hardhat Deploy's conventions.

## Invariants

Note the following when using a project created via `create-lz-oapp` or when using any of the Hardhat helper tasks:

* For EVM chains, the network name set in `hardhat.config.ts` must match the folder names under `/deployments`
* For Solana, the deployment subfolder should either be `/solana-mainnet` or `/solana-testnet` (`solana-testnet` refers to Solana Devnet)

## Recreate Deployments

For this example, we'll recreate deployments for an **OFT** that was deployed on **Arbitrum Sepolia** and **Solana Devnet**. Before following the steps, you need to at least have the address of the OFT on Arbitrum Sepolia, and the OFT Store address on Solana Devnet (not the Mint Address).

1. Create a new project using the [create-lz-oapp CLI](./guide). For an EVM-only OFT, you can choose `OFT` when prompted. For an OFT that is both on EVM and Solana, choose `OFT (Solana)`.

2. Create a `deployments` folder in the root of the repo. The eventual structure would look like this:
   ```text wrap theme={null}
   /deployments
       /arbitrum-sepolia
         .chainId
         MyOFT.json
       /solana-testnet
         OFT.json
   ```

> For the EVM chain deployments, if you previously deployed using Hardhat Deploy, simply copy over the contents of the deployments folder from your previous project.

3. Under `/deployments`, for the EVM chain (Arbitrum Sepolia in this example), create an `/arbitrum-sepolia` folder which contains:

* `/arbitrum-sepolia/.chainId` - this file should contain the chain ID for the network, and **not** the Endpoint ID. Chain IDs can be found in the table [here](/v2/deployments/deployed-contracts).
* `/arbitrum-sepolia/MyOFT.json` - this is where the OFT's address is set. The only key that is necessary in the JSON file is `address`. You can see a sample of that below, insert your OFT address into the `address` field. The required ABI will be handled by step 6.

  ```json wrap theme={null}
  {
    "address": ""
  }
  ```

4. For Solana, create a `/solana-testnet` folder which contains:

* `/solana-testnet/OFT.json` - in here are several addresses required by the Solana OFT. Below is an example of a full file with all the necessary keys:

  ```json wrap theme={null}
  {
    "programId": "",
    "mint": "",
    "mintAuthority": "",
    "escrow": "",
    "oftStore": ""
  }
  ```

  > Given the Solana OFT Store address, you can run `npx hardhat lz:oft:store:debug --oft-store <OFT_STORE> --eid <SOLANA_EID>` to view debug information that contains the relevant Solana addresses.

5. Modify `hardhat.config.ts` and `layerzero.config.ts` accordingly.

* in this example, the network name in `hardhat.config.ts` should be `arbitrum-sepolia` to match the folder name under `/deployments`.
* For how to configure `layerzero.config.ts`, refer to the [Simple Config Generator](/v2/tools/simple-config) page.

6. Run `npm run compile:hardhat` to ensure relevant artifacts that are required by Hardhat helper tasks involving the EVM OFT are generated. For example, the `send` helper task when sending from an EVM chain requires the `OFT` artifact's ABI.

7. Run `npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts` and it should suggest transactions for your recreated deployments.

   ```bash wrap theme={null}
   npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts
   ```
