| 247 | |
| 248 | #[test] |
| 249 | fn test_parse_panic() { |
| 250 | // Panic with code 0x11 (arithmetic overflow) |
| 251 | let panic_bytes = const_hex::decode( |
| 252 | "4e487b710000000000000000000000000000000000000000000000000000000000000011", |
| 253 | ) |
| 254 | .unwrap(); |
| 255 | |
| 256 | let result = ContractErrorParser::parse_from_bytes(panic_bytes.as_ref()).unwrap(); |
| 257 | assert_eq!(result.name, "Panic"); |
| 258 | assert!(matches!( |
| 259 | result.error_type, |
| 260 | crate::error_parser::ErrorType::Panic |
| 261 | )); |
| 262 | assert_eq!( |
| 263 | result.message, |
| 264 | Some("Arithmetic overflow/underflow".to_string()) |
| 265 | ); |
| 266 | assert_eq!(result.parameters, Some(vec!["0x11".to_string()])); |
| 267 | } |
| 268 | |
| 269 | #[test] |
| 270 | fn test_parse_error_not_found() { |