# Queue

The queue function is responsible for moving a successful proposal into the Onyx Timelock queue. Once a proposal has been approved by the governance process, it must be queued before it can be executed. Only proposals that have met the required voting threshold and have been successfully passed can be queued.

#### Function Implementation in `CHNGovernance`

In the `CHNGovernance` contract, the `queue()` function ensures that only validated proposals are added to the Timelock queue, preventing unauthorized executions.

#### Function Signature

```
function queue(uint proposalId) public
```

#### Parameters

* `proposalId`: The unique identifier of the governance proposal that has been successfully approved and is eligible to be queued.
* `RETURN`: The function does not return a value. If the proposal is invalid or not yet approved, it will revert with an error.

#### Example Solidity Implementation

To queue a proposal using Solidity, the `queue()`function can be called from an instance of the `CHNGovernance` contract:

```
CHNGovernance gov = CHNGovernance(0x123...); // Contract address of CHNGovernance
gov.queue(proposalId);
```

#### Web3.js Implementation (v1.2.6)

For interacting with the `CHNGovernance` contract using Web3.js, the following example demonstrates how to queue a proposal:

```javascript
const tx = await gov.methods.queue(proposalId).send({ from: sender });
```

#### Technical Considerations

* The `queue()` function is state-modifying and will incur gas costs.
* A proposal must have succeeded in the voting phase before it can be queued.
* Once queued, the proposal must wait for the Timelock period before execution can occur.
* The Timelock contract ensures security and decentralization by preventing immediate execution after voting.
* If an attempt is made to queue a proposal that has not succeeded, the transaction will revert with an error.

<br>
