# Crowdsale.sol Operator != not compatible with types contract ERC20

**URL:** <https://forum.openzeppelin.com/t/crowdsale-sol-operator-not-compatible-with-types-contract-erc20/7271>\
**Category:** Contracts\
**Created:** [April 23, 2021, 5:07am UTC](https://forum.openzeppelin.com/t/crowdsale-sol-operator-not-compatible-with-types-contract-erc20/7271 "2021-04-23T05:07:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![testingneverstop](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@testingneverstop](https://forum.openzeppelin.com/u/testingneverstop)\
**Post date:** [April 23, 2021, 5:07am UTC](https://forum.openzeppelin.com/t/crowdsale-sol-operator-not-compatible-with-types-contract-erc20/7271/1 "2021-04-23T05:07:47Z")

</div>

Hi, I am trying to include crowdsale.sol in my ERC20 contract but I get these two lines are causig compatibility errors:

Line 56:

> require(\_token != address(0));

TypeError: Operator != not compatible with types contract ERC20 and address payable require (\_token != address(0));

Line 193:

> ```
> wallet.transfer(msg.value);
> 
> ```

TypeError: "send" and "transfer" are only available for objects of type "address payable", not "address". wallet.transfer(msg.value);

> <https://github.com/ConsenSysMesh/openzeppelin-solidity/blob/master/contracts/crowdsale/Crowdsale.sol>

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [April 23, 2021, 5:16am UTC](https://forum.openzeppelin.com/t/crowdsale-sol-operator-not-compatible-with-types-contract-erc20/7271/2 "2021-04-23T05:16:43Z")

</div>

Hi @testingneverstop,

Have a look at: [Simple ERC20 Crowdsale](https://forum.openzeppelin.com/t/simple-erc20-crowdsale/4863)

---

<div class="post-metadata">

**Author:** ![nkccorp12](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/nkccorp12/32/17180_2.png) [@nkccorp12](https://forum.openzeppelin.com/u/nkccorp12)\
**Post date:** [December 9, 2022, 7:17am UTC](https://forum.openzeppelin.com/t/crowdsale-sol-operator-not-compatible-with-types-contract-erc20/7271/3 "2022-12-09T07:17:04Z")

</div>

Hi @abcoathup ,  
I have the same problem like the thread opener and I cant see how your answer helps with the problem.

What am I missing?

Thank you very much.

---

<div class="post-metadata">

**Author:** ![ernestognw](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/ernestognw/32/18576_2.png) [@ernestognw](https://forum.openzeppelin.com/u/ernestognw)\
**Post date:** [December 10, 2022, 2:32pm UTC](https://forum.openzeppelin.com/t/crowdsale-sol-operator-not-compatible-with-types-contract-erc20/7271/4 "2022-12-10T14:32:16Z")

</div>

Hey @nkccorp12,

The link @abcoathup is sharing has a detailed implementation reference that avoid these errors. The reason behind the error is clear on its description, there’s a type mismatch between variables.

1. For `require(_token != address(0))`, I’m guessing the problem is because `_token` is a variable of type `ERC20`, so it needs to be casted as an address with `address(_token)`
2. For `wallet.transfer(…)`, the `.transfer` function is added to `payable` addresses, which are a special type of `address`. It can be casted as well with `payable(wallet).transfer(…)`

Marking this as a solution.  
Best!
