ocaml-solidity
ocaml-solidity copied to clipboard
Parse error while parsing OpenZeppelin ERC20 contract
I tried to parse the contract : https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
But I got this error
Fatal error: exception Solidity_exceptions.SyntaxError("Parse error", _)
I'm not sure if I'm doing something wrong, I'm using the 0.5.3 version of ocaml-solidity
This is probably due to the fact that ocaml-solidity supports only the versions 0.6.x (cf. https://ocamlpro.com/blog/2020_05_19_ocaml_solidity_parser_with_menhir/) of solidity while that contract is written in 0.8.0. After testing I got the following error message:
./openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:202.21-202.22:
Syntax error: Parse error
199 uint256 currentAllowance = allowance(owner, spender);
200 require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
201 unchecked {
202 > _approve(owner, spender, currentAllowance - subtractedValue);
203 }
204
The unchecked
keyword for example is currently not supported in ocaml-solidity.
We are currently not focused on this project, so we can't promise to do it very soon, but feel free to open a PR or you can contact us to tell us more about your use of the project and your specific needs on it.