MCPcopy Create free account
hub / github.com/DNAProject/DNA / ParseNativeParamByte

Function ParseNativeParamByte

cmd/utils/native_param.go:173–186  ·  view source on GitHub ↗
(builder *neovm.ParamsBuilder, param string)

Source from the content-addressed store, hash-verified

171}
172
173func ParseNativeParamByte(builder *neovm.ParamsBuilder, param string) error {
174 if param == "" {
175 return fmt.Errorf("invalid byte")
176 }
177 i, err := strconv.ParseInt(param, 10, 32)
178 if err != nil {
179 return fmt.Errorf("parse int error:%s", err)
180 }
181 if i > math.MaxUint8 || i < 0 {
182 return fmt.Errorf("invalid byte value")
183 }
184 builder.EmitPushInteger(new(big.Int).SetInt64(i))
185 return nil
186}
187
188func ParseNativeParamByteArray(builder *neovm.ParamsBuilder, param string) error {
189 data, err := hex.DecodeString(param)

Callers 1

ParseNativeParamsFunction · 0.85

Calls 2

ErrorfMethod · 0.80
EmitPushIntegerMethod · 0.80

Tested by

no test coverage detected