While verifying Etherscan Contract with pragma solidity ^0.8.0;
CODE
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
ERROR
ParserError: Expected identifier but got '&'
--> myc:1:8:
|
1 | DEPLOY & RUN TRANSACTIONS
| ^
Thanks
hasanza
December 13, 2021, 4:58pm
2
Hey, welcome to the OZ forums
Can you posed more of the file in question? It is possible that you used "&" in your string "DEPLOY & RUN TRANSACTIONS" and the compiler thinks it is part of the code due to some reason.
1 Like
frangio
December 16, 2021, 8:17pm
3
This was answered in the GitHub issue:
opened 09:24AM - 13 Dec 21 UTC
closed 10:19AM - 13 Dec 21 UTC
While verifying Etherscan Contract with pragma solidity ^0.8.0;
CODE
```
… function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
```
ERROR
```
ParserError: Expected identifier but got '&'
--> myc:1:8:
|
1 | DEPLOY & RUN TRANSACTIONS
| ^
```
Thanks