# Random Chainlink

## EeseeRandomChainlink

### ChainlinkContructorArgs

*Because of the Stack too deep error, we combine some constructor arguments into a single stuct*

```solidity
struct ChainlinkContructorArgs {
  address vrfCoordinator;
  bytes32 keyHash;
  uint16 minimumRequestConfirmations;
  uint32 callbackGasLimit;
}
```

### subscriptionID

```solidity
uint64 subscriptionID
```

*Chainlink VRF V2 subscription ID.*

### callbackGasLimit

```solidity
uint32 callbackGasLimit
```

*Chainlink VRF V2 gas limit to call fulfillRandomWords() with.*

### vrfCoordinator

```solidity
contract VRFCoordinatorV2Interface vrfCoordinator
```

*Chainlink VRF V2 coordinator.*

### ChangeCallbackGasLimit

```solidity
event ChangeCallbackGasLimit(uint32 previousCallbackGasLimit, uint32 newCallbackGasLimit)
```

### performUpkeep

```solidity
function performUpkeep(bytes) external
```

*Requests random from Chainlink. Emits {RequestRandom} event.*

### changeCallbackGasLimit

```solidity
function changeCallbackGasLimit(uint32 _callbackGasLimit) external
```

*Changes callbackGasLimit. Emits {ChangeCallbackGasLimit} event.*

#### Parameters

| Name                                                   | Type   | Description             |
| ------------------------------------------------------ | ------ | ----------------------- |
| \_callbackGasLimit                                     | uint32 | - New callbackGasLimit. |
| Note: This function can only be called by ADMIN\_ROLE. |        |                         |

### checkUpkeep

```solidity
function checkUpkeep(bytes) external view returns (bool upkeepNeeded, bytes)
```

*Called by Chainlink Keeper to determine if performUpkeep() needs to be called.*

## Inherited from VRFConsumerBaseV2

### rawFulfillRandomWords

```solidity
function rawFulfillRandomWords(uint256 requestId, uint256[] randomWords) external
```

## Inherited from EeseeRandomBase

### requestRandomImmediate

```solidity
function requestRandomImmediate() external
```

*Request random immediately, skipping canRequestRandom() check. Emits {RequestRandom} event. Note: This function can only be called by REQUEST\_RANDOM\_ROLE.*

### changeRandomRequestInterval

```solidity
function changeRandomRequestInterval(uint32 _randomRequestInterval) external
```

*Changes randomRequestInterval. Emits {ChangeRandomRequestInterval} event.*

#### Parameters

| Name                                                   | Type   | Description                  |
| ------------------------------------------------------ | ------ | ---------------------------- |
| \_randomRequestInterval                                | uint32 | - New randomRequestInterval. |
| Note: This function can only be called by ADMIN\_ROLE. |        |                              |

### getRandomFromTimestamp

```solidity
function getRandomFromTimestamp(uint256 _timestamp) external view returns (uint256 word, uint256 timestamp)
```

### canRequestRandom

```solidity
function canRequestRandom() public view virtual returns (bool randomNeeded)
```

*Check if random needs to be requested.*

### ChangeRandomRequestInterval

```solidity
event ChangeRandomRequestInterval(uint32 previousRandomRequestInterval, uint32 newRandomRequestInterval)
```

## Inherited from EeseeRoleHandler

## Inherited from IEeseeRandom

### random

```solidity
function random(uint256) external view returns (uint256 word, uint256 timestamp)
```

### lastRandomRequestTimestamp

```solidity
function lastRandomRequestTimestamp() external view returns (uint64)
```

### randomRequestInterval

```solidity
function randomRequestInterval() external view returns (uint32)
```

### MAX\_RANDOM\_REQUEST\_INTERVAL

```solidity
function MAX_RANDOM_REQUEST_INTERVAL() external view returns (uint48)
```

### FulfillRandom

```solidity
event FulfillRandom(uint256 random)
```

### RequestRandom

```solidity
event RequestRandom()
```
