0

I'm trying to deploy basic erc20 example contract on rococo canvas but "contracts.ContractTrapped" error popped on deployment? any hint will be much appreciated, Thanks!

Rehan
  • 408
  • 1
  • 6
  • 17
  • Hey, would you be so kind as to repost this great question (with more details) on https://substrate.stackexchange.com/ -- and @Alejandro Martínez over there? Very happy to assist on our shiny new Substrate (and friends) home for your questions! – Nuke Feb 09 '22 at 15:54

2 Answers2

1

A common source of ContractTrapped are Integer overflows, those can cause your contract to trap as well.

Please, check the source of this paragraph to see if it solves your issue.

0

I have had the issue ContractTrapped while I wanted to add values in Solidity code without SafeMath library. 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;
}
Tomasz Waszczyk
  • 2,680
  • 5
  • 35
  • 73