I want my users call a function and send some deposit to contract. I want them to chose whether they want to send ETH or ERC20 tokens. I have my code and I see no flaw in it. but how can I pass address(0x0) to remix UI? I mean if I want to send ETH, I need to set the token address to null or something.

if there is no option. is it possible to send address(0x0) using truffle?

contract SendEtherOrToken {

 function send(uint _value, Token _currency) public payable {
    if (address(_currency) == address(0x0)) { 
        require(msg.value == _value, "ETH value doesn't match offer");
    else { // use ERC20
        require(msg.value == 0, "ETH would be lost");
        require( _currency.transferFrom(msg.sender, address(this), _value),  "transferFrom failed");

I know, I can use a fake address and provide that option in my UI in case of sending ETH. if (_currency == fake address) {accept eth} and then pass the fake address in UI when user chose the ETH pay option instead of Token. but, I don't want to do that.

1 Answer 1


I got the answer, you have to pass the full length address to remix. even if it is an address or 0x0

in this case it will be : 0x0000000000000000000000000000000000000000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.