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

Description

Updates the metadata and description of an existing smart contract implementation. This allows platform administrators to modify the description and metadata template JSON without changing the underlying Solidity source code or contract structure. The implementation’s source code, type, and contract class name remain unchanged.

Input

Expects a JSON request body containing:
  • id (long, required) - Unique identifier of the smart contract implementation to update.
  • description (string, required) - Updated human-readable description of the contract purpose.
  • metadataTemplateJson (string, optional) - Updated JSON template for contract metadata configuration.

Output

Returns a SmartContractImplementationReportModel containing:
  • id (long) - Unique identifier of the updated implementation.
  • type (string) - Classification type (unchanged from original).
  • description (string) - The updated description.
  • contractClassName (string) - Main contract class name (unchanged from original).
  • sourceCode (string) - Complete Solidity source code (unchanged from original).
  • createdDate (DateTime) - Original timestamp of implementation creation.

Examples

Request
{
  "id": 1,
  "description": "Updated factory contract for creating token issuers with enhanced ownership controls",
  "metadataTemplateJson": "{\"version\": \"2.0\", \"features\": [\"ownership\", \"factory\", \"upgradeable\"]}"
}
Response (200 OK)
{
  "data": {
    "id": 1,
    "type": "IssuerFactoryImplementation",
    "description": "Updated factory contract for creating token issuers with enhanced 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-01-15T10:30:00Z"
  }
}

Errors

  • 400 Bad Request: Missing required fields, invalid implementation ID, or malformed metadata JSON.
  • 401 Unauthorized: Missing or invalid authentication token.
  • 403 Forbidden: User lacks platform administrator privileges.
  • 404 Not Found: Smart contract implementation with specified ID does not exist.
  • 500 Internal Server Error: Unexpected system error occurred during update.

Notes

Requires platform administrator privileges. Only the description and metadata template can be updated. The Solidity source code, contract type, and contract class name are immutable. Changes to the implementation do not affect previously deployed contracts on blockchain networks. The metadata template JSON is validated for proper JSON syntax.

Query Parameters

api-version
string | null

Body

application/json

Smart contract implementation update details including ID, description, and metadata template.

Base class for all API request models.

id
integer<int64>
description
string
metadataTemplateJson
string

Response

Smart contract implementation updated 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"
}