limitBuy

limitBuy

function limitBuy(
        address base,
        address quote,
        uint256 price,
        uint256 quoteAmount,
        bool isMaker,
        uint32 n,
        address recipient
) external returns (uint256 makePrice, uint256 placed, uint32 id);
Executes a limit buy order,
matches ask orders in the orderbook for buying the base asset using the quote asset at a specified limit price,
and makes an order at the limit price with remainder amount.

Parameters

NameTypeDescription

base

address

Address of the base asset for the trading pair.

quote

address

Address of the quote asset for the trading pair.

price

uint256

Limit price in 8 decimals

quoteAmount

uint256

The amount of quote asset to be used for the limit buy order.

isMaker

bool

Boolean indicating if an order should be made at the market price in the orderbook.

n

uint32

The maximum number of orders to match in the orderbook.

recipient

address

Address of recipient to receive funds from trading and ownership of placed order.

Returns

  • uint256 makePrice : Price which was placed after matching

  • uint256 placed : Remainder mount which is placed in order after matching

  • uint32 id: Placed orderId after matching orders. The id is then used for canceling order.

Last updated