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

Retrieves the market price of the specified trading pair.

Parameters

NameTypeDescription

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

NameTypeDescription

mktPrice

uint256

The market price of the trading pair.

getOrderbook

Retrieves the address of the order book corresponding to the specified bookId.

Parameters

NameTypeDescription

bookId

uint256

The ID of the order book.

Returns

NameTypeDescription

orderbook

address

The address of the order book.

marketBuy

Executes a market buy order for the specified trading pair and amount.

Parameters

NameTypeDescription

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

Executes a market sell order for the specified trading pair and amount.

Parameters

NameTypeDescription

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

Places a limit buy order for the specified trading pair, amount, and price.

Parameters

NameTypeDescription

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

Places a limit sell order for the specified trading pair, amount, and price.

Parameters

NameTypeDescription

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

Adds a new trading pair to the engine and returns the address of the corresponding order book.

Parameters

NameTypeDescription

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

NameTypeDescription

book

address

The address of the created order book.

Last updated