@@ -255,7 +255,7 @@ func toGoType(index int, t Type, output []byte) (interface{}, error) {
255255
256256// lengthPrefixPointsTo interprets a 32 byte slice as an offset and then determines which indices to look to decode the type.
257257func lengthPrefixPointsTo (index int , output []byte ) (start int , length int , err error ) {
258- bigOffsetEnd := big .NewInt ( 0 ).SetBytes (output [index : index + 32 ])
258+ bigOffsetEnd := new ( big.Int ).SetBytes (output [index : index + 32 ])
259259 bigOffsetEnd .Add (bigOffsetEnd , common .Big32 )
260260 outputLength := big .NewInt (int64 (len (output )))
261261
@@ -268,11 +268,9 @@ func lengthPrefixPointsTo(index int, output []byte) (start int, length int, err
268268 }
269269
270270 offsetEnd := int (bigOffsetEnd .Uint64 ())
271- lengthBig := big .NewInt ( 0 ).SetBytes (output [offsetEnd - 32 : offsetEnd ])
271+ lengthBig := new ( big.Int ).SetBytes (output [offsetEnd - 32 : offsetEnd ])
272272
273- totalSize := big .NewInt (0 )
274- totalSize .Add (totalSize , bigOffsetEnd )
275- totalSize .Add (totalSize , lengthBig )
273+ totalSize := new (big.Int ).Add (bigOffsetEnd , lengthBig )
276274 if totalSize .BitLen () > 63 {
277275 return 0 , 0 , fmt .Errorf ("abi: length larger than int64: %v" , totalSize )
278276 }
@@ -287,7 +285,7 @@ func lengthPrefixPointsTo(index int, output []byte) (start int, length int, err
287285
288286// tuplePointsTo resolves the location reference for dynamic tuple.
289287func tuplePointsTo (index int , output []byte ) (start int , err error ) {
290- offset := big .NewInt ( 0 ).SetBytes (output [index : index + 32 ])
288+ offset := new ( big.Int ).SetBytes (output [index : index + 32 ])
291289 outputLen := big .NewInt (int64 (len (output )))
292290
293291 if offset .Cmp (outputLen ) > 0 {
0 commit comments