github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/execution/testdata/datacopy.sol (about) 1 pragma solidity ^0.8.3; 2 3 contract Datacopy { 4 bytes store; 5 function dataCopy() public { 6 bytes memory arr = new bytes(3); 7 arr[0] = 0x11; 8 arr[1] = 0x22; 9 arr[2] = 0x33; 10 uint length = arr.length; 11 bytes memory result = new bytes(3); 12 bool ret; 13 assembly { 14 // Call precompiled contract to copy data 15 ret := staticcall(0x10000, 0x04, add(arr, 0x20), length, add(arr, 0x21), length) 16 returndatacopy(add(result, 0x20), 0x00, length) 17 } 18 updateStore(result); 19 } 20 21 function updateStore(bytes memory ret) internal { 22 store = ret; 23 } 24 }