Skip to main content
This guide walks you through deploying smart contracts using Oumla’s contract template system.
Two Ways to Use Oumla: This guide uses the TypeScript SDK. You can also accomplish the same tasks using direct REST API calls - see the API Reference for endpoint details.

Overview

The contract deployment workflow involves:
  1. Create or Select Template - Use an existing template or create a new one
  2. Get Constructor Info - Understand required constructor parameters
  3. Deploy Contract - Deploy with your parameters
  4. Check Status - Monitor the async deployment workflow
  5. Interact with Contract - Call functions on the deployed contract
Contract deployment uses async workflows for async processing. You’ll need to check workflow status to know when deployment completes.

Prerequisites

Before starting, ensure you have:
  • An initialized SDK client
  • A profile created
  • An address generated (for contract deployment)
  • Your client share (for signing operations)

Step 1: Get Available Templates

List available contract templates:

Step 2: Get Template Details

Retrieve details for a specific template:

Step 3: Get Constructor Information

Before deploying, understand what constructor parameters are required:

Understanding Constructor Parameters

Constructor parameters are sent as an array of objects, where each object contains name, type, and value:
The getContractConstructorById() method returns the constructor parameter definitions. Use those to build your constructorParameters array with the correct name, type, and value for each parameter.

Step 4: Get Function Information

Understand available functions on the contract:

Step 5: Deploy Contract

Deploy the contract with your parameters:
Ensure constructor parameters match the types and order defined in the constructor info. Incorrect parameters will cause deployment to fail.

Step 6: Check Deployment Status

Deployment is async. Check workflow status:

Workflow Status Values

  • RUNNING: Deployment in progress
  • COMPLETED: Deployment successful
  • FAILED: Deployment failed (check error details)
  • CANCELLED: Deployment was cancelled

Step 7: Get Deployed Contract Details

Once deployment completes, retrieve contract details:

Step 8: Interact with Contract

After deployment, you can interact with the contract:

Read Functions

Write Functions

Complete Example

Here’s a complete example:

Managing Contract ABIs

Fetch ABI from Contract Address

Add Custom ABI

Common Issues

Deployment Fails

Causes:
  • Invalid constructor parameters
  • Insufficient gas balance
  • Network connectivity issues
Solutions:
  • Verify constructor parameters match template requirements
  • Ensure address has sufficient balance for gas
  • Check network status and retry

Constructor Parameter Errors

Causes:
  • Wrong parameter types
  • Missing required parameters
  • Parameter order mismatch
Solutions:
  • Review constructor info carefully
  • Ensure types match (string, uint256, address, etc.)
  • Provide all required parameters

Function Call Fails

Causes:
  • Function doesn’t exist
  • Wrong parameter types
  • Insufficient gas
Solutions:
  • Verify function exists in contract ABI
  • Check parameter types match function signature
  • Ensure sufficient gas balance

Best Practices

  1. Always check constructor info before deploying
  2. Validate parameters before deployment
  3. Monitor workflow status until completion
  4. Store deployment IDs for future reference
  5. Handle errors gracefully - deployments can fail
  6. Test on testnet before mainnet deployment
  7. Verify contract address after deployment

Next Steps