# vote

An entrypoint that executes [voting](/smart-contracts/dex-2.0/bucket-contract/entrypoints-overview/vote.md) for bakers on the specified [Bucket](/smart-contracts/dex-2.0/bucket-contract.md) contract. Also, it updates users' global rewards and the rewards of the user who votes. Voting is possible only in TOK/TEZ liquidity pools (pairs).

### Call parameters

```pascaligo
type token_id_t         is nat

type dex_vote_t         is [@layout:comb] record [
  pair_id                 : token_id_t;
  candidate               : key_hash;
]
```

<table><thead><tr><th width="150">Field</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td>pair_id</td><td>token_id_t (nat)</td><td>Identifier of the liquidity pool (pair)</td></tr><tr><td>candidate</td><td>key_hash</td><td>Baker the user votes for</td></tr></tbody></table>

### Usage

{% tabs %}
{% tab title="🌮 Taquito" %}

```javascript
const dexCoreAddress = "KT1...";
const parmas = {
    pair_id: 0,
    candidate: "tz1...",
};
const dexCore = await tezos.contract.at(dexCoreAddress);
const operation = await dexCore.methodsObject.vote(parmas).send();

await operation.confirmation();
```

{% endtab %}
{% endtabs %}

### Errors

* `108` - pair (pool) with the specified `token_id` not listed.
* `113` - a [Bucket](/smart-contracts/dex-2.0/bucket-contract.md) contract not found (not TOK/TEZ LP pair).
* `136` - reentrancy.
* `140` - can't perform voting because of zero LPs balance of the user.
* `412` - non payable entrypoint (can't accept TEZ tokens during call of an entrypoint).


---

# 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.quipuswap.com/smart-contracts/dex-2.0/dexcore-contract/entrypoints-overview/dex-entrypoints/vote.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.
