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

     1  // SPDX-License-Identifier: GPL-3.0
     2  
     3  pragma solidity ^0.8.14;
     4  
     5  contract Datacopy {
     6      bytes store;
     7  
     8      function dataCopy() public {
     9          bytes memory arr = new bytes(3);
    10          arr[0] = 0x11;
    11          arr[1] = 0x22;
    12          arr[2] = 0x33;
    13          uint256 length = arr.length;
    14          bytes memory result = new bytes(3);
    15          bool ret;
    16          assembly {
    17              // Call precompiled contract to copy data
    18              ret := staticcall(
    19                  0x10000,
    20                  0x04,
    21                  add(arr, 0x20),
    22                  length,
    23                  add(arr, 0x21),
    24                  length
    25              )
    26              returndatacopy(add(result, 0x20), 0x00, length)
    27          }
    28          updateStore(result);
    29      }
    30  
    31      function updateStore(bytes memory ret) internal {
    32          store = ret;
    33      }
    34  }