# Vault operation via Gnosis Safe

**This guide is specifically for Vaults where the owner of the vault is a Gnosis Safe.** All other owners i.e. Metamask wallets, hardware wallets, or governance, will look very similar to this guide but will have differences in composing the transactions to execute.

## Overview

There are 4 main actions you can take now that your Aera vault is live.

* Withdrawal
* Pause the vault
* Deposit more funds
* Finalization

Almost all steps below will rely on you constructing transactions from your Gnosis Safe, and then submitting a tx batch from your gnosis safe to the Aera vault.&#x20;

Full documentation for the Aera protocol can be found at [docs.aera.finance](https://docs.aera.finance)

For all the below actions use the transaction builder in Gnosis Safe.

First in Gnosis Safe, click this link:

<figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FWAC2gWy3DgVqOJ2A7xgX%2FScreenshot%202023-07-19%20at%205.39.37%20PM.png?alt=media&#x26;token=74a70b1f-eef4-496b-8507-98a2e35223a2" alt=""><figcaption></figcaption></figure>

Then use the transaction builder given the guidance in each section below:

<figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FWblxhoelaZNmG7ESInru%2FScreenshot%202023-12-03%20at%2011.52.17%20AM.png?alt=media&#x26;token=bb522a11-0204-443e-b8f8-a57a64b691bc" alt=""><figcaption></figcaption></figure>

The high-level flow will be:

1. Fetch the address of your vault
   1. This can be grabbed from the URL on the app. i.e. The Vault address for <https://app.aera.finance/1/vault/v2/0x9ecf0d8dcc0076dd153749bece0762acae1c9049> is [0x9ecf0d8dcc0076dd153749bece0762acae1c9049](https://etherscan.io/address/0x9ecf0d8dcc0076dd153749bece0762acae1c9049)

2. Construct the transaction from the Gnosis Safe that is the owner of the Aera vault using your vault address and the Transaction builder based on the action you want to take
   1\.

   ```
   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FCOoLgNSmAHz6zH5vR11i%2FScreenshot%202023-12-03%20at%2012.03.55%20PM.png?alt=media&#x26;token=8dd468a6-0b71-4051-8a36-2169d0963e7b" alt=""><figcaption><p>The ABI will automatically populate from your vault address</p></figcaption></figure>
   ```

   2\.

   ```
   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FT2P0Zincm3lKMKDc2SGG%2FScreenshot%202023-12-03%20at%2012.05.50%20PM.png?alt=media&#x26;token=485c518b-7e13-4217-85a1-b6c6efe7407b" alt=""><figcaption><p>Select the relevant Contract method based on the action you are taking and hit Add Transaction</p></figcaption></figure>
   ```

   3\. Repeat the above step till you have added all relevant contract methods for the action you are taking

3. Click Create Batch in Transaction builder
   1\.

   ```
   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FqdvmZ68tNS0KDkfeH3mH%2FScreenshot%202023-12-03%20at%2012.10.00%20PM.png?alt=media&#x26;token=57d9b000-d722-442f-b912-3ace90d24b2d" alt=""><figcaption><p>Once you have all the actions together hit Create Batch</p></figcaption></figure>
   ```

4. Click Simulate to validate that everything works as intended
   1\.

   ```
   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FpirN8d5NUmI4rcuceTtv%2FScreenshot%202023-12-03%20at%2012.10.32%20PM.png?alt=media&#x26;token=8c93b371-ee28-48a6-8ae6-12ef8b2b1c51" alt=""><figcaption><p>Review the Results by clicking the 'on Tenderly' link</p></figcaption></figure>
   ```

5. Send Batch then coordinate signers

## Withdrawal

This will allow you to withdraw funds from the vault and allow the vault to keep operating.

#### **Steps**

1. Add `pause` to the transaction batch
   1. This is not strictly required but adds safety in the case that you wish to change the vault objectives
2. Figure out addresses and max amounts by querying `holdings` in the Read Contract on Etherscan (example [holdings call](https://etherscan.io/address/0x9ecf0d8dcc0076dd153749bece0762acae1c9049#readContract#F8), please do this on your own vault)&#x20;

   * This will give you a tuple with the max amount of each token you can withdraw. It will look similar to this:

   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FaUoJCJmJXOM19sTFkrm3%2FScreenshot%202023-12-03%20at%2012.19.34%20PM.png?alt=media&#x26;token=5d4a3e35-c5f4-49f1-a2b6-f73515babade" alt=""><figcaption><p>holdings tuple</p></figcaption></figure>

   **Note that the withdrawal amount must be less than the full holdings of the vault**
3. Add `withdraw` to the transaction batch using the tuple from above but editing the values to be the amounts you wish to withdraw.&#x20;
   * **Note that the amounts are all decimal based and you need to add the amounts with the correct amount of decimals for each asset**. As an example `wstETH` on mainnet has 18 decimals, so an amount in the tuple of `43757964133048721408` is actually `43.757... wstETH`, `USDC` on mainnet has only 6 decimals.  Please ensure you input the correct amount for a given assets decimals
   * You will need to put each element in quotes and delimit inner tuples with commas, as an example building on the above screenshot:&#x20;
     * ![](https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FJnxrkCv4GnDMShjcedhD%2FScreenshot%202023-12-03%20at%2012.52.56%20PM.png?alt=media\&token=b9994728-d28f-4128-9904-80e5a23ef37c)
4.

```
<figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FejNNEsDvIRhGgzqFyqj2%2FScreenshot%202023-12-03%20at%2012.42.58%20PM.png?alt=media&#x26;token=450d5f81-5cda-4ef2-95fb-2c33bfac636e" alt=""><figcaption></figcaption></figure>
```

## Pause the vault

This action prevents trading from occurring in the vault. This has the following effects:

1. Guardian will no longer be able to send operations on the vault for execution, vault will now have the exact token amount as per when the vault was paused

Pausing the vault is used as part of the withdraw flow, and also can be used in emergency scenarios (i.e. a USDC depeg scenario).

#### Steps

1. Call and execute pause in the transaction builder
   1\.

   ```
   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FVrqmWO36Ytf71eTe757Y%2FScreenshot%202023-12-03%20at%2012.47.06%20PM.png?alt=media&#x26;token=ab4135bb-e370-4ee7-85ff-1739417747fd" alt=""><figcaption><p>Add Pause then click Create Batch</p></figcaption></figure>
   ```

## Deposit more funds

This allows you to increase your allocation to the vault. Please reach out to your Guardian if you need assistance.

> Please do not directly send funds to the vault and instead use the instructions here to deposit more funds into the vault

> Please reach out to your guardian to make sure they are aware of the incoming deposit and can adjust strategies as necessary to accommodate

#### Steps

1. Call and execute `deposit` on the vault with the right `amounts` tuple

   1. This is very similar to setting up the withdrawal tuple. In particular you will need to structure a tuple like the withdrawal tuple: `[["token_address1", "decimal_amount1"], ["token_address2", "decimal_amount2"]...]`
   2. The assets and amounts you choose must be available in the Owner Gnosis Safe that this transaction will be executed from
   3. Only assets already in the Asset registry can be allowed into the vault (see [Managing the asset registry](https://docs.aera.finance/v2-archive/guides/treasury/managing-the-asset-registry) )
   4.

   ```
   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2FENvpibkDBtIFRcLWfO5Y%2FScreenshot%202023-12-03%20at%2012.54.02%20PM.png?alt=media&#x26;token=97a400e5-64c0-49db-8bbf-0e2edd53e777" alt=""><figcaption></figcaption></figure>
   ```

## Finalization

This will permanently shut down the vault and fully return funds back to the Owner multisig.

> 🔌 Note that doing this will terminate the vault, subsequent deposits will need another vault to be spun up. If you wish to keep using this vault see the steps for Withdrawal.

#### **Steps**

1. Call and execute `finalize` by selecting it from the Contract Method Selector
   \*

   ```
   <figure><img src="https://1454348694-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAXweUiymNuYupkbgnMkB%2Fuploads%2Fu88DqnOThXWWVXwpp2sd%2FScreenshot%202023-12-03%20at%2012.02.06%20PM.png?alt=media&#x26;token=3e57a01c-be98-4794-97f9-f1a4bd57f611" alt=""><figcaption></figcaption></figure>
   ```
