{
    "cells": [
        {
            "language": "markdown",
            "source": [
                "# Deploy contract"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "\n### How to deploy\n1. Make sure all `node_modules` dependencies are installed\n2. Set env variables in the `.env` file\n3. Cleanup previous builds if they exist\n4. Build & test contracts locally\n5. Deploy exchange contract with Hardhat\n6. Verify exchange contract code on Etherscan\n7. Set minimum fee\n8. Done 😊\n\n### Supported networks\n\n- `local`\n- `marsbase`\n- `rinkeby`\n- `mainnet`"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "## Deployment"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "### 1. Install deps\n\n```shell\nyarn\n```\n\nIt's best to cleanup first, and to install with frozen lockfile:\n\n```shell\nrm -rf node_modules\nyarn --frozen-lockfile\n```"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "### 3. Cleanup previous builds if they exist\n\n```shell\nrm -rf ./artifacts ./cache\n```"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "### 4. Build & test contracts locally\n\n```shell\nyarn test\n```"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "### 5. Deploy Marsbase Exchange contract\n\n```shell\nyarn hardhat deploy-exchange --offerid 0 --network marsbase\n```"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "### 6. Verify Marsbase Exchange source code on Etherscan\n\n```shell\nyarn hardhat verify --network mainnet <EXCHANGE_ADDRESS> <startOfferId>\n```"
            ],
            "outputs": []
        },
        {
            "language": "markdown",
            "source": [
                "### 7. Set minimum fee\n\n```\nyarn hardhat set-minimum-fee --exchange <EXCHANGE_ADDRESS> --fee 0.5% --network marsbase\n```"
            ],
            "outputs": []
        }
    ]
}