Skip to content

Contract reference ​

All contracts are in contracts/contracts/, written for Solidity 0.8.24 with the Cancun EVM version.

ContractPurpose
GenesisVRFCoordinatorTakes VRF requests, verifies proofs and calls consumers back
GenesisVRFConsumerBaseBase contract for VRF consumers (pay-per-request and subscription helpers)
GenesisVRFSubscriptionsPrepaid VRF credit, inherited by the coordinator
RaffleGameExample: free-to-enter raffle funded by a subscription
GenesisRandomnessBeaconScheduled, hash-chained public randomness
GenesisFairSelectionSelections from a frozen list, using a VRF seed
GenesisCommitRevealBonded commit–reveal rounds
GenesisAutomationRegistryUpkeeps, keepers, payments
GenesisDataOracleThreshold-signed feeds with a median
GenesisFeedProxyAggregatorV3Interface view of one feed
GenesisFeeManagerPrices in HYPE and GENESIS, discounts, conversion rate
GenesisStakingHYPE and GENESIS stake, unbonding, slashing
lib/ECVRFOn-chain ECVRF verification

GenesisVRFCoordinator ​

FunctionNotes
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).

GENESIS · verifiable infrastructure for Elysium