> For the complete documentation index, see [llms.txt](https://docs.gooddollar.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gooddollar.org/previous-protocol-versions/protocol-v3/core-contracts-and-api/governancestaking.md).

# GovernanceStaking

### Events

#### ReputationEarned

Emitted when `staker` earns an `amount` of GOOD tokens.

<table><thead><tr><th width="389.63805195347794">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>staker</td><td>The staker address who earned reputation.</td></tr><tr><td>amount</td><td>The amount of reputation.</td></tr></tbody></table>

```
event ReputationEarned(address indexed staker, uint256 amount);
```

#### Staked

Emitted when `staker` stakes an `amount` of GoodDollars.

<table><thead><tr><th width="389.63805195347794">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>staker</td><td>The staker address who earned reputation.</td></tr><tr><td>amount</td><td>The amount of stake.</td></tr></tbody></table>

```
event Staked(address indexed staker, uint256 amount);
```

#### StakeWithdraw

Emitted when `staker` withdraws an `amount` of staked GoodDollars.

<table><thead><tr><th width="389.63805195347794">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>staker</td><td>The staker address who earned reputation.</td></tr><tr><td>amount</td><td>The amount of stake.</td></tr></tbody></table>

```
event StakeWithdraw(address indexed staker, uint256 amount);
```

### stake

The function allows a staker to deposit Tokens. Notice that `approve` is needed to be executed before the execution of this method.

<table><thead><tr><th width="150">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>_amount</td><td>The amount of G$ to stake.</td></tr></tbody></table>

Can be executed only when the contract is not paused.

```
function stake(uint256 _amount) external;
```

### withdrawStake

The function withdraws the senders staked G$.

<table><thead><tr><th width="150">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>_amount</td><td>The amount of G$ to withdraw.</td></tr></tbody></table>

Can be executed only when the contract is not paused.

```
function withdrawStake(uint256 _amount) external;
```

### withdrawRewards

The function allows staker to withdraw their rewards without withdraw their stake.

Returns: amount of rewards that were sent to the `msg.sender`.

```
function withdrawRewards() public returns (uint256);
```

### getUserPendingReward

The function allows to acquire the number of G$ rewards for a specific `_user`.

<table><thead><tr><th width="150">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>_user</td><td>User to check the pending rewards.</td></tr></tbody></table>

Returns: an amount of G$ rewards for the user.

```
function getUserPendingReward(address _user) public view returns (uint256);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.gooddollar.org/previous-protocol-versions/protocol-v3/core-contracts-and-api/governancestaking.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.
