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

     1  pragma solidity >=0.4.24;
     2  
     3  contract SimpleStorage {
     4     uint[32] storedData;
     5  
     6     event Set(uint256 indexed);
     7     event Get(address, uint256);
     8     event Deadlock();
     9  
    10     function set(uint x) public {
    11         for (uint i = 0; i < 32; i++) {
    12             storedData[i] = x;
    13         }
    14         emit Set(x);
    15     }
    16  
    17     function test1() public returns (uint) {
    18         uint x = 0;
    19         for (uint j = 0; j < 465; j++) {
    20             for (uint i = 0; i < 32; i++) {
    21                 x += storedData[i];
    22                 x = x >> 8;
    23                 x = x * 301;
    24             }
    25         }
    26         emit Set(x);
    27         return x;
    28     }
    29  
    30     function store1() public returns (uint) {
    31         uint x = 0;
    32         for (uint j = 0; j < 315; j++) {
    33             for (uint i = 0; i < 32; i++) {
    34                 x += storedData[i];
    35                 x = x >> 8;
    36                 x = x * 301;
    37             }
    38             storedData[j%32] = x;
    39         }
    40         emit Set(x);
    41         return x;
    42     }
    43  
    44     function test2() public returns (uint) {
    45         uint x = 0;
    46         for (uint j = 0; j < 488; j++) {
    47             for (uint i = 0; i < 32; i++) {
    48                 x += storedData[i];
    49                 x = x >> 8;
    50             }
    51         }
    52         emit Set(x);
    53         return x;
    54     }
    55  }