Oraichain
Search…
Whitepaper
Developers
General
Networks
Oraichain Tutorials
AI Providers
AI Executors
Guide
CosmWasm IDE
Tools
Wallets
Wallets
PRICE FEEDS
Introduction
BNB Chain
Oraichain
Deployed Contract Registry
VRF 2.0
Introduction to Oraichain VRF 2.0
Get a Random Value Directly
Get a Random Value from API
Security Remarks
API Reference
Security Remarks
Get support from Oraichain team
OraiDEX
Introduction to OraiDEX
ORAIX Token
Others
Powered By
GitBook
API Reference
Index
Constructors
Text
Description
Constructors
Oracle vrf initialization
Functions
Text
Description
randomnessRequest
Make a request to generate random numbers
fulfillRandomness
VRF Oracle will call back when receiving valid VRF proof data
Constructors
constructor (address _oraiToken, address _oracle) public {
fee = 1000000000000000000;
orai = _oraiToken;
oracle = _oracle;
}
�Funtions
randomnessRequest
function randomnessRequest(uint256 _seed, bytes memory _data) public returns (bytes32 reqId);
_seed : a random number provided by the caller
_data : the result of callbackAddress and callbackFunc after encoding
bytes memory data = abi.encode(address(this), this.fulfillRandomness.selector);
callbackAddress: smart contract address receive random number
callbackFunct : hen a function is called, the first 4 bytes of
calldata
specifies which function to call.
fulfillRandomness
function fulfillRandomness(bytes32 reqId, bytes calldata _data, uint8 v, bytes32 r, bytes32 s) external;
reqId: request id generated when calling function randomnessRequest
_data: includes callbackAddress and callbackFunc after encode
v,r,s: proof vrf
VRF 2.0 - Previous
Security Remarks
Next - VRF 2.0
Security Remarks
Last modified
4mo ago
Copy link
Edit on GitHub
Outline
Index
Constructors
�Funtions