IEntropy
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
| Name | Type | Description |
|---|---|---|
| provider | address |
getFee
Returns the fee (in wei) charged by provider for one request.
function getFee(address provider) external view returns (uint128 feeAmount);Parameters
| Name | Type | Description |
|---|---|---|
| provider | address | The randomness provider to quote. |
Returns
| Name | Type | Description |
|---|---|---|
| feeAmount | uint128 | The 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
| Name | Type | Description |
|---|---|---|
| provider | address | The randomness provider to use. |
| userRandomNumber | bytes32 | The caller's commitment to its half of the randomness. |
Returns
| Name | Type | Description |
|---|---|---|
| assignedSequenceNumber | uint64 | The sequence number identifying this request. |