Smart Contracts

Cubewire supports deploying new smart contracts and interacting with existing contracts on supported blockchains. All contract operations follow the same security model as transactions, including policy evaluation and approval workflows.

What are Smart Contract Operations?

This section covers dedicated contract endpoints:

  • Contract Deployment — Deploy new smart contracts to the blockchain
  • Contract Read — Query contract state (view/pure functions, no gas required)

Note: For state-changing contract calls, use the Transactions API with type: CONTRACT_WRITE.

Contract Deployment

Deploy compiled smart contracts with constructor parameters to any supported blockchain network.

How to Use:

  1. Compile your smart contract and obtain the bytecode
  2. Prepare constructor parameters with proper types and values
  3. Submit deployment request with vault ID, chain ID, bytecode, and gas limit
  4. The deployment follows the standard workflow with policy evaluation and approval (if required)
  5. Poll transaction status to get the deployed contract address and transaction hash

The deployment process is asynchronous - you receive an immediate response with a workflow ID and transaction ID for tracking. See the Deploy a smart contract endpoint for complete request and response details.

Deployment Flow

Contract Read Operations

Query smart contract state without modifying the blockchain or consuming gas.

How to Use:

  1. Identify the contract address and function you want to call
  2. Provide the function name and any required parameters
  3. Submit the read request with a vault ID for context
  4. Receive immediate synchronous response with decoded results

Read operations are perfect for checking token balances, querying configuration values, or verifying contract state. The function must be a view or pure function that doesn't modify state. See the Read contract state endpoint for complete request and response details.

Common Use Cases

Token Deployment

Deploy ERC-20 or ERC-721 tokens:

  • Custom organizational tokens
  • NFT collections
  • Governance tokens

Multisig Wallets

Deploy Gnosis Safe or similar multisig contracts:

  • Treasury management
  • Shared custody arrangements

Custom Business Logic

Deploy custom contracts for:

  • Payment splitting
  • Vesting schedules
  • Escrow arrangements

Contract Queries

Read contract state for:

  • Token balances
  • Contract configuration
  • Ownership verification

Best Practices

Deployment

PracticeDescription
Test on testnets firstDeploy to Sepolia/Mumbai before mainnet
Verify bytecodeEnsure bytecode matches audited source
Document deploymentsTrack contract addresses and purposes

Security

PracticeDescription
Audit contractsProfessional audit before deployment
Use established patternsOpenZeppelin, etc.
Verify on block explorerVerify source code after deployment

Contract Interaction

PracticeDescription
Provide ABIInclude ABI for proper result decoding
Validate addressesVerify contract exists before calling
Handle errorsContract calls may revert
  • Transactions — Contract write operations via transactions
  • Networks — Supported blockchain networks

API Reference

For complete API documentation including endpoints, request/response examples, and code samples: