---
# System prepended metadata

title: FathomUpgrade_mainnet_Aug

---


```markdown
# Mainnet Upgrade Instructions

Follow the steps below to upgrade the mainnet:

## Step 1: Clone the Repository

- Clone the `XDCChainFork` repository to your local machine.

## Step 2: Install Dependencies

- Since `XDCChainFork` is a Hardhat project, you'll need to install the necessary dependencies. Run the following command in your terminal:
  ```bash
  npm i
  ```

## Step 3: Move Contracts Folder

- Transfer the `FathomStablecoin devBranch` contracts folder to the cloned `XDCChainFork` project.

## Step 4: Verify JSON Files Content

Ensure that the content in the `.json` files is correct in the following directory: `XDCChainFork/scripts/addresses/mainnet`.

- `addresses.json`: This file contains contract names and proxy addresses that need an upgrade. Note that two of the contracts require an update, not an upgrade, so they have additional details.
  
- `proxyAddresses.json`: This file lists the proxy addresses required for deployment.
  
- `proxyAdminAddress.json`: This file contains the address of the `proxyAdminAddress`.

if you wish to test upgrade on apothem, you can fill in the .json files accordingly in `XDCChainFork/scripts/addresses/apothem`

## Step 5: Compile the Project

- Compile the project by running the following command:
  ```bash
  npx hardhat compile
  ```

## Step 6: Set Up Private Key

- Configure your private key in the `.env` file.
  
- Alternatively, if you prefer using a ledger with Hardhat, you can do so. However, experiences might differ. More details are available [here](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-ledger).

## Step 7: Make sure that 
`XDCChainFork/scripts/0_a_upgrade.js`

has network variable set in the environment that you want
if network is set as 'apothem' like below, the script will read .json files in apothem folder

let network = 'apothem';  // default value

if you would like to run the script for 'mainnet', please set the network variable's value as below

let network = 'apothem';  // default value



## Step 8: Run the Upgrade

- Execute the upgrade by running the following command:
  ```bash
  make new
  ```

## Step 9: After the scripts finishes running, please go ahead and check in the scanner if there was any reverted tx,

Sometimes XDC chain reverts w/o any reason, if any upgrade tx was revert, the tx needs to be sent again to the network.



Ensure you follow these instructions meticulously. If you face any challenges, please contact the designated person or team for assistance.

---

# Plan X: Revert to a Previous Version of the Codebase

1. Choose a version of the smart contracts from the `FathomStablecoin` repository.
2. Place the selected smart contracts inside the `contracts` folder.
3. Delete the `artifacts` and `cache` folders.
4. Resume from **Step 4** of the mainnet upgrade instructions.
5. and in **Step 7**, 

- run the following command:
  ```bash
  make rollback
  ```

```
