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

Contract that reverts with Solidity Custom Error fails to deploy to Javascript VM #1138

Closed
dwardu opened this issue Apr 22, 2021 · 6 comments

Comments

@dwardu
Copy link

dwardu commented Apr 22, 2021

Using the contract from the Custom Errors explainer blog post:

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

error Unauthorized();

contract VendingMachine {
    address payable owner = payable(msg.sender);

    function withdraw() public {
        if (msg.sender != owner)
            revert Unauthorized();

        owner.transfer(address(this).balance);
    }
    // ...
}

The contract compiles correctly in Remix IDE, and ABI is created correctly:

{
    "inputs": [],
    "name": "Unauthorized",
    "type": "error"
}

But deployment to Javascript VM fails with following error:

creation of VendingMachine pending...

creation of VendingMachine errored: invalid fragment object (argument="value", value={"inputs":[],"name":"Unauthorized","type":"error"}, code=INVALID_ARGUMENT, version=abi/5.0.7)

On the other hand, deployment to Rinkeby succeeds.

@dwardu dwardu changed the title Contract that reverts with Solidity Custom Error fails to deploy Contract that reverts with Solidity Custom Error fails to deploy to Javascript VM Apr 22, 2021
@dwardu
Copy link
Author

dwardu commented Apr 22, 2021

I guess this issue will be closed when ethers-io/ethers.js#1498 is closed and merged into this project.

@LianaHus
Copy link
Collaborator

this should be fixed in remix.ethereum.org in an hour. Alpha is already updated

@dwardu
Copy link
Author

dwardu commented Apr 28, 2021

@LianaHus Cool. Thanks.

TBH I was waiting for ethers-io/ethers.js#1498 fix to be announced, and was intending to create a PR with the dependency upgrade 😊 Was it fixed in a different way?

@LianaHus
Copy link
Collaborator

LianaHus commented Apr 28, 2021 via email

@LianaHus
Copy link
Collaborator

LianaHus commented Apr 28, 2021 via email

@dwardu
Copy link
Author

dwardu commented Apr 28, 2021

Ok! Thanks.

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

No branches or pull requests

2 participants