@@ -18,7 +18,6 @@ package abi
18
18
19
19
import (
20
20
"encoding/binary"
21
- "encoding/hex"
22
21
"errors"
23
22
"fmt"
24
23
"math"
@@ -415,25 +414,25 @@ func toString(index int, t Type, output []byte) (interface{}, error) {
415
414
}
416
415
return strconv .FormatBool (b ), nil
417
416
case AddressTy :
418
- return hex . EncodeToString (common .BytesToAddress (returnOutput ).Bytes ()), nil
417
+ return common . Bytes2HexWithPrefix (common .BytesToAddress (returnOutput ).Bytes ()), nil
419
418
case HashTy :
420
- return hex . EncodeToString (common .BytesToHash (returnOutput ).Bytes ()), nil
419
+ return common . Bytes2HexWithPrefix (common .BytesToHash (returnOutput ).Bytes ()), nil
421
420
case BytesTy :
422
- return hex . EncodeToString (output [begin : begin + length ]), nil
421
+ return common . Bytes2HexWithPrefix (output [begin : begin + length ]), nil
423
422
case FixedBytesTy :
424
423
var b interface {}
425
424
b , err = ReadFixedBytes (t , returnOutput )
426
425
if err != nil {
427
426
return nil , fmt .Errorf ("abi: cannot convert value as fixed bytes array: %v" , returnOutput )
428
427
}
429
- return hex . EncodeToString (b .([]byte )), nil
428
+ return common . Bytes2HexWithPrefix (b .([]byte )), nil
430
429
case FunctionTy :
431
430
var f interface {}
432
431
f , err = ReadFixedBytes (t , returnOutput )
433
432
if err != nil {
434
433
return nil , fmt .Errorf ("abi: cannot convert value as function: %v" , returnOutput )
435
434
}
436
- return hex . EncodeToString (f .([]byte )), nil
435
+ return common . Bytes2HexWithPrefix (f .([]byte )), nil
437
436
default :
438
437
return nil , fmt .Errorf ("abi: unknown type %v" , t .T )
439
438
}
0 commit comments