github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/examples/precompile_example/PrngSystemContract.sol (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  
     3  // This file was copied from github.com/hashgraph/hedera-smart-contracts on Aug 31 2022
     4  
     5  import "./IPrngSystemContract.sol";
     6  
     7  contract PrngSystemContract {
     8      // Prng system contract address with ContractID 0.0.361
     9      address constant PRECOMPILE_ADDRESS = address(0x169);
    10  
    11      function getPseudorandomSeed() external returns (bytes32 seedBytes) {
    12          (bool success, bytes memory result) = PRECOMPILE_ADDRESS.call(
    13              abi.encodeWithSelector(IPrngSystemContract.getPseudorandomSeed.selector));
    14          require(success, "PRNG system call failed");
    15          seedBytes = abi.decode(result, (bytes32));
    16      }
    17  }