Skip to content

Commit 5ca9d6f

Browse files
feat: scs extended (#32)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added documentation for deploying smart contracts using SettleMint's template library and IDE. - Introduced information about smart contract templates for faster development and market entry. - Provided a guide on adding a Smart Contract Set to an application. - Guidance on deploying smart contracts in SettleMint using the Task Manager or terminal. - Introduced a JSON configuration for "Smart Contract Sets" with a specified label and position. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: saeeddawod <saeed.dawod@gmail.com>
1 parent 966069e commit 5ca9d6f

19 files changed

+186
-33
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Overview
3+
description: Overview
4+
sidebar_position: 0
5+
---
6+
# Deploying Smart Contracts
7+
8+
## Introduction
9+
10+
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.
11+
12+
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).
13+
14+
15+
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.
16+
17+
## Overview of the Smart Contract Deployment Process on SettleMint
18+
19+
The following is a high-level overview of smart contract development processes at SettleMint.
20+
21+
### 1. Deploying a Smart Contract Set
22+
23+
- **Add Smart Contract Set**: Navigate to the smart contract sets page and press the button "Add Smart Contract Set."
24+
- **Picking Your Template**: Pick the template of your choice.
25+
26+
### 2. Compiling and Configuring The Smart Contract
27+
28+
- **Compiling**: Convert your smart contract code into a format that the blockchain can understand and execute.
29+
- **Configuring**: SettleMint sets all the necessary configurations for you,
30+
- **Purpose**: Tailors the deployment process to your specific requirements and ensures your contract can run on the blockchain.
31+
32+
### 3. Deploying and Interacting with the Smart Contract
33+
- **Deploying**: Upload your compiled smart contract to a blockchain network.
34+
- **Interacting**: Once deployed, interact with the smart contract through transactions that call its functions.
35+
- **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.
36+
37+
## Tools to Use
38+
39+
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.
40+
41+
### Foundry
42+
43+
Foundry is a toolkit for EVM development. It provides tools to compile, test, and deploy smart contracts.
44+
45+
1. **Initialize Project**: Set up your project folder and deploy a Foundry smart contract set.
46+
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.
47+
3. **Compile and Deploy Contract**: Convert your Solidity code into bytecode and deploy your compiled contract to the blockchain network of your choice.
48+
49+
### Hardhat
50+
51+
Hardhat is a development environment for EVM software. It provides a flexible and extensible ecosystem for building, testing, and deploying smart contracts.
52+
53+
1. **Initialize Project**: Set up your project folder and deploy a Hardhat smart contract set.
54+
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.
55+
3. **Compile and Deploy Contract**: Convert your Solidity code into bytecode and deploy your compiled contract to the blockchain network of your choice.
56+
57+
## Key Points
58+
- **Smart Contracts**: Self-executing programs with predefined rules.
59+
- **Compiling and Configuring**: Converts code into a format the blockchain can run and tailors the deployment process.
60+
- **Deploying and Interacting**: Uploads the compiled code to the blockchain and makes it accessible for interaction.
61+
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.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Templates
3+
description: Rapid Deployment with Smart Contract Templates
4+
sidebar_position: 1
5+
---
6+
7+
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.
8+
9+
<div class="centered-image">
10+
![Example banner](../../../static/img/smart-contract-sets/all-templates.png)
11+
</div>
12+
13+
### Open-Source Smart Contract Templates under the MIT License
14+
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.
15+
16+
### Create Your Own Smart Contract Templates for Your Consortium
17+
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.
18+
19+
To get started, visit: [SettleMint GitHub Repository](https://github.com/settlemint/solidity-empty)
20+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Add a Smart Contract Set
3+
description: Add a Smart Contract Set
4+
sidebar_position: 1
5+
---
6+
# Add a Smart Contract Set
7+
8+
By using smart contract sets, you can add **business logic** to your application.
9+
10+
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.
11+
12+
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.
13+
14+
## How to Add a Smart Contract Set
15+
16+
Navigate to the **application** where you want to add the smart contract set. Ensure you have a network with a node in place.
17+
18+
Click **Smart Contract Sets** in the left navigation, and then click **Add a Smart Contract Set**. This opens a form.
19+
20+
Follow these steps to add the smart contract set:
21+
22+
1. Navigate to **Smart Contract Sets** and press **Add a Smart Contract Set**.
23+
![Smart contract sets](../../../static/img/smart-contract-sets/add-set.png)
24+
2. Select which of your **blockchain nodes** the smart contract set needs to be deployed to, and click **Continue**.
25+
![Select node](../../../static/img/smart-contract-sets/select-node.png)
26+
3. Choose a **template**. The IDE instance will contain a set of pre-built smart contract templates for your selected use case.
27+
![Select template](../../../static/img/smart-contract-sets/select-a-template.png)
28+
4. Choose a **Smart Contract Set Name** that will be easily recognizable in your dashboards, then select the **IDE User**.
29+
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.
30+
![Select template](../../../static/img/smart-contract-sets/set-name.png)
31+
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).
32+
![Select template](../../../static/img/smart-contract-sets/cloud-provider.png)
33+
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.
34+
35+
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**.
36+
37+
For protocol-specific information, please refer to the relevant section in our blockchain guides:
38+
39+
- [Hyperledger Besu Smart Contracts IDE](/docs/blockchain-guides/1_Hyperledger-Besu/6_enterprise-ethereum-integration-tools.md)
40+
- [Ethereum Smart Contracts IDE](/docs/blockchain-guides/0_Ethereum/5_ethereum-integration-tools.md)
41+
- [Avalanche Smart Contracts IDE](/docs/blockchain-guides/2_Avalanche/5_avalanche-integration-tools.md)
42+
- [Binance Smart Chain Smart Contracts IDE](/docs/blockchain-guides/3_Binance-Smart-Chain/5_binance-smart-chain-integration-tools.md)
43+
- [Polygon Smart Contracts IDE](/docs/blockchain-guides/4_Polygon/5_polygon-integration-tools.md)
44+
- [Hyperledger Fabric Smart Contracts IDE](/docs/blockchain-guides/5_Hyperledger-Fabric/6_hyperledger-fabric-integration-tools.md)
45+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Deploying a Smart Contract
3+
description: Deploying a Smart Contract
4+
sidebar_position: 3
5+
---
6+
# Deploying a Smart Contract with Foundry
7+
8+
Deploying a smart contract in SettleMint won't be much different from doing so in your own environment.
9+
10+
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.
11+
12+
The typical folder structure of SettleMint's smart contract set will include:
13+
14+
- **`contracts/`**: Contains the Solidity smart contracts for the project.
15+
- **`test/`**: Houses the Solidity tests, written to verify the functionality of the smart contracts.
16+
- The test folder can contain both Hardhat tests written in TypeScript, and Foundry tests written in Solidity.
17+
- **`script/`**: Includes scripts for deploying or interacting with the contracts post-deployment.
18+
- **`lib/`**: Optional directory for Solidity libraries or external dependencies.
19+
- **`ignitions/`**: A folder containing the ignitions for Hardhat deployment.
20+
- **`out/`**: Generated directory where compilation artifacts (like ABI and binary) are stored.
21+
- **`foundry.toml`**: Configuration file for Foundry, where you can set global settings and parameters.
22+
- **`hardhat.config`**: Hardhat configuration file.
23+
- **`subgraphs`**: Contains the indexing logic for your subgraphs, specific to your smart contract.
24+
25+
## Deploy with Task Manager
26+
27+
Follow these steps to deploy a contract using the Task Manager:
28+
29+
1. Click `View in Fullscreen Mode` for a better user experience :)
30+
![Fresh IDE](../../../static/img/deploy-scs/full-screen-mode.png)
31+
32+
2. Navigate to the `Task Manager`.
33+
![Task Manager](../../../static/img/deploy-scs/nav-task-mg.png)
34+
35+
3. Click `Foundry - Build` or `Hardhat - Build` to compile the Smart Contract.
36+
![Press Build](../../../static/img/deploy-scs/task-mg-build.png)
37+
38+
4. Then run `Hardhat - Deploy to local network` to deploy locally or `Hardhat - Deploy to platform network` to deploy to your connected network.
39+
![Press Deploy](../../../static/img/deploy-scs/task-mg-deploy.png)
40+
41+
Great job! Your contract has been successfully deployed.
42+
43+
## Deploy with the Terminal
44+
45+
Follow these steps to deploy a contract using the terminal:
46+
47+
1. Open the terminal.
48+
![Open Terminal](../../../static/img/deploy-scs/open-terminal.png)
49+
50+
2. Run the command `forge build` or `Hardhat compile` to compile the smart contracts.
51+
![Build Terminal](../../../static/img/deploy-scs/terminal-build.png)
52+
53+
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.
54+
![Deploy Terminal](../../../static/img/deploy-scs/terminal-deploy.png)
55+
56+
Well done! You've successfully deployed your contract.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Smart Contract Sets",
3+
"position": 3
4+
}

docs/using-platform/6_create-smart-contract-set.md

Lines changed: 0 additions & 33 deletions
This file was deleted.
653 KB
Loading
706 KB
Loading
764 KB
Loading
533 KB
Loading

0 commit comments

Comments
 (0)