> For the complete documentation index, see [llms.txt](https://docs.xft.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xft.finance/learn/smart-contract-repo-setup.md).

# Smart contract repo setup

### COMMANDS

Make sure IDE is up to date. To upgrade node in the Windows powershell:&#x20;

```
winget install OpenJS.NodeJS.LTS
```

winget install OpenJS.NodeJS.LTS

```



npx hardhat compile
npx hardhat run scripts/deploy-convert.js --network sepolia
npx hardhat run scripts/deploy-convert-factory.js --network sepolia
npx hardhat run scripts/deploy-tokenized-convert.js --network sepolia
npx hardhat run scripts/deploy-tokenized-convert.js --network sepolia
npx hardhat run scripts/deploy-tokenized-stock-arbitrum-v2.js --network arbitrum_sepolia
npx hardhat run scripts/deploy-tokenized-stock-arbitrum-v3.js --network arbitrum_sepolia
npx hardhat run scripts/deploy-tokenized-stock-arbitrum-v4.js --network arbitrum_sepolia
npx hardhat run scripts/deploy-tokenized-stock-arbitrum-v4.js --network arbitrum_sepolia
npx hardhat run scripts/deploy-tokenized-stock-arbitrum-v4.js --network arbitrum_sepolia
clear
npx hardhat run scripts/deploy-tokenized-stock-arbitrum-v4.js --network arbitrum_sepolia
Get-History | ForEach-Object { $_.CommandLine } | Out-File all-commands.txt


Get-ChildItem -Recurse -File | Where-Object {$_.FullName -notmatch "node_modules|lib"} | Select-Object FullName
```

### HARDHAT \[[docs](https://v2.hardhat.org/hardhat-runner/docs/guides/project-setup)]

npm init -y\
npm install --save-dev hardhat\
npm install hardhat\
npx hardhat init\
npm pkg set type="module"

```
alexa@Alexs-Razer MINGW64 /c/XFT/prediction-mkts/prod
$ npx hardhat --init

WARNING: You are using Node.js 20.3.1 which is not supported by Hardhat.
Please upgrade to 22.10.0 or a later LTS version (even major version number)


 █████  █████                         ███  ███                  ███      ██████
░░███  ░░███                         ░███ ░███                 ░███     ███░░███
 ░███   ░███   ██████  ████████   ███████ ░███████    ██████  ███████  ░░░  ░███
 ░██████████  ░░░░░███░░███░░███ ███░░███ ░███░░███  ░░░░░███░░░███░      ████░
 ░███░░░░███   ███████ ░███ ░░░ ░███ ░███ ░███ ░███   ███████  ░███      ░░░░███
 ░███   ░███  ███░░███ ░███     ░███ ░███ ░███ ░███  ███░░███  ░███ ███ ███ ░███
 █████  █████░░███████ █████    ░░███████ ████ █████░░███████  ░░█████ ░░██████
░░░░░  ░░░░░  ░░░░░░░ ░░░░░      ░░░░░░░ ░░░░ ░░░░░  ░░░░░░░    ░░░░░   ░░░░░░

👷 Welcome to Hardhat v3.0.4 👷

? Which version of Hardhat would you like to use? ... 
> Hardhat 3 Beta (recommended for new projects)
  Hardhat 2 (older version)
```

Select Hardhat 2 (older version)\
Click enter for absolute project path\
Select an empty hardhat.config.js&#x20;

FILES

hardhat.config.js\
contracts/ConditionalToken.sol<br>

***

```javascript
// hardhat.config.js

require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
require("@openzeppelin/hardhat-upgrades");
require("dotenv").config();

module.exports = {
  solidity: {
    compilers: [
      {
        version: "0.8.18",
        settings: {
          viaIR: true,
          optimizer: {
            enabled: true,
            runs: 200,
          }
        }
      },
      {
        version: "0.8.24",
        settings: {
          optimizer: {
            enabled: true,
            runs: 200
          },
          evmVersion: "paris"
        }
      }
    ]
  },
  networks: {
    sepolia: {
      url: process.env.SEPOLIA_RPC_URL,
      accounts: [process.env.ADMIN_PRIVATE_KEY]
    },
    arbitrum_sepolia: {
      url: process.env.ARBITRUM_SEPOLIA_RPC_URL,
      accounts: [process.env.ADMIN_PRIVATE_KEY]
    },
    arbitrum_mainnet: {
      url: process.env.ARBITRUM_MAINNET_RPC_URL,
      accounts: [process.env.ADMIN_PRIVATE_KEY]
    },
    base_sepolia: {
      url: process.env.BASE_SEPOLIA_RPC_URL,
      accounts: [process.env.ADMIN_PRIVATE_KEY]
    },
    xdc_apothem: {
      url: process.env.XDC_APOTHEM_RPC_URL,
      accounts: [process.env.ADMIN_PRIVATE_KEY]
    },
    avalanche_fuji: {
      url: process.env.AVALANCHE_FUJI_RPC_URL,
      accounts: [process.env.ADMIN_PRIVATE_KEY]
    },
    polygon_amoy: {
      url: process.env.POLYGON_AMOY_RPC_URL,
      accounts: [process.env.ADMIN_PRIVATE_KEY]
    }
  },
  etherscan: {
  apiKey: {
    sepolia: process.env.ETHERSCAN_API_KEY,
    arbitrum_sepolia: process.env.ETHERSCAN_V2_API_KEY
  },
  customChains: [
     {
       network: "arbitrum_sepolia",
       chainId: 421614,
       urls: {
         apiURL: "https://api.etherscan.io/v2/api?chainid=421614",
         browserURL: "https://sepolia.arbiscan.io"
       }
     }
   ]
}
};
```
