1 - Margin Account

users need to create this margin account before opening trades

Create Margin Account

IVXMarginManager => function createMarginAccount() external returns(IIVXPortfolio)

User needs to interact with this function to create his margin account, otherwise trades cannot be open.

This will return an address for the contract created to use for the user's margin assets and portfolio of trades.

We called that contract IVXPortfolio, in which we store all the users trades, and assets used for collateralizing said trades.

Adding assets to Portfolio to increase Margin

 IVXPortfolio => function increaseMargin(address _asset, uint256 _amount) external

User will then need to approve the Portfolio contract and call this function to add funds to his account.

Only assets supported can be deposited, and those are given by :

IVXMarginManager => function getSupportedAssets() view returns (address[] memory)

Removing assets from Portfolio

 function decreaseMargin(address[] calldata _assets, uint256[] calldata _amounts) external

This function allows the user to remove any of his margin assets and any amount, as long as he owns the portfolio and that does not make him liquidatable, more on that here.

Last updated