package main
import
area of your code can only comprise of Golang standard libraries or Orbs Contract SDK imports.sdk.Export()
function, which accepts pointer to a function (i.e. the function name).EVENTS
variable.PUBLIC
export is used to define which functions should be exported and be accessible by the distributed app client. For example:transfer
and getBalance
.EVENTS
export is used to declare which events are exported by the contract, for example:Approval
_init
, it must exist at any contract when the special constructor function exists. This export usually looks like:{}
must be explicitly written at the end of the line.getBalance
which accepts a byte array to a variable named targetAddress
. The logic then validates the address and reads from the state whatever data that was stored there, which should be a unsigned number of up to 64bit in size using state.ReadUint64(targetAddress)
. Since the logic only reads data off the blockchain, it is possible to run this function using run-query
API, but the contract must export the function as described above.