RyuuGan/sol-merger

OpenZeppelin contracts ERC-20 merge problem

Closed this issue · 6 comments

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?

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

Reminder for myself that this should also compile:

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

rkalis/truffle-plugin-verify#28

Should be fixed in v3.0.0

Thank you!

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

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.