Hooks
Hooks are custom smart contracts that execute additional onchain actions after advanced orders are processed. Creators can deploy hooks to extend functionality and integrate with their ecosystem.
Supported Hook Types:
-
Buy Order Hooks: Triggered after advanced buy orders.
- Implementation Requirement: Must implement ITokenMasterBuyHook.
//SPDX-License-Identifier: LicenseRef-PolyForm-Strict-1.0.0
pragma solidity 0.8.24;
/**
* @title ITokenMasterBuyHook
* @author Limit Break, Inc.
* @notice Interface that must be implemented by contracts acting as a buy hook
* @notice for advanced buy orders.
*/
interface ITokenMasterBuyHook {
function tokenMasterBuyHook(
address tokenMasterToken,
address buyer,
bytes32 creatorBuyIdentifier,
uint256 amountPurchased,
bytes calldata hookExtraData
) external;
} -
Sell Order Hooks: Triggered after advanced sell orders.
- Implementation Requirement: Must implement ITokenMasterSellHook.
//SPDX-License-Identifier: LicenseRef-PolyForm-Strict-1.0.0
pragma solidity 0.8.24;
/**
* @title ITokenMasterSellHook
* @author Limit Break, Inc.
* @notice Interface that must be implemented by contracts acting as a sell hook
* @notice for advanced sell orders.
*/
interface ITokenMasterSellHook {
function tokenMasterSellHook(
address tokenMasterToken,
address seller,
bytes32 creatorSellIdentifier,
uint256 amountSold,
bytes calldata hookExtraData
) external;
} -
Spend Order Hooks: Triggered after spend orders.
- Implementation Requirement: Must implement ITokenMasterSpendHook.
//SPDX-License-Identifier: LicenseRef-PolyForm-Strict-1.0.0
pragma solidity 0.8.24;
/**
* @title ITokenMasterSpendHook
* @author Limit Break, Inc.
* @notice Interface that must be implemented by contracts acting as a spend hook
* @notice for spend orders.
*/
interface ITokenMasterSpendHook {
function tokenMasterSpendHook(
address tokenMasterToken,
address spender,
bytes32 creatorSpendIdentifier,
uint256 multiplier,
bytes calldata hookExtraData
) external;
}
Key Parameters:
- Transaction Context: Hooks receive details such as token being transacted, executor address, creator identifier, and quantity transacted. Quantity transacted is amount of token for buy and sells, multiples for spends.
Hook Design Notes:
- Validation: Hook contracts must validate the caller as the TokenMaster Router and confirm the token involved is valid for the hook's logic.
- Extra Data: Hooks can receive additional contextual data through the
extraDataparameter for custom use cases. Validation of this data is the responsibility of the hook logic.

