# Get Action

The `getActions` function retrieves the details of a specified proposal by providing its unique proposal ID. This function allows governance participants and developers to inspect the actions of a given proposal, including:

1. The contract addresses that the proposal intends to call.
2. The values (ETH amounts) associated with each call.
3. The function signatures that define which contract functions will be executed.
4. The `calldata` payloads that encode function arguments for execution.

This function enables transparent governance by allowing any participant to review a proposal’s execution details before casting votes or executing the proposal.

#### Function Implementation in `CHNGovernance`

The `getActions()` function is implemented in the `CHNGovernance` contract to return a structured breakdown of the proposal's execution plan.

#### Function Signature

```
function getActions(uint proposalId)
    public
    view
    returns (
        address[] memory targets,
        uint[] memory values,
        string[] memory signatures,
        bytes[] memory calldatas
    )
```

#### Parameters

* `proposalId`: The unique identifier of the proposal whose actions need to be retrieved.
* `RETURN:`If the function call is successful, it returns the following arrays:&#x20;

1. `targets[]`: An array of contract addresses the proposal intends to interact with.
2. `values[]`: An array of unsigned integers specifying the ETH value associated with each action.
3. `signatures[]`: An array of function signatures that describe the functions to be executed.
4. `calldatas[]`: An array of calldata (encoded function arguments) that will be passed to each function call.

If the proposal ID is invalid, the function reverts with an error.

#### Example Solidity Implementation

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

{% code overflow="wrap" %}

```
CHNGovernance gov = CHNGovernance(0x123...); // Contract address of CHNGovernance
uint proposalId = 123;
(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) = gov.getActions(proposalId);
```

{% endcode %}

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

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

{% code overflow="wrap" %}

```javascript
const proposalId = 123;
const {0: targets, 1: values, 2: signatures, 3: calldatas} = await gov.methods.getActions(proposalId).call();
```

{% endcode %}

#### Technical Considerations

* The `getActions()` function is a view function, meaning it does not modify blockchain state and can be executed without incurring gas costs.
* This function is useful for off-chain governance interfaces, allowing participants to inspect proposals before voting.
* If a proposal ID is invalid, the function will revert, ensuring that only valid proposals are queried.
* Governance dashboards and analysis tools should utilize this function to display proposal details in an understandable format.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onyx.org/governance/get-action.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
