RNGServiceChainlinkV2
Last updated
Last updated
This contract implements a service that allows it to work with the Chainlink V2 to request randomness.
Allows the pendingOwner
address to claim the owner role. This function is only callable by the pendingOwner
.
Allows to initialize the contract during the deployment.
Parameters:
Name | Type | Description |
---|---|---|
Handles the VRF response. This function is only callable by the VRF Coordinator.
Parameters:
Name | Type | Description |
---|---|---|
Leaves the contract without owner. It will not be possible to call the owner's functions anymore. Can only be called by the current owner. The method does not take any parameters. Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
Sends a request for a random numbers to the 3rd-party service. Some services will complete the request immediately, others may have a time-delay. Some services require payment in the form of a token, such as LINK for Chainlink VRF. The calling contract should lock
all activity until the result is available via the requestId
. This function is only callable by the manager.
Parameters:
Return:
Sets Chainlink VRF key hash. This function is only callable by the owner.
Parameters:
Allows the owner to give the manager role to an address. The manager role has access to the functions with the modified onlyManagerOrOwner.
Parameters:
Sets Chainlink VRF subscription ID associated with this contract. This function is only callable by the owner.
Parameters:
Transfers ownership of the contract to a _pendingOwner
. Can only be called by the current owner.
Parameters:
Gets Chainlink VRF key hash associated with this service contract. A key hash is an identifier that maps to a job and a private key on the VRF service and that represents a specified gas lane. If your request is urgent, specify a gas lane with a higher gas price limit.
Return:
Gets the last request ID used by the RNG service.
Return:
Gets an array of random numbers produced by the 3rd-party service.
Parameters:
Return:
Gets the fee for making a request against an RNG service.
Return:
Gets Chainlink VRF subscription ID associated with this contract.
Return:
Gets Chainlink VRF coordinator contract address associated with this contract.
Return:
Checks if the request for randomness from the 3rd-party service has completed. For time-delayed requests, this function is used to check/confirm completion.
Parameters:
Return:
Gets a manager address that was granted exclusive access to specific functions with the modifier onlyManagerOrOwner.
Return:
Gets an owner address that was granted exclusive access to specific functions with the modifier onlyOwner
.
Return:
Gets an address that can claim the owner role. It is used to transfer the ownership.
Return:
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
_owner
address
An owner of the contract.
_vrfCoordinator
address
An address of the VRF Coordinator.
_subscriptionId
uint64
Chainlink VRF subscription ID.
_keyHash
bytes32
Hash of the public key used to verify the VRF proof.
_requestId
uint256
The ID initially returned by requestRandomWords
method.
_randomWords
uint256[]
The VRF output expanded to the requested number of words.
_numWords
uint32
An amount of random numbers to request.
_requestId
uint32
The ID of the request used to get the results of the RNG service.
_lockBlock
uint32
The block number at which the RNG service will start generating time-delayed randomness.
_keyHash
bytes32
Chainlink VRF key hash.
_newManager
address
A new manager address.
_subscriptionId
uint64
Chainlink VRF subscription ID.
_newOwner
address
An account that will become the _pendingOwner
.
_keyHash
bytes32
Chainlink VRF key hash.
_lastRequestId
uint32
The last request ID used in the last request.
_internalRequestId
uint32
The ID of the request used to get the results of the RNG service.
_randomNumbers
uint256[]
An array of random numbers.
_feeToken
address
The address of the token that is used to pay fees.
_fee
uint256
The fee required to be paid to make a request.
_subscriptionId
uint64
Chainlink VRF subscription ID.
_vrfCoordinator
address
Chainlink VRF coordinator address.
_internalRequestId
uint32
The ID of the request used to get the results of the RNG service.
_isRequestCompleted
bool
true
if the request has completed and a random number is available, false
otherwise.
_manager
address
A manager address.
_owner
address
An owner address.
_pendingOwner
address
A pending owner address.