Building with SettleMint/EVM Chains Guide

Setup code studio

Guide to setup code studio IDE to develop and deploy smart contracts and sub-graphs

Summary

To start developing and deploying smart contracts on the SettleMint platform, you'll first need to add code studio to your application. This provides you with a full-featured web-based IDE, pre-configured for blockchain development using tools like Hardhat, Foundry, and The Graph. Once added, you can use built-in tasks to build, test, deploy, and index your smart contracts and subgraphs, all within the same environment.


You can add code studio through the platform UI by selecting it as a dev tool and linking it with a smart contract set and a template. Alternatively, you can use the SDK CLI or SDK JS to programmatically create and manage smart contract sets. These interfaces give you flexibility depending on whether you're working from the console or integrating via scripts or automation.


After setup, you'll be able to customize your smart contracts directly within the IDE. A task manager will guide you through building and deploying them to local or SettleMint-hosted blockchain networks. You can also integrate subgraphs for indexing and querying contract data using The Graph.


To speed up development, SettleMint offers a rich library of open-source smart contract templates, from ERC standards to more complex business use cases. These templates can be modified, extended, or used as-is, and you also have the option to create and manage custom templates within your consortium for reuse across projects.


How to setup code studio and deploy smart contracts on SettleMint platform

Code studio is SettleMint's fully integrated, web-based IDE built specifically for blockchain development. It provides developers with a familiar Visual Studio Code experience directly in the browser, pre-configured with essential tools like Hardhat, Foundry, and The Graph. Code studio enables seamless development, testing, deployment, and indexing of smart contracts and subgraphs, all within a unified environment.

It eliminates the need for complex local setups, simplifies DevOps workflows, and reduces time-to-market by combining infrastructure, templates, and automation under one interface. By offering pre-built tasks, contract templates, and GitHub integration, it solves the traditional challenges of fragmented tooling, inconsistent environments, and steep setup requirements for web3 development.

Add Code Studio

Despite offering full configurability, code studio includes all essential dependencies pre-installed, saving time and avoiding setup friction. It supports extensions for formatting, linting, testing, and AI-assisted development, mirroring the convenience of a local VS Code setup. Every component, from contracts to testing and subgraph development is wired into a well-structured, maintainable codebase that is continuously updated and thoroughly tested to align with the latest development standards. This makes it ideal for both rapid prototyping and production-grade blockchain applications.

Code Studio Web IDE

Smart contract sets allow you to incorporate business logic into your application by deploying smart contracts that run on the blockchain. You can add a smart contract set via different methods as part of your development workflow.

IDE project structure

The EVM IDE project structure in code studio is thoughtfully organized to support efficient smart contract development, testing, and deployment. Each folder serves a specific purpose in the dApp development lifecycle, aligning with industry-standard tools like Hardhat, Foundry, and The Graph.

FolderDescription
contracts/Contains Solidity smart contracts that define the core logic and business rules of the dApp.
test/Holds test files. These can be written in TypeScript for Hardhat or Solidity for Foundry.
script/Stores deployment and interaction scripts, often used to automate tasks like contract deployment.
lib/Optional directory for external Solidity libraries or reusable modules to avoid code repetition.
ignitions/Contains Hardhat Ignition configuration for defining declarative deployment plans.
out/Output folder used by Foundry, containing compiled contract artifacts like ABIs and bytecode.
artifacts/Output folder used by Hardhat, similar to out/, containing build artifacts and metadata.
subgraphs/Contains files for The Graph integration, schema, mappings, and manifest for data indexing.
cache/Caching directory for Hardhat to improve build performance by avoiding redundant compilation.
cache_forge/Caching directory for Foundry to speed up compilation and reuse outputs.
node_modules/Contains installed npm packages and dependencies used in Hardhat or other JS-based tools.

Code studio task manager

The code studio IDE task manager acts as a centralized hub for running all essential development scripts, giving developers a streamlined way to manage the entire smart contract lifecycle. It also includes integrated SettleMint CLI tasks for logging in and managing authenticated platform interactions, ensuring that everything needed for blockchain development is accessible and executable directly from within the IDE.

Below is a categorized table of tasks or scripts available with concise explanations.

