Services
GOAT VRF uses the drand network to deliver verifiable randomness to EVM contracts on GOAT Network.
Consumer contract
|
v
Request randomness from GoatVRF
|
v
Relayer watches requests
|
v
drand proof submitted onchain
|
v
Consumer callback receives randomness
Component Role GoatVRF contract Verifies proofs and stores request state Oracle or relayer service Pulls randomness from drand and submits proofs Consumer contract Requests randomness and implements the callback
Consumer contract pattern // SPDX-License-Identifier: MIT
pragma solidity 0.8.28 ;
interface IRandomnessCallback {
function receiveRandomness ( uint256 requestId , uint256 randomness ) external ;
}
uint256 callbackGas = 600000 ;
uint256 fee = IGoatVRF (goatVRF). calculateFeeWithGasPrice (callbackGas, maxAllowedGasPrice);
uint256 deadline = block .timestamp + IDrandBeacon ( IGoatVRF (goatVRF). beacon ()). period ();
requestId = IGoatVRF (goatVRF). getNewRandom (deadline, maxAllowedGasPrice, callbackGas);
The fee token is WGOATBTC. Approve enough allowance before calling getNewRandom, and leave headroom if you expect gas-price movement between estimation and fulfillment.
Fee rule Description Fixed Uses a static fee plus callback gas cost APRO_BTC Adjusts against the APRO BTC price feed to keep a target USD-denominated value
forge build
forge test
forge script script/Deploy.s.sol --rpc-url < rpc_ur l > --broadcast