Skip to main content

IOrderLogic

IOrderLogic​

TakerOrder​

Information for creating a market order with a GTC or FOK semantics.

Parameters​

NameTypeDescription
struct TakerOrder {
struct OLKey olKey;
bool fillOrKill;
Tick tick;
uint256 fillVolume;
bool fillWants;
bool restingOrder;
uint256 expiryDate;
uint256 offerId;
uint256 restingOrderGasreq;
}

TakerOrderResult​

Result of an order from the takers side.

Parameters​

NameTypeDescription
struct TakerOrderResult {
uint256 takerGot;
uint256 takerGave;
uint256 bounty;
uint256 fee;
uint256 offerId;
bytes32 offerWriteData;
}

MangroveOrderStart​

event MangroveOrderStart(bytes32 olKeyHash, address taker, bool fillOrKill, Tick tick, uint256 fillVolume, bool fillWants, bool restingOrder, uint256 offerId)

Information about the order. By emitting this data, an indexer will be able to tell that we are in the context of an mangroveOrder and keep track of what parameters was use to start the order.

Parameters​

NameTypeDescription
olKeyHashbytes32the hash of the offer list key. This could be found by the OrderStart event, but is needed for RPC call. This is indexed so that RPC calls can filter on it.
takeraddressThe address of the taker. This could be found by the OrderStart event, but is needed for RPC call. This is indexed so that RPC calls can filter on it.
fillOrKillboolThe fillOrKill that take was called with
tickTickThe tick of the order. This is not needed for an indexer, as it can get it from the OrderStart event. It is only emitted for RPC calls.
fillVolumeuint256the volume to fill. This is not needed for an indexer, as it can get it from the OrderStart event. It is only emitted for RPC calls.
fillWantsboolif true (buying), the market order stops when fillVolume units of olKey.outbound_tkn have been obtained (fee included); otherwise (selling), the market order stops when fillVolume units of olKey.inbound_tkn have been sold.
restingOrderboolThe restingOrder boolean take was called with.
offerIduint256The optional offerId take was called with, 0 if not passed. This is not needed for an indexer. It is only emitted for RPC calls.

MangroveOrderComplete​

event MangroveOrderComplete()

Indicates that the MangroveOrder has been completed. We only emit this, so that an indexer can know that the order is completed and can thereby keep a correct context

SetExpiry​

event SetExpiry(bytes32 olKeyHash, uint256 offerId, uint256 date)

The expiry of the offer has been set By emitting this data, an indexer will be able to keep track of the expiry date of an offer.

Parameters​

NameTypeDescription
olKeyHashbytes32the hash of the offer list key. It is indexed so RPC call can filter on it.
offerIduint256the Mangrove offer id.
dateuint256in seconds since unix epoch

expiring​

function expiring(bytes32 olKeyHash, uint256 offerId) external returns (uint256)

Timestamp beyond which the given offerId should renege on trade.

Parameters​

NameTypeDescription
olKeyHashbytes32the hash of the offer list key.
offerIduint256The id of the offer to query for expiry for.

Return Values​

NameTypeDescription
[0]uint256res The timestamp beyond which offerId on the olKey offer list should renege on trade. 0 means no expiry.

setExpiry​

function setExpiry(bytes32 olKeyHash, uint256 offerId, uint256 date) external

Updates the expiry date for a specific offer.

If new date is in the past of the current block's timestamp, offer will renege on trade.

Parameters​

NameTypeDescription
olKeyHashbytes32the hash of the offer list key.
offerIduint256The offer id whose expiry date is to be set.
dateuint256in seconds since unix epoch

take​

function take(struct IOrderLogic.TakerOrder tko) external payable returns (struct IOrderLogic.TakerOrderResult res)

Implements "Fill or kill" or "Good till cancelled" orders on a given offer list.

Parameters​

NameTypeDescription
tkostruct IOrderLogic.TakerOrderthe arguments in memory of the taker order

Return Values​

NameTypeDescription
resstruct IOrderLogic.TakerOrderResultthe result of the taker order. If offerId==0, no resting order was posted on msg.sender's behalf.