Contract that reverts with Solidity Custom Error fails to deploy to Javascript VM
See original GitHub issueUsing 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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Solidity revert with custom error explained with example
The new method allows users to define a custom error and pass it while reverting a transaction.
Read more >Remix VM error when deploying - Ethereum Stack Exchange
After a bit of scratching my head, I believe I found the issue. The problem is in registering the contract interfaces.
Read more >Creation of CustomToken errored: VM error: revert
I tried to deploy the contract will ETH Value but always got the error "The transaction has been reverted to the initial state....
Read more >Custom Errors in Solidity
The compiler includes all errors that a contract can emit in the contract's ABI-JSON. Note that this will not include errors forwarded through ......
Read more >Remix Documentation - Read the Docs
called JavaScript VM) is its own “blockchain” and on each reload the ... deployed, accessing a contract with AtAddress does not cost gas....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ethers.js (5.1.4) was published I think yesterday. thanks anyway 😃
On Wed, Apr 28, 2021 at 1:41 PM Edward Grech @.***> wrote:
this should be fixed in remix.ethereum.org in an hour. Alpha is already updated