Skip to main content
POST
/
platform
/
admin
/
smart_contract_implementations
Create smart contract implementation
curl --request POST \
  --url https://api.example.com/platform/admin/smart_contract_implementations \
  --header 'Content-Type: application/json' \
  --data '{}'
{
  "isSuccess": true,
  "isFailure": false,
  "error": null,
  "value": {
    "id": 42,
    "name": "Example"
  }
}

Description

Creates a new smart contract implementation that serves as a reusable template for deploying contracts across multiple blockchain networks. The implementation stores Solidity source code, metadata templates, and configuration.

Input

Expects a JSON request body containing:
  • type (string, required) - Classification type (e.g., IssuerFactoryImplementation, TokenImplementation).
  • sourceCode (string, required) - Complete Solidity source code for the contract.
  • description (string, required) - Human-readable description of contract purpose.
  • contractClassName (string, required) - Primary contract class name from the Solidity code.
  • metadataTemplateJson (string, optional) - JSON template for contract metadata configuration.

Output

Returns a SmartContractImplementationReportModel containing:
  • id (long) - Unique identifier assigned to the new implementation.
  • type (string) - The classification type provided in the request.
  • description (string) - The description provided in the request.
  • contractClassName (string) - The contract class name.
  • sourceCode (string) - The validated Solidity source code.
  • createdDate (DateTime) - Timestamp of creation.

Examples

Request
{
  "type": "IssuerFactoryImplementation",
  "sourceCode": "pragma solidity ^0.8.0;\n\ncontract IssuerFactory {\n  address public owner;\n  \n  constructor() {\n    owner = msg.sender;\n  }\n  \n  function createIssuer(string memory name) public returns (address) {\n    // Factory logic\n  }\n}",
  "description": "Factory contract for creating token issuers with ownership controls",
  "contractClassName": "IssuerFactory",
  "metadataTemplateJson": "{\"version\": \"1.0\", \"features\": [\"ownership\", \"factory\"]}"
}
Response (200 OK)
{
  "data": {
    "id": 3,
    "type": "IssuerFactoryImplementation",
    "description": "Factory contract for creating token issuers with ownership controls",
    "contractClassName": "IssuerFactory",
    "sourceCode": "pragma solidity ^0.8.0;\n\ncontract IssuerFactory {\n  address public owner;\n  \n  constructor() {\n    owner = msg.sender;\n  }\n  \n  function createIssuer(string memory name) public returns (address) {\n    // Factory logic\n  }\n}",
    "createdDate": "2024-03-10T16:45:00Z"
  }
}

Errors

  • 400 Bad Request: Missing required fields, invalid Solidity syntax, or contract class name not found in source code.
  • 401 Unauthorized: Missing or invalid authentication token.
  • 403 Forbidden: User lacks platform administrator privileges.
  • 500 Internal Server Error: Unexpected system error during validation or storage.

Notes

Requires platform administrator privileges. The Solidity source code is validated for syntax errors before storage. Once created, the implementation can be deployed to multiple blockchain networks. The contract class name must exist in the provided source code.

Query Parameters

api-version
string | null

Body

application/json

Smart contract implementation details including type, source code, and metadata.

Represents a request payload for creating a new smart contract implementation.

type
enum<string>

Type of smart contract implementation to create.

Available options:
Undefined,
AuditRegistryImplementation,
AttestationRegistryImplementation,
MetaFactoryImplementation,
IssuerFactoryImplementation,
TokenImplementation
Example:

"IssuerFactoryImplementation"

sourceCode
string

Source code of the smart contract in Solidity format.

Example:

"pragma solidity ^0.8.0; contract MyContract { }"

description
string

Description providing context about the smart contract implementation.

Example:

"Enhanced IssuerFactory with improved gas efficiency"

contractClassName
string

Name of the contract class in the source code that will be compiled and deployed.

Example:

"IssuerFactory"

metadataTemplateJson
string

JSON template for metadata that will be used when deploying the contract.

Example:
{
"name": "My Token",
"symbol": "MTK",
"decimals": 18
}

Response

Smart contract implementation created successfully.

Wrapper for API operation results containing success status, error information, and return value.

isSuccess
boolean

True if the operation completed successfully, false otherwise.

Example:

true

isFailure
boolean

True if the operation failed, false otherwise.

Example:

false

error
object

Error information returned when the operation fails.

Example:
{
"code": "ValidationError",
"message": "The request parameters failed validation.",
"info": [
"The Name field is required.",
"The Id field must be greater than 0."
]
}
value
object

The result value returned when the operation is successful.

Example:
{
"id": 1,
"type": "IssuerFactoryImplementation",
"version": 2,
"description": "Enhanced IssuerFactory with improved gas efficiency",
"contractClassName": "IssuerFactory"
}