gidon
February 28, 2021, 4:08pm
1
When I run the goal app read
command I get back a list of state variables, each containing fields such as tt
, ui
and tb
. Is there anywhere that lists what each of these mean?
fabrice
February 28, 2021, 4:25pm
2
if the variable is a []byte
, then tt
is set to 1, and tb
contains the value
if the variable is an uint
, then tt
is set to 2, and ui
contains the value
You indeed need to dig in the code to find this information:
case TealBytesType:
return "b"
case TealUintType:
return "u"
}
return "?"
}
// TealValue contains type information and a value, representing a value in a
// TEAL program
type TealValue struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`
Type TealType `codec:"tt"`
Bytes string `codec:"tb"`
Uint uint64 `codec:"ui"`
}
// ToValueDelta creates ValueDelta from TealValue
func (tv *TealValue) ToValueDelta() (vd ValueDelta) {
if tv.Type == TealUintType {
and the TEAL type:
min = AddSaturate(min, uintCost)
min = AddSaturate(min, bytesCost)
res.Raw = min
return res
}
// TealType is an enum of the types in a TEAL program: Bytes and Uint
type TealType uint64
const (
// TealBytesType represents the type of a byte slice in a TEAL program
TealBytesType TealType = 1
// TealUintType represents the type of a uint in a TEAL program
TealUintType TealType = 2
)
func (tt TealType) String() string {
switch tt {
case TealBytesType:
2 Likes