> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aultblockchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Precompile: Governance

## Address

`0x0000000000000000000000000000000000000805`

## Supported Methods

### Transactions

| Signature                                     |
| --------------------------------------------- |
| `cancelProposal(address,uint64)`              |
| `deposit(address,uint64,tuple[])`             |
| `submitProposal(address,bytes,tuple[])`       |
| `vote(address,uint64,uint8,string)`           |
| `voteWeighted(address,uint64,tuple[],string)` |

### Queries

| Signature                                    |
| -------------------------------------------- |
| `getConstitution()`                          |
| `getDeposit(uint64,address)`                 |
| `getDeposits(uint64,tuple)`                  |
| `getParams()`                                |
| `getProposal(uint64)`                        |
| `getProposals(uint32,address,address,tuple)` |
| `getTallyResult(uint64)`                     |
| `getVote(uint64,address)`                    |
| `getVotes(uint64,tuple)`                     |

## Query Examples

Set the current testnet EVM JSON-RPC endpoint and precompile address:

> Security note:
> Use a keystore or hardware wallet for real operations.
> Do not pass raw private keys directly in shell commands.

```bash theme={null}
export RPC_URL="https://test-json-rpc.cloud.aultblockchain.xyz"
export GOV_PRECOMPILE="0x0000000000000000000000000000000000000805"
```

### Direct call

```bash theme={null}
cast call "$GOV_PRECOMPILE" \
  "getProposals(uint32,address,address,(bytes,uint64,uint64,bool,bool))(((uint64,string[],uint32,(string,string,string,string),uint64,uint64,(string,uint256)[],uint64,uint64,string,string,string,address)[]),(bytes,uint64))" \
  "0" \
  "0x0000000000000000000000000000000000000000" \
  "0x0000000000000000000000000000000000000000" \
  "(0x,0,20,false,false)" \
  --rpc-url "$RPC_URL"
```

### Call from contract

```solidity theme={null}
address constant GOV = 0x0000000000000000000000000000000000000805;

struct PageRequest {
    bytes key;
    uint64 offset;
    uint64 limit;
    bool countTotal;
    bool reverse;
}

function queryGovProposals() external view returns (bytes memory) {
    PageRequest memory page = PageRequest("", 0, 20, false, false);
    (bool ok, bytes memory out) = GOV.staticcall(
        abi.encodeWithSignature(
            "getProposals(uint32,address,address,(bytes,uint64,uint64,bool,bool))",
            uint32(0),
            address(0),
            address(0),
            page
        )
    );
    require(ok, "precompile call failed");
    return out;
}
```

## Transaction Examples

### Environment Variables

```bash theme={null}
cast wallet import ault-ops --interactive

export CAST_ACCOUNT="ault-ops"
export FROM="$(cast wallet address --account "$CAST_ACCOUNT")"
export PROPOSAL_ID="<proposal_id_uint64>"
export VOTE_OPTION="1"
export VOTE_METADATA=""
```

### Direct call

```bash theme={null}
cast send "$GOV_PRECOMPILE" \
  "vote(address,uint64,uint8,string)" \
  "$FROM" \
  "$PROPOSAL_ID" \
  "$VOTE_OPTION" \
  "$VOTE_METADATA" \
  --rpc-url "$RPC_URL" \
  --account "$CAST_ACCOUNT"
```

### Call from contract

```solidity theme={null}
address constant GOV = 0x0000000000000000000000000000000000000805;

function txGovVote(
    uint64 proposalId,
    uint8 option,
    string calldata metadata
) external returns (bool) {
    (bool ok, bytes memory out) = GOV.call(
        abi.encodeWithSignature(
            "vote(address,uint64,uint8,string)",
            msg.sender,
            proposalId,
            option,
            metadata
        )
    );
    require(ok, "precompile call failed");
    return abi.decode(out, (bool));
}
```

## Notes

* `VOTE_OPTION` values are `1:Yes`, `2:Abstain`, `3:No`, and `4:NoWithVeto`.
* Proposal payload and coin tuples are ABI-encoded structures.

## ABI

<a href="/assets/abi/governance_precompile_abi.json" download>
  Download Governance ABI JSON
</a>
