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

OpenZeppelin contracts ERC-20 merge problem #32

Closed
dzarezenko opened this issue May 16, 2020 · 6 comments · Fixed by #34
Closed

OpenZeppelin contracts ERC-20 merge problem #32

dzarezenko opened this issue May 16, 2020 · 6 comments · Fixed by #34

Comments

@dzarezenko
Copy link

I'm trying to merge my simple ERC-20 token contract code but one of the dependencies contracts sources is not in the result file.

My simple contract code:

pragma solidity >=0.4.21 <0.7.0;

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

contract MyToken is ERC20 {

  constructor() public ERC20("MyToken", "MyToken") {
    uint8 decimals = 6;
    uint256 initialSupply = 1000000;

    _setupDecimals(decimals);
    _mint(msg.sender, initialSupply * 10 ** uint256(decimals));
  }

}

Sol-merger command:

sol-merger -c "./contracts/AnyCashToken.sol" ./build/dist

In the result file, the Address contract source was not imported.

Screenshot 2020-05-16 at 11 39 32

How can I merge my contracts in the right way?

@RyuuGan
Copy link
Owner

RyuuGan commented May 16, 2020

Hello, @dzarezenko

Currently version 0.6 is not supported fully. Because there might be structs and other syntax that is not supported.

Currenlty I made a couple of pull requests to support latest solidity Grammar, but didn't receive any result. So I'll start looking on another solution.

To understand why it is an error, you can simply run next command:

DEBUG="sol-merger*" <command to parse contracts>

Connected issue: rkalis/truffle-plugin-verify#30

Best regards,
Valerii Aligorskii

@RyuuGan
Copy link
Owner

RyuuGan commented May 16, 2020

Reminder for myself that this should also compile:

https://github.com/sobolev-igor/test

rkalis/truffle-plugin-verify#28

RyuuGan added a commit that referenced this issue May 16, 2020
BREAKING CHANGE: ImportsAnalyzer analizeImport is now private

relates #32, rkalis/truffle-plugin-verify#28
Updated dependencies
Added Solidity Grammar to project
@RyuuGan
Copy link
Owner

RyuuGan commented May 17, 2020

Should be fixed in v3.0.0

@dzarezenko
Copy link
Author

Thank you!

@Gideonsabat
Copy link

Hi, does anyone know how to merge openzeppelin contracts into a .sol file?

@RyuuGan
Copy link
Owner

RyuuGan commented Jan 2, 2023

Follow the installation guide: https://docs.openzeppelin.com/contracts/4.x/ and then use this library to merge it into one file.

Example of contract (with other library zeppelin-solidity):

import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";

You can checkout the readme file how to construct the build command.

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

Successfully merging a pull request may close this issue.

3 participants