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
61 changes: 61 additions & 0 deletions docs/using-platform/6_add_smart_contract_sets/0_smart_contracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Overview
description: Overview
sidebar_position: 0
---
# Deploying Smart Contracts

## Introduction

To make developing smart contracts easier, we offer an open-source [template library](/btp-docs/docs/using-platform/6_add_smart_contract_sets/1_smart_contract_templates.md) and an Integrated Development Environment (IDE). The template library includes pre-built smart contracts that you can customize to meet your specific needs.

If you need a fundamental explanation of what smart contracts are and how they work, we recommend contacting our team to join our Learn World Blockchain course. Our experts will guide you through the basics, ensuring you have a solid foundation before diving into development. For a practical guide, please visit [deploying a contract](/btp-docs/docs/using-platform/6_add_smart_contract_sets/deploying_a_contract.md).


SettleMint's smart contract sets include both Hardhat and Foundry, enabling you to compile, test, and deploy using your preferred framework or a combination of both. This flexibility allows you to optimize your development process to best suit your project needs and preferences.

## Overview of the Smart Contract Deployment Process on SettleMint

The following is a high-level overview of smart contract development processes at SettleMint.

### 1. Deploying a Smart Contract Set

- **Add Smart Contract Set**: Navigate to the smart contract sets page and press the button "Add Smart Contract Set."
- **Picking Your Template**: Pick the template of your choice.

### 2. Compiling and Configuring The Smart Contract

- **Compiling**: Convert your smart contract code into a format that the blockchain can understand and execute.
- **Configuring**: SettleMint sets all the necessary configurations for you,
- **Purpose**: Tailors the deployment process to your specific requirements and ensures your contract can run on the blockchain.

### 3. Deploying and Interacting with the Smart Contract
- **Deploying**: Upload your compiled smart contract to a blockchain network.
- **Interacting**: Once deployed, interact with the smart contract through transactions that call its functions.
- **Purpose**: Makes the contract accessible on the blockchain so users can interact with it and utilize its features to perform actions defined in its logic.

## Tools to Use

At SettleMint, we provide the option to use either Foundry or Hardhat. Both of these tools allow you to compile and deploy smart contracts within the SettleMint IDE. The workflow in both frameworks is very similar: you compile and then deploy the smart contracts.

### Foundry

Foundry is a toolkit for EVM development. It provides tools to compile, test, and deploy smart contracts.

1. **Initialize Project**: Set up your project folder and deploy a Foundry smart contract set.
2. **Write and Configure Contract**: Create your smart contract code in Solidity and set up your project settings in a `foundry.toml` file if needed.
3. **Compile and Deploy Contract**: Convert your Solidity code into bytecode and deploy your compiled contract to the blockchain network of your choice.

### Hardhat

Hardhat is a development environment for EVM software. It provides a flexible and extensible ecosystem for building, testing, and deploying smart contracts.

1. **Initialize Project**: Set up your project folder and deploy a Hardhat smart contract set.
2. **Write and Configure Contract**: Create your smart contract code in Solidity and set up your project settings in a `hardhat.config.js` file if needed.
3. **Compile and Deploy Contract**: Convert your Solidity code into bytecode and deploy your compiled contract to the blockchain network of your choice.

## Key Points
- **Smart Contracts**: Self-executing programs with predefined rules.
- **Compiling and Configuring**: Converts code into a format the blockchain can run and tailors the deployment process.
- **Deploying and Interacting**: Uploads the compiled code to the blockchain and makes it accessible for interaction.
By following these steps and using the appropriate tools, you can easily create, compile, and deploy smart contracts to automate and secure your business processes on the blockchain.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Templates
description: Rapid Deployment with Smart Contract Templates
sidebar_position: 1
---

SettleMint's smart contract templates serve as open-source, ready-to-use foundations for blockchain application development, significantly accelerating the deployment process. These templates enable users to quickly customize and extend their blockchain applications, leveraging tested and community-enhanced frameworks to reduce development time and accelerate market entry.

<div class="centered-image">
![Example banner](../../../static/img/smart-contract-sets/all-templates.png)
</div>

### Open-Source Smart Contract Templates under the MIT License
Benefit from the expertise of the blockchain community and trust in the reliability of your smart contracts. These templates are vetted and used by major enterprises and institutions, ensuring enhanced security and confidence in your deployments.

### Create Your Own Smart Contract Templates for Your Consortium
Within the self-managed Blockchain Transformation Platform (BTP), you can create and add your own templates for use within your consortium. This fosters a collaborative environment where templates can be reused and built upon, promoting innovation and efficiency within your network.

