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
  • The 'Scalar' types:
  • The 'Slice' types:
  1. Orbs Contracts

Data types (Exported Functions)

Data types refer to arguments in public functions and their return values. All non exported functions can use any Go type (notice that only white-listed package will compile). There are currently 16 types that are supported: 8 basic types (called here 'scalar') and their 8 slice versions. Please note: alias or named types of these should not be used.

You may use any arithmetic, calculation, operand or function that is allowed or exists in Go.

The 'Scalar' types:

1) uint32 - a 32 bit unsigned integer

2) uint64 - a 64 bit unsigned integer.

3) string - a string .

4) []byte - a blob of data in slice of bytes. Can represent address and hashes too.

5) bool - a bit of data.

6) *big.Int - Go type that is used for very large integers up to 256 bit (referred sometimes as uint256)

7) [20]byte - a fixed size array of 20 bytes. This is very useful to represent addresses in cryptography.

8) [32]byte - a fixed size array of 32 bytes. This is very useful for signatures and hashes in cryptography.

It is possible to run any arithmetic operation which exists in Go.

The 'Slice' types:

1) []uint32 - a slice of 32 bit unsigned integers

2) []uint64 - a slice of 64 bit unsigned integers

3) []string - a slice of strings

4) [][]byte - a slice of blobs of data.

5) []bool - a slice of bits of data.

6) []*big.Int - a slice of very large integers.

7) [][20]byte - a slice of arrays of 20 bytes.

8) [][32]byte - a slice of arrays of 32 bytes.

PreviousLayout of a contract fileNextState

Last updated 5 years ago