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:
1
import (
2
"github.com/orbs-network/orbs-contract-sdk/go/sdk/v1/service"
3
)
Copied!
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.
1
CallMethod(serviceName string, methodName string, args ...interface{}) []interface{}
Copied!
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.
Last modified 2yr ago
Copy link