Skip to content

Commit 10911c3

Browse files
Merge pull request #1 from mds1/chore/use-toString
chore: replace uint2str function with cheatcode
2 parents a394df7 + 6f36143 commit 10911c3

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/DevOpsTools.sol

+1-25
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ library DevOpsTools {
8585
relativeScriptPath
8686
);
8787
getRecentDeployment[2] = contractName;
88-
getRecentDeployment[3] = uint2str(chainId);
88+
getRecentDeployment[3] = vm.toString(chainId);
8989
getRecentDeployment[4] = string.concat(
9090
absolutePath,
9191
"/",
@@ -102,28 +102,4 @@ library DevOpsTools {
102102
revert("No contract deployed");
103103
}
104104
}
105-
106-
function uint2str(
107-
uint _i
108-
) internal pure returns (string memory _uintAsString) {
109-
if (_i == 0) {
110-
return "0";
111-
}
112-
uint j = _i;
113-
uint len;
114-
while (j != 0) {
115-
len++;
116-
j /= 10;
117-
}
118-
bytes memory bstr = new bytes(len);
119-
uint k = len;
120-
while (_i != 0) {
121-
k = k - 1;
122-
uint8 temp = (48 + uint8(_i - (_i / 10) * 10));
123-
bytes1 b1 = bytes1(temp);
124-
bstr[k] = b1;
125-
_i /= 10;
126-
}
127-
return string(bstr);
128-
}
129105
}

0 commit comments

Comments
 (0)