# SaveToken Factory

The SaveTokenFactory creates new, unique SaveTokens for savers with that will wrap both asset and insurance tokens.

## `createSaveToken` <a href="#id-90aa" id="id-90aa"></a>

`createSaveToken` is the function called in order to create a new SaveToken

```javascript
function createSaveToken(
    address underlyingToken,
    address assetAdapter,
    address assetToken,
    address insuranceAdapter,
    address insuranceToken,
    address exchangeFactory,
    address farmerAddress,
    string memory name,
    string memory symbol,
    uint8 decimals
) public returns (address)
```

* **parameter:** `underlyingToken` The underlying token address
* **parameter:** `assetAdapter` The address of the Asset adapter to be used
* **parameter:** `assetToken` The address for the asset token
* **parameter:** `insuranceAdapter` The address of the Insurance adapter to be used
* **parameter:** `insuranceToken` The address for the insurance token
* **parameter:** `exchangeFactory` The address for the exchange factory
* **parameter:** `farmerAddress` The address for the SaveToken farmer
* **returns**: the address of the newly generated SaveToken contract
* **emits**: `SaveTokenCreated`, an event for indexing the address of the newly created SaveToken
* **outcome:** generates new SaveToken contract with a new asset and insurance token pairing

### How `createSaveToken` works

1. Accepts all arguments necessary to create a new SaveToken
2. Generates a new SaveToken contract with the attributes provided
3. Pushes the address of the new SaveToken to the `saveTokens` array for future reference


---

# 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.savedai.xyz/savetoken-factory.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.