TaskToolDescription
SettleMint - LoginSettleMint CLILogs into the SettleMint platform via CLI for authenticated deployments.
Foundry - BuildFoundryCompiles the smart contracts using Foundry.
Hardhat - BuildHardhatCompiles the smart contracts using Hardhat.
Foundry - TestFoundryRuns tests using Foundry's native testing framework.
Hardhat - TestHardhatExecutes tests using Hardhat's JavaScript-based test suite.
Foundry - FormatFoundryFormats smart contract code for readability (optional).
Foundry - Start networkFoundryStarts a local Foundry testnet environment.
Hardhat - Start networkHardhatStarts a local Hardhat network for JS-based testing.
Hardhat - Deploy to local networkHardhatDeploys compiled contracts to the local Hardhat network.
Hardhat - Reset & Deploy to local networkHardhatResets the local chain state and redeploys contracts.
Hardhat - Deploy to platform networkHardhatDeploys contracts to a blockchain network hosted on SettleMint.
Hardhat - Reset & Deploy to platform networkHardhatResets the platform network state and redeploys contracts.
The Graph - Codegen the subgraph typesThe Graph CLIGenerates TypeScript types based on subgraph GraphQL schema.
The Graph - Build the subgraphThe Graph CLICompiles the subgraph for deployment to The Graph.
The Graph - Deploy or update the subgraphThe Graph CLIDeploys or updates the subgraph on The Graph's hosted service.

When using Hardhat Ignition for deploying smart contracts, the deployed contract addresses are stored in the file ignition/deployments/chain-CHAIN_ID/deployed_addresses.json. This file serves as a reliable reference for all contracts deployed on a specific network. It maps contract names to their respective blockchain addresses, making it easy to retrieve addresses later for interactions, frontend integrations, or upgrades.

You must have an existing application before you add a smart contract set.

How to add code studio

First, ensure you are authenticated:

settlemint login

You can create a smart contract set either on the platform or locally:

Create on platform

Then create a smart contract set with the following command (refer to the CLI docs for more details):

settlemint platform create smart-contract-set <tool-name> \
  --application <application-name> \
  --template <template-name> \
  --deployment-plan <deployment-plan>

For example:

settlemint platform create smart-contract-set my-scset \
  --application my-app \
  --template default \
  --deployment-plan starter

Working with smart contract sets locally

You can also work with smart contract sets in your local development environment. This is useful for development and testing before deploying to the platform.

To create a smart contract set locally:

# Create a new smart contract set
settlemint scs create
 
# You'll see the SettleMint ASCII art and then be prompted:
 What is the name of your new SettleMint project? my awesome project
 
# Choose from available templates:
 ERC20 token
  Empty typescript
  Empty typescript with PDC
  ERC1155 token
  ERC20 token with crowdsale mechanism
  ERC20 token with MetaTx
  ERC721
  # ... and more

Once created, you can use these commands to work with your local smart contract set:

settlemint scs -h  # Show all available commands
 
# Main commands:
settlemint scs create        # Create a new smart contract set
settlemint scs foundry      # Foundry commands for building and testing
settlemint scs hardhat      # Hardhat commands for building, testing and deploying
settlemint scs subgraph    # Commands for managing TheGraph subgraphs

The scaffolded project includes everything you need to start developing smart contracts:

  • Contract templates
  • Testing framework
  • Deployment scripts
  • Development tools configuration

Managing platform smart contract sets

Manage your platform smart contract sets with:

# List smart contract sets
settlemint platform list smart-contract-sets --application <application-name>
 
# Read smart contract set details
settlemint platform read smart-contract-set <smart-contract-set-name>
 
# Delete a smart contract set
settlemint platform delete smart-contract-set <smart-contract-set-name>

All operations require that you have the necessary permissions in your workspace.

Customize smart contracts

You can customize your smart contracts using the built-in IDE. The smart contract sets include a generative AI plugin to assist with development. Learn more about the AI plugin here.

Smart contract template library

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.

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.

Smart contract template library

The programming language used depends on the target protocol:

  • Solidity for EVM-compatible networks
TemplateDescription
EmptyBasic Solidity project scaffold with no predefined logic. Ideal for starting from scratch.
ERC20 tokenStandard ERC20 token implementation for fungible tokens.
ERC1155 tokenMulti-token standard supporting both fungible and non-fungible tokens in a single contract.
ERC20 token with MetaTxERC20 token with meta-transaction support to enable gasless transfers.
SupplychainToken-based supply chain logic for tracking assets and ownership across stages.
State MachineContract template for building stateful workflows and processes using a finite state machine.
ERC20 token with crowdsale mechanismERC20 token with built-in crowdsale logic for fundraising campaigns.
ERC721Standard implementation of ERC721 non-fungible tokens (NFTs).
ERC721aGas-optimized ERC721 implementation for efficient batch minting.
ERC721 Generative ArtNFT template for generating on-chain artwork using ERC721 standard.
Soulbound TokenNon-transferable token (SBT) representing identity or credentials.
Diamond bondExample of a tokenized bond using modular smart contracts (Diamond pattern).
Attestation ServiceService template for managing on-chain verifiable claims and attestations.

Create your own smart contract templates for your consortium

Within the self-managed SettleMint Platform, 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


Congratulations.!!

You have succesfully deployed the code studio. From here you can proceed for development and deployment of smart contracts and indexing sub-graphs.