> 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/donationsstaking.md).

# DonationsStaking

The funds are periodically staked in the staking contract by calling the `stakeDonations`method.

### Events

#### DonationStaked

Emitted when donation is staked.

<table><thead><tr><th width="271.38606540841545">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>caller</td><td>The user who staked.</td></tr><tr><td>stakedDAI</td><td>The balance of the contract in DAI that was staked.</td></tr><tr><td>ethDonated</td><td>Amount of the donated native token.</td></tr><tr><td>daiDonated</td><td>Amount of the donated DAI.</td></tr></tbody></table>

```
event DonationStaked(
    address caller,
    uint256 stakedDAI,
    uint256 ethDonated,
    uint256 daiDonated
);
```

The funds are periodically staked in the GoodStaking contract by calling the `stakeDonations`method.

### stakeDonations

Stake all available funds on the contract. It take balance in native token and buy DAI from Uniswap then stake outstanding DAI balance.

<table><thead><tr><th width="301.8711599216471">Parameter name</th><th>Annotation</th></tr></thead><tbody><tr><td>_minDAIAmount</td><td>Enforce expected return from Uniswap when converting native token balance to DAI.</td></tr></tbody></table>

```
function stakeDonations(uint256 _minDAIAmount) public payable;
```

### totalStaked

Total DAI value staked. Returns: DAI value staked.

```
function totalStaked() 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/donationsstaking.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.
