简体   繁体   English

错误:处理交易时出现 VM 异常:已恢复,原因字符串为“您需要花费更多 ETH!”

[英]Error: VM Exception while processing transaction: reverted with reason string 'You need to spend more ETH!'

At the unit testing section on solidity course Lesson7 around 11:23 solidity课程Lesson7单元测试部分 11:23左右

https://youtu.be/gyMwXuJrbJQ?t=41004。 Failed the test "updated the amount funded data structure". https://youtu.be/gyMwXuJrbJQ?t=41004。未通过“更新金额数据结构”测试。 Seems like sendValue failed but I declared the sendValue for 1 Ether and pass the args of sendvalue.似乎 sendValue 失败了,但我声明了 1 Ether 的 sendValue 并传递了 sendvalue 的参数。

Error Information错误信息

FundMe
fund
updated the amount funded data structure:
Error: VM Exception while processing transaction: reverted with reason string 'You need to spend more ETH!'
at FundMe.fund (contracts/FundMe.sol:40)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)

test script - fundme.test.js测试脚本 - fundme.test.js

const sendValue = ethers.utils.parseEther("1")

describe("fund", async function () {
    it("Fails if you don't send enough ETH", async function () {
        await expect(fundMe.fund()).to.be.revertedWith(
            "You need to spend more ETH!"
        )
    })

    it("updated the amount funded data structure", async function () {
        // 执行fund,获取funder的地址=>金额映射,和fund的金额做对比
        await fundMe.fund({ value: sendValue })
        const response = await fundMe.addressToAmountFunded(deployer)
        assert.equal(response.toString(), sendValue.toString())
    })

try to remove the "async" word from:尝试从以下位置删除“异步”字样:

describe("fund", async function () {

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:处理事务时出现 VM 异常:还原 - Error : VM Exception while processing transaction: revert 错误:调用还原异常; 处理事务时出现 VM 异常: - Error: call revert exception; VM Exception while processing transaction: 无法弄清楚为什么在处理事务时出现 VM 异常:恢复错误 - Cannot figure out why I am getting VM Exception while processing transaction: revert error web3 - 处理事务时出现 VM 异常:gas 耗尽 - web3 - VM Exception while processing transaction: out of gas 处理事务时出现 VM 异常:恢复 TransferHelper: TRANSFER_FROM_FAILED 运行 bot.js 的 manipulatePrice.js 测试时 - VM Exception while processing transaction: revert TransferHelper: TRANSFER_FROM_FAILED when running manipulatePrice.js test for bot.js 错误:通过 ropsten infura 测试网发送交易时,EVM 已恢复交易 - Error: Transaction has been reverted by the EVM while sending transaction via ropsten infura testnet Web3 错误:事务已被 EVM 还原: - Web3 Error: Transaction has been reverted by the EVM: 不通过 web3.eth.accounts.privateKeyToAccount() 将 sginer 添加到钱包时出现错误交易不存在/不可用? - Getting error Transaction does not exist/is not available when not adding sginer to wallet via web3.eth.accounts.privateKeyToAccount()? 事务恢复:function 在使用 ether.js 进行测试时返回了意外的数据量(uniswapv2router.swapExactTokensForTokens 函数) - Transaction reverted: function returned an unexpected amount of data while testing with ether.js (uniswapv2router.swapExactTokensForTokens function) 处理路线时出现Ember错误:您必须使用Ember.set() - Ember error while processing route: You must use Ember.set()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM