IEngine
This interface defines the functions that can be called on the Engine contract. These functions provide various operations related to market orders, limit orders, market prices, and adding new trading pairs.
Functions
mktPrice
mktPrice
Retrieves the market price of the specified trading pair.
Parameters
base
address
The address of the base asset in the trading pair.
quote
address
The address of the quote asset in the trading pair.
Returns
mktPrice
uint256
The market price of the trading pair.
getOrderbook
getOrderbook
Retrieves the address of the order book corresponding to the specified bookId
.
Parameters
bookId
uint256
The ID of the order book.
Returns
orderbook
address
The address of the order book.
marketBuy
marketBuy
Executes a market buy order for the specified trading pair and amount.
Parameters
base
address
The address of the base asset in the pair.
quote
address
The address of the quote asset in the pair.
amount
uint256
The amount of the base asset to buy.
marketSell
marketSell
Executes a market sell order for the specified trading pair and amount.
Parameters
base
address
The address of the base asset in the trading pair.
quote
address
The address of the quote asset in the trading pair.
amount
uint256
The amount of the base asset to sell.
limitBuy
limitBuy
Places a limit buy order for the specified trading pair, amount, and price.
Parameters
base
address
The address of the base asset in the trading pair.
quote
address
The address of the quote asset in the trading pair.
amount
uint256
The amount of the base asset to buy.
price
uint256
The price at which to buy the base asset.
limitSell
limitSell
Places a limit sell order for the specified trading pair, amount, and price.
Parameters
base
address
The address of the base asset in the trading pair.
quote
address
The address of the quote asset in the trading pair.
amount
uint256
The amount of the base asset to buy.
price
uint256
The price at which to buy the base asset.
addPair
addPair
Adds a new trading pair to the engine and returns the address of the corresponding order book.
Parameters
base
address
The address of the base asset in the trading pair.
quote
address
The address of the quote asset in the trading pair.
Returns
book
address
The address of the created order book.
Last updated