File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,27 @@ library LibInitializeGuard {
327
327
function _getContractAbsolutePath (uint256 forkId , address addr ) private view returns (string memory contractName ) {
328
328
TNetwork networkType = vme.getNetworkTypeByForkId (forkId);
329
329
TContract contractType = vme.getContractTypeByRawData (networkType, addr);
330
- contractName = vme.getContractAbsolutePath (contractType);
330
+ string memory contractTypeName = vme.getContractName (contractType);
331
+ string memory contractNameMap = _getContractNameFromAbsolutePath (vme.getContractAbsolutePath (contractType));
332
+ contractName =
333
+ (keccak256 (bytes (contractNameMap)) == keccak256 (bytes (contractTypeName))) ? contractTypeName : contractNameMap;
334
+ }
335
+
336
+ function _getContractNameFromAbsolutePath (string memory path ) internal pure returns (string memory contractName ) {
337
+ bytes memory pathBytes = bytes (path);
338
+ uint256 length = pathBytes.length ;
339
+ bytes memory contractNameBytes = new bytes (length - 4 );
340
+
341
+ if (
342
+ length > 4 && pathBytes[length - 4 ] == ". " && pathBytes[length - 3 ] == "s " && pathBytes[length - 2 ] == "o "
343
+ && pathBytes[length - 1 ] == "l "
344
+ ) {
345
+ // Create a new bytes array without the ".sol" extension
346
+ for (uint256 i = 0 ; i < length - 4 ; i++ ) {
347
+ contractNameBytes[i] = pathBytes[i];
348
+ }
349
+ }
350
+ return string (contractNameBytes);
331
351
}
332
352
333
353
/**
You can’t perform that action at this time.
0 commit comments