MarginOrderBookMarket
Inherits: OrderBookMarket
Extends OrderBookMarket to support margin trading.
State Variables
shareRegistry
ShareClass public shareRegistry;
marginAccounts
mapping(address => MarginAccount) public marginAccounts;
Functions
constructor
constructor(address _listingRegistry, address _brokerNetSettlement, address _directSettlement, address _shareRegistry)
OrderBookMarket(_listingRegistry, _brokerNetSettlement, _directSettlement);
createMarginAccount
Creates a margin account for a user.
function createMarginAccount(address user, address collateral, uint256 collateralFactor) external;
Parameters
Name
Type
Description
user
address
The address of the user.
collateral
address
The address of the collateral contract.
collateralFactor
uint256
The collateral factor (e.g., 150 for 150%).
executeMarginTrade
Example function to execute a trade with margin.
function executeMarginTrade(bytes32 listingId, uint96 tradeQuantity) external payable;
Parameters
Name
Type
Description
listingId
bytes32
The ID of the listing.
tradeQuantity
uint96
The quantity to trade.
Events
MarginAccountCreated
event MarginAccountCreated(address indexed user, address marginAccount);
Last updated
Was this helpful?