Account

Create Account

When a user creates an account on Aftermath Perpetuals, an Account object is transferred to the user's address. This object can be used to open a position in any of the available markets. The Account object identifies the positions in the markets and can be freely transferred to another Sui address by the user. Losing access of the Account object means permanently losing access to the markets' positions. It is possible to have multiple Account objects in the same address.

Deposit Collateral

A user can deposit collateral into the account at any time. The deposited collateral remains in the account until the user decides to allocate it to a market to open a position. When this happens, the collateral is withdrawn from the account and deposited into the market's vault to be used as margin for the position.

Withdraw Collateral

A user can withdraw all the non-allocated collateral from the account at any time. Before withdrawing the collateral allocated in the markets, the user needs to deallocate it. Deallocating collateral is limited by the status of the position. The formula to calculate the position's (p) free collateral:

FreeCollateral(p)=CappedMargin(p)MarginRequirements(p)CollateralPriceCappedMargin(p)=Collateral(p)CollateralPrice+UnrealizedFundings(p)+min{Pnl(p),0}{\small \begin{align*} \small & FreeCollateral(p) = \frac{CappedMargin(p) - MarginRequirements(p)}{CollateralPrice} \\\\ &CappedMargin(p) = Collateral(p) \cdot CollateralPrice + UnrealizedFundings(p) + \min\{Pnl(p), 0\} \end{align*} }%

Subaccounts

Subaccounts allow users to access the same position in a market by multiple Sui addresses. This mechanism is useful for internal management for more sophisticated traders or market makers. After creating an account, it is possible to create as many subaccounts as desired and set another Sui address as the "operator" of the subaccount. All the subaccounts have access to the parent account's positions in all the markets. Such address will be able to:

  • Deposit collateral into the subaccount and allocate it to all the available markets

  • Place market and limit orders

  • Cancel pending orders

  • Liquidate other users' positions

  • Deallocate collateral from a market back into the subaccount

The only limitation for the subaccount's operator regards withdrawals. While it is possible to deallocate collateral from one market's position and move it to another, it is not possible to withdraw a Coin from the subaccount and transfer it to a Sui address. This operation can only be performed by the owner of the parent account. The owner of the parent account is always able to:

  • Withdraw the deposited collateral from the subaccount at any moment.

  • Change the subaccount's operator address at any moment. This allows the parent account to take back ownership of the subaccount if needed.

  • Delete a subaccount at any moment, given that all the deposited collateral has been previously withdrawn.

Last updated