Skip to main content

IOrderBookV1

IOrderBookV1

Simple order book specification for Domination Finance perpetual exchange.

Allows users to create/edit/cancel orders with single triggers. Once conditions are met for a user's order to be executed, an order bot will call executeOrder to change a position on their behalf.

Addresses

ChainAddress

Functions

getOrder

function getOrder(address, OrderNumber) external returns (struct IOrderBookDomain.Order)

domFiPerp

function domFiPerp() external view returns (contract IDomFiPerp)

collateralToken

function collateralToken() external view returns (contract IERC20)

minExecutionFee

function minExecutionFee() external view returns (uint256)

minTimeExecuteDelay

legacy: This OrderBook has no execution delay

function minTimeExecuteDelay() external view returns (uint64)

allowPublicKeeper

legacy: This OrderBook is permissionless

function allowPublicKeeper() external view returns (bool)

executeOrders

function executeOrders(
address[] _addresses,
OrderNumber[] _orderIndices,
address payable _feeReceiver
) external

cancelMultiple

function cancelMultiple(address payable _address, OrderNumber[] _orderIndices) external

createOrders

function createOrders(
struct IOrderBookDomain.OrderParams[] _orderParams,
struct IOrderBookV1.Signature _signature
) external payable

getFees

Get the trade fee that the sender would need to provide when creating this order, in addition to any margin that might be required.

function getFees(
struct IOrderBookDomain.OrderParams _orderParams,
address executor
) external view returns (
uint256 tradeFee,
uint256 executionFee
)

Parameters

NameTypeDescription
_orderParamsstruct IOrderBookDomain.OrderParamsOrder in question
executoraddressIgnored legacy parameter

Return Values

NameTypeDescription
tradeFeeuint256Expected trade fee (collateral token)
executionFeeuint256Expected execution fee (network tokens)

Types

Signature

a signature for use with EIP-2612

struct Signature {
uint256 amount;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}

IOrderBookErrors

Addresses

ChainAddress

Errors

ContractOnly

error ContractOnly()

AdminOnly

error AdminOnly()

OrderOwnerOnly

error OrderOwnerOnly()

ArrayLengthMismatch

error ArrayLengthMismatch()

ActionLengthMismatch

error ActionLengthMismatch()

OrderNumberUsed

error OrderNumberUsed(uint256 argIndex)

ExecutionFeeBelowMinimum

error ExecutionFeeBelowMinimum(uint256 argIndex)

ExecutionFeeInsufficient

error ExecutionFeeInsufficient(uint256 argIndex)

InsufficientCollateralSupplied

Execution of this order is guaranteed to fail unless you submit it with more collateral.

error InsufficientCollateralSupplied(uint256 collateralAtActionIndex, uint256 collateralRequiredByAction)

Parameters

NameTypeDescription
collateralAtActionIndexuint256collateral available to this action during execution
collateralRequiredByActionuint256collateral this action would need to succeed

PositionIdMissing

error PositionIdMissing()

ExpiredExecutionDeadline

error ExpiredExecutionDeadline()

IrrelevantTriggerDetails

error IrrelevantTriggerDetails()

MissingTriggerDetails

error MissingTriggerDetails()

MismatchedTriggerType

error MismatchedTriggerType()

InvalidTriggerType

error InvalidTriggerType()

OutOfCollateral

error OutOfCollateral()

IrrelevantActionDetails

error IrrelevantActionDetails()

MissingActionDetails

error MissingActionDetails()

ActionTypeMismatch

error ActionTypeMismatch()

InvalidActionSkipIf

error InvalidActionSkipIf()

UninitializedOrder

error UninitializedOrder()

UninitializedPosition

Attempted to decrease a position, or preview doing so, but the position did not exist.

error UninitializedPosition()

OrderCanceled

error OrderCanceled()

OrderExecuted

Order could not be canceled because it's already been executed

error OrderExecuted()

OrderExpired

error OrderExpired()

TriggerUnmet

error TriggerUnmet()

AddressUnset

error AddressUnset()

EmptyTriggers

error EmptyTriggers()

InvalidOrderNumber

error InvalidOrderNumber()

OrderUnexpired

error OrderUnexpired()

OrderNotFound

error OrderNotFound()

IOrderBookEvents

Addresses

ChainAddress

Events

CreateOrder

event CreateOrder(
address account,
OrderNumber orderNumber,
ProductId productId,
PositionLabel accountPositionId,
enum IOrderBookDomain.ActionType actionType,
struct IOrderBookDomain.Order order
)

CancelOrder

event CancelOrder(
address account,
OrderNumber orderNumber,
ProductId productId,
PositionLabel accountPositionId,
enum IOrderBookDomain.ActionType actionType,
struct IOrderBookDomain.Order order
)

UpdateOrder

event UpdateOrder(
address account,
OrderNumber orderNumber,
ProductId productId,
PositionLabel accountPositionId,
enum IOrderBookDomain.ActionType actionType,
struct IOrderBookDomain.Order prevOrder,
struct IOrderBookDomain.Order newOrder
)

ExecuteOrder

event ExecuteOrder(
address account,
OrderNumber orderNumber,
ProductId productId,
PositionLabel accountPositionId,
FPUnsigned executionPrice,
FPSigned currentPnL,
enum IOrderBookDomain.ActionType actionType,
struct IOrderBookDomain.Order order
)

Parameters

NameTypeDescription
accountaddress
orderNumberOrderNumber
productIdProductId
accountPositionIdPositionLabel
executionPriceFPUnsignedLegacy interface, left blank in impl
currentPnLFPSignedLegacy interface, left blank in impl
actionTypeenum IOrderBookDomain.ActionType
orderstruct IOrderBookDomain.Order

ExecuteOrderError

event ExecuteOrderError(address account, OrderNumber orderNumber, string executionError)

ExecuteOrderFailure

event ExecuteOrderFailure(address account, OrderNumber orderNumber, bytes lowLevelData)

CancelOrderError

event CancelOrderError(address owner, OrderNumber orderLabel, string executionError)

CancelOrderFailure

event CancelOrderFailure(address owner, OrderNumber orderLabel, bytes lowLevelData)

UpdateMinExecutionFee

event UpdateMinExecutionFee(uint256 minExecutionFee)