Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ description: Deploying a smart contract

# Deploying a smart contract

Deploying a smart contract in SettleMint won't be much different from doing so in your own environment.

There are two main ways to deploy smart contracts in SettleMint: you can either run the commands manually in your terminal or use the Task Manager.
You can deploy your contracts to a network in the platform or a hardhat network running locally in the IDE.

The typical folder structure of SettleMint's smart contract set will include:

Expand All @@ -22,35 +20,79 @@ The typical folder structure of SettleMint's smart contract set will include:
- **`hardhat.config`**: Hardhat configuration file.
- **`subgraphs`**: Contains the indexing logic for your subgraphs, specific to your smart contract.

## Deploy with Task Manager
The smart contract sets include all the commands you need to compile and deploy your contracts. They are available as tasks in the Task Manager. Follow these steps to access the Task Manager:

**Step 1**: Open the IDE

![Open IDE](../../../../../static/img/deploy-scs/open-ide.png)

**Step 2**: Click on the `Task Manager` button

![Task Manager](../../../../../static/img/deploy-scs/task-manager.png)

## Compile

You need to compile your contracts before you can deploy them. SettleMint's smart contract sets include both Hardhat and Foundry. You can compile using your preferred framework.

### Hardhat

To compile your contracts using Hardhat, you can run the `Hardhat - Build` task

![Hardhat compile task manager](../../../../../static/img/deploy-scs/hardhat-build.png)

### Foundry

To compile your contracts using Foundry, you can run the `Foundry - Build` task

![Foundry compile task manager](../../../../../static/img/deploy-scs/foundry-build.png)

## Deploy to a network in the platform

You can deploy your contracts to a network in the same application as the smart contract set by running the `Hardhat - Deploy to platform network` task

:::note

Ensure you have the following:

- A running node in the network
- A private key activated on the node

:::

### Hardhat

**Step 1**: Log in to the platform by running the `SettleMint - Login` task

![SettleMint login](../../../../../static/img/deploy-scs/settlemint-login.png)

**Step 2**: Run the `Hardhat - Deploy to platform network` task

![Hardhat deploy remote task manager](../../../../../static/img/deploy-scs/hardhat-deploy-remote.png)

**Step 3**: Select the node you want to deploy to

![Hardhat deploy remote select node](../../../../../static/img/deploy-scs/hardhat-deploy-remote-select-node.png)

Follow these steps to deploy a contract using the Task Manager:
**Step 4**: Select the private key you want to use for the deployment

1. Click `View in Fullscreen Mode` for a better user experience :)
![Fresh IDE](../../../../../static/img/deploy-scs/full-screen-mode.png)
![Hardhat deploy remote select private key](../../../../../static/img/deploy-scs/hardhat-deploy-remote-select-private-key.png)

2. Navigate to the `Task Manager`.
![Task Manager](../../../../../static/img/deploy-scs/nav-task-mg.png)
**Step 5**: Confirm the deployment

3. Click `Foundry - Build` or `Hardhat - Build` to compile the Smart Contract.
![Press Build](../../../../../static/img/deploy-scs/task-mg-build.png)
![Hardhat deploy remote success](../../../../../static/img/deploy-scs/hardhat-deploy-remote-success.png)

4. Then run `Hardhat - Deploy to local network` to deploy locally or `Hardhat - Deploy to platform network` to deploy to your connected network.
![Press Deploy](../../../../../static/img/deploy-scs/task-mg-deploy.png)
## Deploy to a local network

Great job! Your contract has been successfully deployed.
### Hardhat

## Deploy with the Terminal
**Step 1**: Start the local hardhat network by running the `Hardhat - Start local network` task

Follow these steps to deploy a contract using the terminal:
![Hardhat start local network](../../../../../static/img/deploy-scs/hardhat-start-local-network.png)

1. Open the terminal.
![Open Terminal](../../../../../static/img/deploy-scs/open-terminal.png)
**Step 2**: Then, run the `Hardhat - Deploy to local network` task. Ensure you don't stop the previous task, because the hardhat network needs to be running for the contract to be deployed on it.

2. Run the command `forge build` or `Hardhat compile` to compile the smart contracts.
![Build Terminal](../../../../../static/img/deploy-scs/terminal-build.png)
![Hardhat deploy local network](../../../../../static/img/deploy-scs/hardhat-deploy-local-network.png)

3. Then run `npx hardhat ignition deploy IGNITION_MODULE_PATH` or forge create --rpc-url YOUR_RPC_URL --private-key YOUR_PRIVATE_KEY --constructor-args ARG1 ARG2` to deploy to your connected network.
![Deploy Terminal](../../../../../static/img/deploy-scs/terminal-deploy.png)
Success! The contract has been deployed to the local network.

Well done! You've successfully deployed your contract.
![Hardhat deploy local network success](../../../../../static/img/deploy-scs/hardhat-deploy-local-success.png)
Binary file added static/img/deploy-scs/foundry-build.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/img/deploy-scs/full-screen-mode.png
Binary file not shown.
Binary file added static/img/deploy-scs/hardhat-build.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/deploy-scs/hardhat-deploy-remote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/img/deploy-scs/nav-task-mg.png
Binary file not shown.
Binary file added static/img/deploy-scs/open-ide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/img/deploy-scs/open-terminal.png
Binary file not shown.
Binary file added static/img/deploy-scs/settlemint-login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/deploy-scs/task-manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/img/deploy-scs/task-mg-build.png
Binary file not shown.
Binary file removed static/img/deploy-scs/task-mg-deploy.png
Binary file not shown.
Binary file removed static/img/deploy-scs/terminal-build.png
Binary file not shown.
Binary file removed static/img/deploy-scs/terminal-deploy.png
Binary file not shown.