To get started, visit: [SettleMint GitHub Repository](https://github.com/settlemint/solidity-empty)

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Add a Smart Contract Set
description: Add a Smart Contract Set
sidebar_position: 1
---
# Add a Smart Contract Set

By using smart contract sets, you can add **business logic** to your application.

Smart contract sets are programs that run on the blockchain and define the rules of your use case. They are self-executing with an 'if this, then that' pattern and activate when predefined conditions are met, such as a smart contract that transfers the ownership of a car once a certain amount of money is transferred to the seller's account.

To expedite the process of writing and deploying smart contracts, we offer a [**template library**](/docs/using-platform/6_add_smart_contract_sets/1_%20smart_contract_templates.md) and an **Integrated Development Environment (IDE)**. The template library includes pre-built smart contract sets for specific use cases, which are easily customizable to match your needs.

## How to Add a Smart Contract Set

Navigate to the **application** where you want to add the smart contract set. Ensure you have a network with a node in place.

Click **Smart Contract Sets** in the left navigation, and then click **Add a Smart Contract Set**. This opens a form.

Follow these steps to add the smart contract set:

1. Navigate to **Smart Contract Sets** and press **Add a Smart Contract Set**.
![Smart contract sets](../../../static/img/smart-contract-sets/add-set.png)
2. Select which of your **blockchain nodes** the smart contract set needs to be deployed to, and click **Continue**.
![Select node](../../../static/img/smart-contract-sets/select-node.png)
3. Choose a **template**. The IDE instance will contain a set of pre-built smart contract templates for your selected use case.
![Select template](../../../static/img/smart-contract-sets/select-a-template.png)
4. Choose a **Smart Contract Set Name** that will be easily recognizable in your dashboards, then select the **IDE User**.
The IDE that comes with the smart contract set is a single-user application. This user can be you or another member of your organization.
![Select template](../../../static/img/smart-contract-sets/set-name.png)
5. Choose a **Deployment Plan**. Select the type, cloud provider, region, and resource pack. [More about deployment plans](/docs/launch-platform/managed-cloud-deployment/13_deployment-plans.md).
![Select template](../../../static/img/smart-contract-sets/cloud-provider.png)
6. Review the resource cost for this smart contract set displayed at the bottom of the form. Click **Confirm** to add the smart contract set.

You are now ready to use the IDE to configure the smart contract set to your needs and deploy it. You will see your deployed smart contracts in the **Details tab**.

For protocol-specific information, please refer to the relevant section in our blockchain guides:

- [Hyperledger Besu Smart Contracts IDE](/docs/blockchain-guides/1_Hyperledger-Besu/6_enterprise-ethereum-integration-tools.md)
- [Ethereum Smart Contracts IDE](/docs/blockchain-guides/0_Ethereum/5_ethereum-integration-tools.md)
- [Avalanche Smart Contracts IDE](/docs/blockchain-guides/2_Avalanche/5_avalanche-integration-tools.md)
- [Binance Smart Chain Smart Contracts IDE](/docs/blockchain-guides/3_Binance-Smart-Chain/5_binance-smart-chain-integration-tools.md)
- [Polygon Smart Contracts IDE](/docs/blockchain-guides/4_Polygon/5_polygon-integration-tools.md)
- [Hyperledger Fabric Smart Contracts IDE](/docs/blockchain-guides/5_Hyperledger-Fabric/6_hyperledger-fabric-integration-tools.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: Deploying a Smart Contract
description: Deploying a Smart Contract
sidebar_position: 3
---
# Deploying a Smart Contract with Foundry

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.

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

- **`contracts/`**: Contains the Solidity smart contracts for the project.
- **`test/`**: Houses the Solidity tests, written to verify the functionality of the smart contracts.
- The test folder can contain both Hardhat tests written in TypeScript, and Foundry tests written in Solidity.
- **`script/`**: Includes scripts for deploying or interacting with the contracts post-deployment.
- **`lib/`**: Optional directory for Solidity libraries or external dependencies.
- **`ignitions/`**: A folder containing the ignitions for Hardhat deployment.
- **`out/`**: Generated directory where compilation artifacts (like ABI and binary) are stored.
- **`foundry.toml`**: Configuration file for Foundry, where you can set global settings and parameters.
- **`hardhat.config`**: Hardhat configuration file.
- **`subgraphs`**: Contains the indexing logic for your subgraphs, specific to your smart contract.

## Deploy with Task Manager

Follow these steps to deploy a contract using the Task Manager:

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

2. Navigate to the `Task Manager`.
![Task Manager](../../../static/img/deploy-scs/nav-task-mg.png)

3. Click `Foundry - Build` or `Hardhat - Build` to compile the Smart Contract.
![Press Build](../../../static/img/deploy-scs/task-mg-build.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)

Great job! Your contract has been successfully deployed.

## Deploy with the Terminal

Follow these steps to deploy a contract using the terminal:

1. Open the terminal.
![Open Terminal](../../../static/img/deploy-scs/open-terminal.png)

2. Run the command `forge build` or `Hardhat compile` to compile the smart contracts.
![Build Terminal](../../../static/img/deploy-scs/terminal-build.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)

Well done! You've successfully deployed your contract.
4 changes: 4 additions & 0 deletions docs/using-platform/6_add_smart_contract_sets/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Smart Contract Sets",
"position": 3
}
33 changes: 0 additions & 33 deletions docs/using-platform/6_create-smart-contract-set.md

This file was deleted.

Binary file added static/img/deploy-scs/full-screen-mode.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/nav-task-mg.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/open-terminal.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-mg-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 added static/img/deploy-scs/task-mg-deploy.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/terminal-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 added static/img/deploy-scs/terminal-deploy.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/smart-contract-sets/add-set.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/smart-contract-sets/all-templates.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.
Binary file added static/img/smart-contract-sets/select-node.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/smart-contract-sets/set-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.