Decoding Responses
Decoding request responses
Results of an oracle request are returned by calling dest_method
method of the smart contract specified in dest_id
. The method gets passed the following two arguments:
type: uint32
- response type; currently is always1
.body: byte[]
- encoded body of the response (details below).
The body
argument contains an ABI-encoded tuple of the following structure:
byte[]
- request ID. Currently the same as Algorand transaction ID of therequest
smart contract call that initiated the request.address
- address of the account making the requestbyte[]
- The value of the data requested by the caller, more details below.byte[]
- data specified inuserData
field of the requestuint32
- error code if a request handling error occured in GoraNetwork software,0
otherwise. Currently there is a single error code of1
, meaning that node runners could not correctly decode the request spec.uint64
- bit field with bits corresponding to the request sources; if n'th bit is set, the n'th source has failed to yield a valid value.
Numeric oracle return values
When returned oracle value is a number, it is encoded into a 17-byte array. 0
's byte encodes value type:
0
- empty value (not-a-number, NaN)1
- positive number2
- negative number
Bytes 1 - 8
contain the integer part, 9 - 17
- the decimal fraction part, as big endian uint64's.
For example, 0x021000000000000000ff00000000000000
in memory order (first byte has 0 offset) decodes as -16.255
Last updated