@@ -397,9 +397,9 @@ extension ABI.Element.Function {
397
397
/// 4) `messageLength` is used to determine where message bytes end to decode string correctly.
398
398
/// 5) The rest of the `data` must be 0 bytes or empty.
399
399
if data. bytes. count >= 100 ,
400
- Data ( data [ data. indices . startIndex ..< data. indices . startIndex + 4 ] ) == Data . fromHex ( " 08C379A0 " ) ,
401
- BigInt ( data [ data. indices . startIndex + 4 ..< data. indices . startIndex + 36 ] ) == 32 ,
402
- let messageLength = Int ( Data ( data [ data. indices . startIndex + 36 ..< data. indices . startIndex + 68 ] ) . toHexString ( ) , radix: 16 ) ,
400
+ Data ( data [ data. startIndex ..< data. startIndex + 4 ] ) == Data . fromHex ( " 08C379A0 " ) ,
401
+ BigInt ( data [ data. startIndex + 4 ..< data. startIndex + 36 ] ) == 32 ,
402
+ let messageLength = Int ( Data ( data [ data. startIndex + 36 ..< data. startIndex + 68 ] ) . toHexString ( ) , radix: 16 ) ,
403
403
let message = String ( bytes: data. bytes [ 68 ..< ( 68 + messageLength) ] , encoding: . utf8) ,
404
404
( 68 + messageLength == data. count || data. bytes [ 68 + messageLength..< data. count] . reduce ( 0 ) { $0 + $1 } == 0 ) {
405
405
return [ " _success " : false ,
@@ -410,11 +410,11 @@ extension ABI.Element.Function {
410
410
411
411
if data. count >= 4 ,
412
412
let errors = errors,
413
- let customError = errors [ data [ data. indices . startIndex ..< data. indices . startIndex + 4 ] . toHexString ( ) . stripHexPrefix ( ) ] {
413
+ let customError = errors [ data [ data. startIndex ..< data. startIndex + 4 ] . toHexString ( ) . stripHexPrefix ( ) ] {
414
414
var errorResponse : [ String : Any ] = [ " _success " : false , " _abortedByRevertOrRequire " : true , " _error " : customError. errorDeclaration]
415
415
416
416
if ( data. count > 32 && !customError. inputs. isEmpty) ,
417
- let decodedInputs = ABIDecoder . decode ( types: customError. inputs, data: Data ( data [ data. indices . startIndex + 4 ..< data. indices . startIndex + data. count] ) ) {
417
+ let decodedInputs = ABIDecoder . decode ( types: customError. inputs, data: Data ( data [ data. startIndex + 4 ..< data. startIndex + data. count] ) ) {
418
418
for idx in decodedInputs. indices {
419
419
errorResponse [ " \( idx) " ] = decodedInputs [ idx]
420
420
if !customError. inputs [ idx] . name. isEmpty {
0 commit comments