[英]how to solve type error in solidity Remix
my solidity smart contract is compiling in remix with out any error .我的 Solidity 智能合约正在 remix 中编译,没有任何错误。 my contract code is below:我的合同代码如下:
pragma solidity >=0.4.0 <0.6.0;
contract NewConreact {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}
it is compiling in remix perfectly but when i run it to triger set() and get()i got:它在 remix 中完美编译,但是当我运行它以触发 set() 和 get() 时,我得到了:
"error: Failed to decode output: TypeError: Cannot read property 'length' of undefined" “错误:无法解码输出:类型错误:无法读取未定义的属性‘长度’”
this error.这个错误。
I found a closed issue in solidity git repo but didn't find any solution.我在solidity git repo 中发现了一个已解决的问题,但没有找到任何解决方案。 I also increase the gas limit but didn't work.我也增加了气体限制,但没有用。
somebody, please help me to figure out the problem.有人,请帮我找出问题所在。
This normally happens when the deployment is failing with unknown reasons - may be you tried with Injected web3 or web3 provider like Ganache-cli and it somehow failed deployment and however the contract interface was still appended to the UI.这通常发生在部署因未知原因失败时 - 可能您尝试使用注入的 web3 或 web3 提供程序,如 Ganache-cli 并且它以某种方式部署失败,但是合同界面仍然附加到 UI。 This could have made you confuse that the contract got deployed correctly.这可能会让您对合约部署正确感到困惑。
The work around is to view and expand the log output of the transaction for deploying the contract.解决方法是查看和展开交易的日志输出以部署合约。 Make sure your contract is successful before doing transactions.在进行交易之前,请确保您的合同成功。
Please provide your logs if you are still unable to do the transactions even after you have deployed the contract successfully.如果您在成功部署合约后仍然无法进行交易,请提供您的日志。
Try using Chrome, avoid Safari, and be sure to remove the "s" from the solidity Remix site > won't work > https://remix but http://remix will.尝试使用 Chrome,避免使用 Safari,并确保从 Solidity Remix 站点中删除“s”> 不起作用 > https://remix但http://remix会。 Once I moved to Chrome it worked一旦我转移到 Chrome,它就起作用了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.