# 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: 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.dexe.network/guides/interacting-with-dao/deposit-withdraw.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.
