@@ -146,13 +146,13 @@ func decodeDataAsERC20(decodedData []byte) (CanonicalToken, *big.Int, error) {
146
146
chunks := splitByteArray (decodedData , 32 )
147
147
148
148
if len (chunks ) < 4 {
149
- return token , big .NewInt (0 ), fmt . Errorf ("data too short" )
149
+ return token , big .NewInt (0 ), errors . New ("data too short" )
150
150
}
151
151
152
152
offset , ok := new (big.Int ).SetString (common .Bytes2Hex ((chunks [canonicalTokenDataStartingindex ])), 16 )
153
153
154
154
if ! ok {
155
- return token , big .NewInt (0 ), fmt . Errorf ("data for BigInt is invalid" )
155
+ return token , big .NewInt (0 ), errors . New ("data for BigInt is invalid" )
156
156
}
157
157
158
158
canonicalTokenData := decodedData [offset .Int64 ()+ canonicalTokenDataStartingindex * 32 :]
@@ -172,7 +172,7 @@ func decodeDataAsERC20(decodedData []byte) (CanonicalToken, *big.Int, error) {
172
172
173
173
amount , ok := new (big.Int ).SetString (common .Bytes2Hex ((chunks [canonicalTokenDataStartingindex + 3 ])), 16 )
174
174
if ! ok {
175
- return token , big .NewInt (0 ), fmt . Errorf ("data for BigInt is invalid" )
175
+ return token , big .NewInt (0 ), errors . New ("data for BigInt is invalid" )
176
176
}
177
177
178
178
return token , amount , nil
@@ -187,7 +187,7 @@ func decodeDataAsNFT(decodedData []byte) (EventType, CanonicalToken, *big.Int, e
187
187
offset , ok := new (big.Int ).SetString (common .Bytes2Hex ((chunks [canonicalTokenDataStartingindex ])), 16 )
188
188
189
189
if ! ok || offset .Int64 ()% 32 != 0 {
190
- return EventTypeSendETH , token , big .NewInt (0 ), fmt . Errorf ("data for BigInt is invalid" )
190
+ return EventTypeSendETH , token , big .NewInt (0 ), errors . New ("data for BigInt is invalid" )
191
191
}
192
192
193
193
canonicalTokenData := decodedData [offset .Int64 ()+ canonicalTokenDataStartingindex * 32 :]
@@ -211,14 +211,14 @@ func decodeDataAsNFT(decodedData []byte) (EventType, CanonicalToken, *big.Int, e
211
211
} else if offset .Int64 () == 160 {
212
212
offset , ok := new (big.Int ).SetString (common .Bytes2Hex ((chunks [canonicalTokenDataStartingindex + 4 ])), 16 )
213
213
if ! ok || offset .Int64 ()% 32 != 0 {
214
- return EventTypeSendETH , token , big .NewInt (0 ), fmt . Errorf ("data for BigInt is invalid" )
214
+ return EventTypeSendETH , token , big .NewInt (0 ), errors . New ("data for BigInt is invalid" )
215
215
}
216
216
217
217
indexOffset := canonicalTokenDataStartingindex + int64 (offset .Int64 ()/ 32 )
218
218
219
219
length , ok := new (big.Int ).SetString (common .Bytes2Hex ((chunks [indexOffset ])), 16 )
220
220
if ! ok {
221
- return EventTypeSendETH , token , big .NewInt (0 ), fmt . Errorf ("data for BigInt is invalid" )
221
+ return EventTypeSendETH , token , big .NewInt (0 ), errors . New ("data for BigInt is invalid" )
222
222
}
223
223
224
224
amount := big .NewInt (0 )
@@ -364,7 +364,7 @@ func DecodeRevertReason(hexStr string) (string, error) {
364
364
365
365
// Ensure the data is long enough to contain a valid revert reason
366
366
if len (data ) < 68 {
367
- return "" , fmt . Errorf ("data too short to contain a valid revert reason" )
367
+ return "" , errors . New ("data too short to contain a valid revert reason" )
368
368
}
369
369
370
370
// The revert reason is encoded in the data returned by a failed transaction call
@@ -377,7 +377,7 @@ func DecodeRevertReason(hexStr string) (string, error) {
377
377
378
378
// Ensure the data contains the full revert string
379
379
if uint64 (len (data )) < 68 + strLen {
380
- return "" , fmt . Errorf ("data too short to contain the full revert reason" )
380
+ return "" , errors . New ("data too short to contain the full revert reason" )
381
381
}
382
382
383
383
// Extract the revert reason string
0 commit comments