简体   繁体   中英

How to debug revert transaction with truffle

I want to simulate revert-error, launching tests of Solidity contract with Truffle, but I need to get input call data for simulating it in other project, which I got from debugger. How can I launch debug despite errors?

You can use revertedWith to simulate revert-error, in my case I revert if the user don't have enough tokens.

   it("Transfer token", async ()=> {
        await expect(instance.transfer.call(accounts[1],9999999999)).to.be.revertedWith("You dont have enough tokens")
      });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM