github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/execution/testdata-shanghai/infiniteloop.sol (about)

     1  // SPDX-License-Identifier: GPL-3.0
     2  
     3  pragma solidity ^0.8.14;
     4  
     5  contract SimpleStorage {
     6      uint256 storedData;
     7  
     8      event Set(uint256);
     9      event Get(address, uint256);
    10      event Deadlock();
    11  
    12      function set(uint256 x) public {
    13          storedData = x;
    14          emit Set(x);
    15      }
    16  
    17      function get(address _to) public returns (uint256) {
    18          require(_to != address(0));
    19          emit Get(_to, storedData);
    20          return storedData;
    21      }
    22  
    23      function infinite() public {
    24          while (true) {
    25              storedData++;
    26          }
    27          emit Deadlock();
    28      }
    29  }