polkadot canvas testnet contract deploy error "contracts.contractTrapped"

132 Views Asked by At

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!

2

There are 2 best solutions below

1
Alejandro Martínez On

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.

6
Tomasz Waszczyk On

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;
}