Skip to content
Lattice

HederaPrngAdapter

Git Source

Inherits: IHederaPrngAdapter

Title: HederaPrngAdapter

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from hiero-ledger/hiero-contracts (https://github.com/hiero-ledger/hiero-contracts)

Diamond facet exposing Hedera's PRNG system contract (0x169) as synchronous randomness.

Stateless delegator over HederaPrngAdapterLib. Only meaningful on Hedera.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: Hedera

Functions

drawSeed

Draws a fresh 32-byte seed.

function drawSeed() external virtual override returns (bytes32 seed);

Returns

NameTypeDescription
seedbytes32

drawInRange

Draws a seed and reduces it to a number in [lo, hi).

function drawInRange(uint32 lo, uint32 hi) external virtual override returns (uint32 number);

Parameters

NameTypeDescription
louint32
hiuint32

Returns

NameTypeDescription
numberuint32

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643). Order matches forge inspect HederaPrngAdapter methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: drawInRange(uint32,uint32) 0xc2f9516d drawSeed() 0x4c7dde2f

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes