Skip to main content

IHooks

IHooks

Interface for the hooks contract

beforeOpen

function beforeOpen(address sender, struct IBookManager.BookKey key, bytes hookData) external returns (bytes4)

Hook called before opening a new book

Parameters

NameTypeDescription
senderaddressThe sender of the open transaction
keystruct IBookManager.BookKeyThe key of the book being opened
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

afterOpen

function afterOpen(address sender, struct IBookManager.BookKey key, bytes hookData) external returns (bytes4)

Hook called after opening a new book

Parameters

NameTypeDescription
senderaddressThe sender of the open transaction
keystruct IBookManager.BookKeyThe key of the book being opened
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

beforeMake

function beforeMake(address sender, struct IBookManager.MakeParams params, bytes hookData) external returns (bytes4)

Hook called before making a new order

Parameters

NameTypeDescription
senderaddressThe sender of the make transaction
paramsstruct IBookManager.MakeParamsThe parameters of the make transaction
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

afterMake

function afterMake(address sender, struct IBookManager.MakeParams params, OrderId orderId, bytes hookData) external returns (bytes4)

Hook called after making a new order

Parameters

NameTypeDescription
senderaddressThe sender of the make transaction
paramsstruct IBookManager.MakeParamsThe parameters of the make transaction
orderIdOrderIdThe id of the order that was made
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

beforeTake

function beforeTake(address sender, struct IBookManager.TakeParams params, bytes hookData) external returns (bytes4)

Hook called before taking an order

Parameters

NameTypeDescription
senderaddressThe sender of the take transaction
paramsstruct IBookManager.TakeParamsThe parameters of the take transaction
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

afterTake

function afterTake(address sender, struct IBookManager.TakeParams params, uint64 takenUnit, bytes hookData) external returns (bytes4)

Hook called after taking an order

Parameters

NameTypeDescription
senderaddressThe sender of the take transaction
paramsstruct IBookManager.TakeParamsThe parameters of the take transaction
takenUnituint64The unit that was taken
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

beforeCancel

function beforeCancel(address sender, struct IBookManager.CancelParams params, bytes hookData) external returns (bytes4)

Hook called before canceling an order

Parameters

NameTypeDescription
senderaddressThe sender of the cancel transaction
paramsstruct IBookManager.CancelParamsThe parameters of the cancel transaction
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

afterCancel

function afterCancel(address sender, struct IBookManager.CancelParams params, uint64 canceledUnit, bytes hookData) external returns (bytes4)

Hook called after canceling an order

Parameters

NameTypeDescription
senderaddressThe sender of the cancel transaction
paramsstruct IBookManager.CancelParamsThe parameters of the cancel transaction
canceledUnituint64The unit that was canceled
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

beforeClaim

function beforeClaim(address sender, OrderId orderId, bytes hookData) external returns (bytes4)

Hook called before claiming an order

Parameters

NameTypeDescription
senderaddressThe sender of the claim transaction
orderIdOrderIdThe id of the order being claimed
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful

afterClaim

function afterClaim(address sender, OrderId orderId, uint64 claimedUnit, bytes hookData) external returns (bytes4)

Hook called after claiming an order

Parameters

NameTypeDescription
senderaddressThe sender of the claim transaction
orderIdOrderIdThe id of the order being claimed
claimedUnituint64The unit that was claimed
hookDatabytesThe data passed to the hook

Return Values

NameTypeDescription
[0]bytes4Returns the function selector if the hook is successful