Search code examples
soliditysmartcontractseverscale

Everscale Solidity error by timeout: code: 3025 Contract execution was terminated with error


Free TON Solidity code or execution error. Can't understand my mistake, I already compact the code to the minimum:

cat ./SimpleStorage.sol

pragma solidity >=0.6.0;

contract SimpleStorage {
    uint storedData;
    function set(uint x) public {
        storedData = x;
    }
    function get() public view returns (uint) {
        return storedData;
    }
}

tonos-cli call 0:efbeed7533cae6f12869b665b610c30535397c5c1523f6b41561905807aed958 set '{"x":100}' --abi ./SimpleStorage.abi.json

Input arguments:
address: 0:efbeed7533cae6f12869b665b610c30535397c5c1523f6b41561905807aed958
method: set
params: {"x":100}
abi: ./SimpleStorage.abi.json

Then in result I get an error by timeout:

code: 3025
message: Contract execution was terminated with error

Solution

  • You need to enable gas before You store variables. tvm.accept can do it.

      function set(uint x) public {
            tvm.accept();
            storedData = x;
      }