> For the complete documentation index, see [llms.txt](https://docs.dexe.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dexe.network/guides/interacting-with-dao/deposit-withdraw.md).

# Deposit/Withdraw

The initial step to interact with the DAO involves depositing your assets. Initially, you must grant approval for the transfer of your funds by the `GovUserKeeper` contract. For simplicity, all funds are approved for transfer. Subsequently, the deposit method on `GovPool` is invoked, crediting your funds to the internal personal balance, thereby enabling you to utilize them within the DAO.

:warning: *All token amounts related inputs and outputs are expected to be in 18 decimals, regardless of the actual token's decimals.*

```solidity
function deposit(IGovPool govPool) external {
    (, address govUserKeeperAddress, , , ) = govPool.getHelperContracts();
    IGovUserKeeper govUserKeeper = IGovUserKeeper(govUserKeeperAddress);

    IERC20(govUserKeeper.tokenAddress()).approve(govUserKeeperAddress, type(uint256).max);
    IERC721(govUserKeeper.nftAddress()).setApprovalForAll(govUserKeeperAddress, true);

    uint256 amount = 10 ether;
    uint256[] memory nftIds = new uint256[](3);
    nftIds[0] = 1;
    nftIds[1] = 2;
    nftIds[3] = 3;

    govPool.deposit(amount, nftIds);
}
```

:warning: *Both `tokenAddress` and `nftAddress` can possibly be zero.*

To refund your assets, you can simply call the reverse `withdraw` method, passing the receiver as the first parameter. You can only withdraw assets that aren't locked in proposals or delegated to anyone. To withdraw such funds, you must first cancel your vote or undelegate, respectively

```solidity
    function withdraw(IGovPool govPool) external {
        (uint256 amount, uint256[] memory nftIds) = govPool.getWithdrawableAssets(address(this));

        govPool.withdraw(address(this), amount, nftIds);
    }
```

:warning: Deposits and withdrawals cannot be made within the same block (via multicall). This is done to prevent possible flashloan attacks.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.dexe.network/guides/interacting-with-dao/deposit-withdraw.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
