简体   繁体   English

如何测试 Solidity 应付合同

[英]How to test a Solidity payable contract

I am currently testings an application created using solidity with foundry, and I am wondering how to mock a "payable" function in the tests by a method paying ether to the blockchain.我目前正在测试一个使用铸造厂使用solidity创建的应用程序,我想知道如何通过向区块链支付以太币的方法在测试中模拟“可支付” function。 Does anyone know of any built-in functions that would do this?有谁知道可以做到这一点的任何内置函数? Thanks in advance.提前致谢。

you can use HARDHAT for integrated testing with local devchain.您可以使用 HARDHAT 与本地开发链进行集成测试。

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

相关问题 如何使用 HardHat 调用可支付的 Solidity 函数? - How to invoke a payable solidity function using HardHat? 可靠性:调用另一个合约的函数时出错。 错误:发送值时应向构造函数付款 - Solidity: Error when calling a function of another contract. Error: The constructor should be payable when you send value 如何在solidity 0.5.2或更高版本中分配或重置address[]payable变量? - How to assign or reset the address[] payable variable in solidity 0.5.2 or above? solidity中payable function如何通过msg.value方式收款? - How payable function in solidity receives money by msg.value method? 如何在 Solidity 智能合约中启用 Claim Tokens? - How to enable Claim Tokens in Solidity Smart Contract? Solidity - 如何从外部合同中调用智能合约实例? - Solidity - How to call smart contract instances from external contract? 如何获得合同稳固性的当前状态? - How to get current state of contract solidity? 如何用solidity语言删除合同的这个ParserError? - How to remove this ParserError of contract in solidity language? 我在为我的 Solidity 合约编写测试时遇到问题? - I'm having problems writing test for my Solidity contract? 将 arguments 传递给可靠的合约文件,当我尝试测试合约时它返回 0 - passing arguments to contract file in solidity, when I tried to test the contract it returns 0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM