Skip to content

VORCoordinator

Coordinates on-chain verifiable-randomness requests

Functions:

Events:

Modifiers:

Function constructor(address _xfund, address _blockHashStore) public

No description

Function getProviderAddress(bytes32 _keyHash) external -> address

getProviderAddress - get provider address

Parameters:

  • _keyHash: ID of the VOR public key

Function getProviderFee(bytes32 _keyHash) external -> uint96

getProviderFee - get provider's base fee

Parameters:

  • _keyHash: ID of the VOR public key

Function getProviderGranularFee(bytes32 _keyHash, address _consumer) external -> uint96

getProviderGranularFee - get provider's granular fee for selected consumer

Parameters:

  • _keyHash: ID of the VOR public key

  • _consumer: address of the consumer smart contract

Function registerProvingKey(uint256 _fee, address payable _oracle, uint256[2] _publicProvingKey) external

No description

Parameters:

  • _fee: minimum xFUND payment required to serve randomness

  • _oracle: the address of the node with the proving key

  • _publicProvingKey: public key used to prove randomness

Function changeFee(uint256[2] _publicProvingKey, uint256 _fee) external

No description

Parameters:

  • _publicProvingKey: public key used to prove randomness

  • _fee: minimum xFUND payment required to serve randomness

Function changeGranularFee(uint256[2] _publicProvingKey, uint256 _fee, address _consumer) external

No description

Parameters:

  • _publicProvingKey: public key used to prove randomness

  • _fee: minimum xFUND payment required to serve randomness

Function withdraw(address _recipient, uint256 _amount) external

Allows the oracle operator to withdraw their xFUND

Parameters:

  • _recipient: is the address the funds will be sent to

  • _amount: is the amount of xFUND transferred from the Coordinator contract

Function randomnessRequest(bytes32 _keyHash, uint256 _consumerSeed, uint256 _feePaid) external

_consumerSeed is mixed with key hash, sender address and nonce to obtain preSeed, which is passed to VOR oracle, which mixes it with the hash of the block containing this request, to compute the final seed.

The requestId used to store the request data is constructed from the preSeed and keyHash.

Parameters:

  • _keyHash: ID of the VOR public key against which to generate output

  • _consumerSeed: Input to the VOR, from which randomness is generated

  • _feePaid: Amount of xFUND sent with request. Must exceed fee for key

Function hashOfKey(uint256[2] _publicKey) public -> bytes32

No description

Parameters:

  • _publicKey: the key to return the address for

Function fulfillRandomnessRequest(bytes _proof) public

No description

Parameters:

  • _proof: the proof of randomness. Actual random output built from this

Function callBackWithRandomness(bytes32 requestId, uint256 randomness, address consumerContract) internal

No description

Function getRandomnessFromProof(bytes _proof) internal -> bytes32 currentKeyHash, struct VORCoordinator.Callback callback, bytes32 requestId, uint256 randomness

No description

Event RandomnessRequest(bytes32 keyHash, uint256 seed, address sender, uint256 fee, bytes32 requestID)

No description

Event NewServiceAgreement(bytes32 keyHash, uint256 fee)

No description

Event ChangeFee(bytes32 keyHash, uint256 fee)

No description

Event ChangeGranularFee(bytes32 keyHash, address consumer, uint256 fee)

No description

Event RandomnessRequestFulfilled(bytes32 requestId, uint256 output)

No description

Modifier sufficientXFUND(uint256 _feePaid, bytes32 _keyHash)

Reverts if amount is not at least what was agreed upon in the service agreement

Parameters:

  • _feePaid: The payment for the request

  • _keyHash: The key which the request is for

Modifier hasAvailableFunds(uint256 _amount)

Reverts if amount requested is greater than withdrawable balance

Parameters:

  • _amount: The given amount to compare to withdrawableTokens