Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compileSourceString function not working for specifically formatted contracts #272

Open
malachylokicode opened this issue Aug 10, 2024 · 0 comments

Comments

@malachylokicode
Copy link

malachylokicode commented Aug 10, 2024

When I try to run compileSourceString(fileName, srcAsStr, compilerVersionArray), on the following contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract CharleneSample is ERC20, Ownable {
    constructor() ERC20("Sample", "SPL") Ownable(msg.sender) {
        _mint(msg.sender, 1000000 * 10 ** decimals()); // Mint initial supply to contract creator
    }

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }
}

I get the following error:

  response: 'Unable to compile: Compiler Errors: ==== 0.8.23 ====:\n' +
    ' TypeError: Wrong argument count for constructor call: 1 arguments given but expected 0\n' +
    ' --> contracts/CharleneSimple.sol:7:35:\n' +
    '  |\n' +
    '7 | contract CharleneSample is ERC20, Ownable(msg.sender) {\n' +
    '  |                                   ^^^^^^^^^^^^^^^^^^^\n' +
    '\n' +
    '\n',
  status: 400,
  options: undefined
}

It seems like solc-typed-ast for some reason doesn't recognize that Ownable takes in a constructor argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant