Skip to content
Lattice

IEntropy

Git Source

Title: IEntropy

Author: Vendored minimal subset of Pyth (https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/entropy_sdk/solidity/IEntropy.sol).

Upstream license: Apache-2.0.

Minimal interface for the Pyth Entropy on-demand randomness contract (commit/reveal).

Vendored subset — do not add a pyth dependency. The Entropy contract fulfils a request by calling entropyCallback(uint64,address,bytes32) back on the requester.

Functions

getDefaultProvider

Returns the address of the default randomness provider.

function getDefaultProvider() external view returns (address provider);

Returns

NameTypeDescription
provideraddress

getFee

Returns the fee (in wei) charged by provider for one request.

function getFee(address provider) external view returns (uint128 feeAmount);

Parameters

NameTypeDescription
provideraddressThe randomness provider to quote.

Returns

NameTypeDescription
feeAmountuint128The required fee in wei.

requestWithCallback

Requests a random number with a callback, committing userRandomNumber.

Must be called with msg.value >= getFee(provider). The provider fulfils by calling entropyCallback(sequenceNumber, provider, randomNumber) on msg.sender.

function requestWithCallback(address provider, bytes32 userRandomNumber)
        external
        payable
        returns (uint64 assignedSequenceNumber);

Parameters

NameTypeDescription
provideraddressThe randomness provider to use.
userRandomNumberbytes32The caller's commitment to its half of the randomness.

Returns

NameTypeDescription
assignedSequenceNumberuint64The sequence number identifying this request.