Can I use Crowdsale with ERC20 Token created in OZ4.5.0?

Hi everyone,

Basically, I already have ERC20 token created, which is using solidity 0.8.2 and OpenZeppelin version 4.5.0. I know that Crowdsales supports only OpenZeppelin Contracts 2.x version. I am not sure if I can use my already created Token with Crowdsale. Will it work considering both contracts use a different OpenZeppelin version?

Thank you.

Hi, welcome to the community! :wave:

I think yes, you can, although using two different versions in a project is not a good idea. But you know, sometimes, when the two contracts are used in combination, maybe they will generate some unexpected result, so I think you should test more when you publish these two contracts to use together.

1 Like

Great, thanks for the advice. I try to test them, hopefully, there won't be any conflicts. I need two different versions because my token should be upgradeable and only OZ version >=3 provides this feature.

I also found the article that desribes how Crowdsale could be modified to work with OZ4. I don't know if this is safe, what do you think?

It seems like just updating some grammar, and you still need to test more.

1 Like

Did you got it right? I'm having same troubles. Creating ERC20 on v4.x and then how do tokens get minted from theother v2.5 contract?

We eventually decided to do pre-ICO manually as this was sufficient in our case. Unfortunately, I haven't decided yet how to approach ICO - whether to code custom code or update the OZ crowdsale. I am leaning towards the former as there are some github repos like this one, and the code is pretty straightforward.

1 Like

Nice repo, but I want a min and max cap, a whitelist and a vesting schedule for the tokens. Contracts on v2.5 work but they mostly mint the token.