> For the complete documentation index, see [llms.txt](https://mars-protocol.gitbook.io/mars-protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mars-protocol.gitbook.io/mars-protocol/contracts-core/safety-fund.md).

# Safety Fund

The Safety Fund contract receives protocol fees that are kept in order to be spent in case of a shortfall event.

## Links

* package (msgs and types): <https://github.com/mars-protocol/mars-core/blob/master/packages/mars-core/src/safety_fund.rs>
* contract:  <https://github.com/mars-protocol/mars-core/blob/master/contracts/mars-safety-fund/src/contract.rs>
* schema: <https://github.com/mars-protocol/mars-core/tree/master/contracts/mars-safety-fund/schema>

## Config

| Key     | Type          | Description                                      |
| ------- | ------------- | ------------------------------------------------ |
| `owner` | CanonicalAddr | Address of contract owner that can update config |

## InstantiateMsg

{% tabs %}
{% tab title="Rust" %}

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub owner: String
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
  "owner": "terra..."
}
```

{% endtab %}
{% endtabs %}

| Key     | Type   | Description                                      |
| ------- | ------ | ------------------------------------------------ |
| `owner` | String | Address of contract owner that can update config |

## ExecuteMsg

### `UpdateConfig`

Update contract config (only callable by owner).

{% tabs %}
{% tab title="Rust" %}

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateConfig {
        owner: Option<String>
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
  "update_config": {
    "owner": "terra..."
  }
}
```

{% endtab %}
{% endtabs %}

| Key       | Type   | Description                                      |
| --------- | ------ | ------------------------------------------------ |
| `owner`\* | String | Address of contract owner that can update config |

\* = optional

### `ExecuteCosmosMsg`

Execute Cosmos msg.

{% tabs %}
{% tab title="Rust" %}

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    ExecuteCosmosMsg(CosmosMsg)
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
  "execute_cosmos_msg": 
}
```

{% endtab %}
{% endtabs %}

## QueryMsg

### `Config`

Get contract config.

{% tabs %}
{% tab title="Rust" %}

```rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMs {
    Config {}
}
```

{% endtab %}

{% tab title="JSON" %}

```json
 {
  "config": {}
}
```

{% endtab %}
{% endtabs %}
