Position Vault

This contract is a position vault that manages positions and orders for a trading system. It allows users to open and close positions, execute orders, and manage collateral.

Initialize

This function initializes the contract with the operators, vlp, and vusd addresses.

function initialize(address _operators, address _vlp, address _vusd) public {
    __ReentrancyGuard_init();
    operators = IOperators(_operators);
    vlp = IVLP(_vlp);
    vusd = IVUSD(_vusd);
}

NewPositionOrder

This function allows the vault to create a new position order.

function newPositionOrder(
    address _account,
    uint256 _tokenId,
    bool _isLong,
    OrderType _orderType,
    uint256[] memory _params,
    address _refer
)

AddOrRemoveCollateral

This function allows the vault to add or remove collateral from a position.

CreateAddPositionOrder

This function allows the vault to create an order to add to a position.

CreateDecreasePositionOrder

This function allows the vault to create an order to decrease a position.

SelfExecuteDecreasePositionOrder

This function allows users to self-execute a decrease position order after the selfExecuteCooldown period has passed.

ExecuteRemoveCollateral

This function allows the vault to execute the removal of collateral from a position.

ExecuteOpenMarketOrder

This function allows the vault to execute an open market order.

ExecuteAddPositionOrder

This function allows the vault to execute an add position order.

ExecuteDecreasePositionOrder

This function allows the vault to execute a decrease position order.

ExecuteOrders

This function allows the vault to execute a batch of orders also this function executes a batch of orders. The numOfOrders parameter specifies the number of orders to execute. The onlyOperator(1) modifier ensures that only an operator with level 1 can call this function.

IncreasePosition

This function is called by the Order Vault contract to increase a position.

DecreasePosition

This function is called by the Vault contract to decrease a position.

DecreasePositionByOrderVault

This function is called by the Order Vault contract to decrease a position.

Last updated