v2 Contract SDK
  • Orbs Contract SDK
  • Getting Started
    • About smart contracts
    • Becoming a Go developer
    • Installing Gamma - local blockchain
    • Deploying your first contract
    • The Orbs Starter Kit
    • Downloading the Contract SDK
  • Orbs Contracts
    • Smart contracts
    • Layout of a contract file
    • Data types (Exported Functions)
    • State
    • Address
    • Events
    • Error handling
    • Calling other contracts
    • Calling Ethereum contract
    • API Reference
    • Limitations of Orbs Contracts
    • Creating a new contract
  • Gamma in Depth
    • Starting and stopping the server
    • Test keys and accounts
    • Deploying smart contracts
    • Sending transactions and queries
    • Checking sent transaction status
    • Reading Logs from Contracts
    • Working with multiple environments
    • Upgrading to latest versions
    • Gamma server under the hood
    • Deploying Gamma in the Cloud
      • Amazon Web Services
      • Google Cloud Platform
      • Azure
Powered by GitBook
On this page
  1. Orbs Contracts

Calling other contracts

Orbs contracts can call other orbs contracts as part of the execution logic. We call this action a service call.

To call other contracts from your contrat, you must to import the service library:

import (
    "github.com/orbs-network/orbs-contract-sdk/go/sdk/v1/service"
)

The service library exposes a single function called CallMethod. CallMethod is used to call the external contract, which must be deployed on the same virtual chain of the Orbs blockchain.

CallMethod(serviceName string, methodName string, args ...interface{}) []interface{}

This function received the following arguments:

  • serviceName - The contract name

  • methodName - The method to call in that contract

  • args - The variadic parameter for the method arguments

The return value contains the array of the result of the function execution.

PreviousError handlingNextCalling Ethereum contract

Last updated 5 years ago