> For the complete documentation index, see [llms.txt](https://sharwa.gitbook.io/sharwa-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sharwa.gitbook.io/sharwa-docs/for-devs/margin-account/core-contracts/marginaccountmanager.sol.md).

# MarginAccountManager.sol

This contract is responsible for creating margin accounts.

## How to Create a Margin Account

```solidity
    function createMarginAccount() external returns (uint marginAccountID) {
        marginAccountID = nextTokenID;
        _safeMint(msg.sender, marginAccountID);
        nextTokenID++;

        emit CreateMarginAccount(marginAccountID);
    }
```

<br>
