> For the complete documentation index, see [llms.txt](https://docs.symm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.symm.io/exchange-builder-documentation/frontend-builder-technical-guidance/legacy-guides/multiaccount-legacy-guide.md).

# MultiAccount (Legacy Guide)

{% hint style="info" %}
MultiAccount has been replaced with the AccountLayer in the newest 0.8.5 contracts. Refer to [Account Layer Diamond](/contract-documentation/symmio-perps-v0.8.5/account-layer-diamond.md) and [Broken mention](broken://pages/JUhmUe9W3CGmYkpam5oA)for more info.
{% endhint %}

The MultiAccount contract is a critical component of the SYMM architecture that enables users to create dedicated sub‑accounts.&#x20;

MultiAccounts are contracts typically deployed by **frontend builders** that are whitelisted by hedgers. They enable users to create sub-accounts to trade with.&#x20;

These sub‑accounts are smart contracts **deployed via the MultiAccount contract**. By default, all positions within an account are considered for liquidation, each account is in CROSS. By using sub‑accounts, users can isolate risk by using separate sub‑accounts.

<figure><img src="https://1257875949-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYQhBmTCs9MwhhuPQrV5v%2Fuploads%2F0c7SVCSQEiWx5NF0FuxU%2FGroup%2047.png?alt=media&amp;token=9b5b8472-216d-4353-8136-fac2930a9852" alt=""><figcaption></figcaption></figure>

## Deploying a MultiAccount

Frontend Builders must deploy a MultiAccount and get whitelisted by SYMM. If you're a frontend looking to deploy a MultiAccount, please refer to this [guide](https://symmdocs.gitbook.io/multiaccount-deployment-guide/).

## MultiAccount Flow

### **How It Works:**

1. **Account Creation:**\
   Your wallet calls the MultiAccount contract and specifies which sub‑account to use for executing functions. When you create a sub‑account using `addAccount()`, a new contract is deployed using the current account implementation and linked to your wallet as the owner.
2. **Forwarding Calls:**\
   When you call the `_call()` function on MultiAccount, the call is forwarded to your sub‑account, which in turn sends the call to the SYMM Diamond. Since the Diamond’s logic operates based on the `msg.sender`, actions must originate from the sub‑account to correctly update storage and state.
3. **Parameter Encoding:**\
   All function calls are encoded using the SYMM Diamond’s ABI. This means you must encode the parameters for the desired function using the ABI, and pass that data to the `_call()` method. For example:

   ```javascript
   const encodedSendQuoteWithAffiliateData = web3.eth.abi.encodeFunctionCall(sendQuoteWithAffiliateFunctionAbi, sendQuoteParameters);
   const _callData = [ subAccountAddress, [ encodedSendQuoteData ] ];
   const sendQuoteWithAffiliateReceipt = await multiAccountContract.methods._call(..._callData).send({
     from: account.address,
     gas: adjustedGasLimit.toString(), 
     gasPrice: sendQuotePrice.toString() 
   });
   ```

{% hint style="info" %}
The MultiAccount contract address is also known as the affiliate address. The affiliate allows for automatic tracking and claiming of platform fees generated by a frontend.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.symm.io/exchange-builder-documentation/frontend-builder-technical-guidance/legacy-guides/multiaccount-legacy-guide.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
