Contract reference
All contracts are in contracts/contracts/, written for Solidity 0.8.24 with the Cancun EVM version.
| Contract | Purpose |
|---|---|
GenesisVRFCoordinator | Takes VRF requests, verifies proofs and calls consumers back |
GenesisVRFConsumerBase | Base contract for VRF consumers (pay-per-request and subscription helpers) |
GenesisVRFSubscriptions | Prepaid VRF credit, inherited by the coordinator |
RaffleGame | Example: free-to-enter raffle funded by a subscription |
GenesisRandomnessBeacon | Scheduled, hash-chained public randomness |
GenesisFairSelection | Selections from a frozen list, using a VRF seed |
GenesisCommitReveal | Bonded commit–reveal rounds |
GenesisAutomationRegistry | Upkeeps, keepers, payments |
GenesisDataOracle | Threshold-signed feeds with a median |
GenesisFeedProxy | AggregatorV3Interface view of one feed |
GenesisFeeManager | Prices in HYPE and GENESIS, discounts, conversion rate |
GenesisStaking | HYPE and GENESIS stake, unbonding, slashing |
lib/ECVRF | On-chain ECVRF verification |
GenesisVRFCoordinator
| Function | Notes |
|---|---|
requestRandomWords(keyHash, confirmations, callbackGasLimit, numWords) | payable. Value means HYPE, no value means GENESIS (pulled via allowance) |
requestRandomWordsFor(feeAccount, …) | Trusted first-party consumers only. Prices the fee for feeAccount |
quoteFee(account, token) | Fee after discounts |
fulfillRandomWords(publicKey, proof, seed, commitment) | Anyone can call it with a valid proof |
withdraw(token) | Operator fee withdrawal |
registerProvingKey(publicKey, operator) | Owner only. The operator must meet the stake minimum |
Subscriptions: createSubscription(), fundSubscription(subId, token, amount), addConsumer, removeConsumer, withdrawSubscription(subId, token, amount, to), cancelSubscription(subId, to), requestSubscriptionOwnerTransfer / acceptSubscriptionOwnerTransfer, getSubscription(subId), quoteSubscriptionRequest(subId), requestRandomWordsWithSubscription(subId, keyHash, confirmations, gas, numWords).
Events: RandomWordsRequested, RandomWordsFulfilled, SubscriptionCreated, SubscriptionFunded, SubscriptionCharged.
GenesisRandomnessBeacon
currentRound(), roundTime(round), seedForRound(round), publishRound(round, proof), getRandomness(round), latestRandomness(). Event: RoundPublished.
GenesisFairSelection
createSelection(name, numWinners, weighted), addEntrants(id, accounts, weights), draw(id) (payable), drawWithSubscription(id, subId), getSelection(id), getEntrants(id), getWinners(id), computeIndices(seed, n, k), computeWeightedIndices(seed, weights, k).
GenesisCommitReveal
createRound(label, commitDuration, revealDuration, bond, bondToken), computeCommitment(roundId, participant, value, salt), commit(roundId, commitment) (payable), reveal(roundId, value, salt), finalize(roundId), claim(roundId), getRound(roundId), getRandomness(roundId).
GenesisAutomationRegistry
registerUpkeep(name, target, gasLimit, trigger, interval, checkData, token, funding), addFunds(id, amount), setPaused, cancelUpkeep, withdrawFunds, checkUpkeep(id), performUpkeep(id) (keepers), registerKeeper(), unregisterKeeper(), hasKeeperStake(keeper), withdrawKeeperBalance(token), getMaxPayment(id).
GenesisDataOracle
createFeed(description, decimals, oracles, threshold, maxAge) (owner), transmit(feedId, roundId, observations), observationDigest(feedId, roundId, answer, observedAt), latestRoundData(feedId), getRoundData(feedId, roundId), getFeed(feedId).
GenesisFeeManager
quote(service, account, token), discountBps(account), genesisPaymentDiscountBps(), nativeToToken(token, amount), isAccepted(token), sponsor(beneficiary), unsponsor(beneficiary). Owner: setBaseFees, setGenesisToken (once), setGenesisPaymentDiscount (must be > 0), setTiers, setConversion.
GenesisStaking
stake(token, amount), stakeFor(account, token, amount), requestUnbond(token, amount), withdraw(token), activeStake(account, token), slash(account, token, amount, recipient) (owner or slasher), setGenesisToken (once).