简体   繁体   English

polkadot canvas tes.net 合约部署错误“contracts.contractTrapped”

[英]polkadot canvas testnet contract deploy error "contracts.contractTrapped"

I'm trying to deploy basic erc20 example contract on rococo canvas but "contracts.ContractTrapped" error popped on deployment?我正在尝试在 rococo canvas 上部署基本的 erc20 示例合同,但在部署时弹出“contracts.ContractTrapped”错误? any hint will be much appreciated, Thanks!任何提示将不胜感激,谢谢!

A common source of ContractTrapped are Integer overflows, those can cause your contract to trap as well. ContractTrapped的一个常见来源是 Integer 溢出,这些也可能导致您的合约陷入陷阱。

Please, check the source of this paragraph to see if it solves your issue.请检查本段的来源,看看它是否解决了您的问题。

I have had the issue ContractTrapped while I wanted to add values in Solidity code without SafeMath library.当我想在没有SafeMath 库的情况下在 Solidity 代码中添加值时,我遇到了ContractTrapped问题。 The solution was to ensure safety of a source code like:解决方案是确保源代码的安全,例如:

function sum(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a);
    return c;
}

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

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