> For the complete documentation index, see [llms.txt](https://docs-v4.nftx.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v4.nftx.io/contracts/supporting.md).

# Supporting Contracts

The smaller contracts that round out NFTX v4: the manager registry that guards Locker access, the launch gates that decide who can create a collection, the bonding curve used for liquidation auctions, and the escrow that holds claimable balances.

## LockerManager

Tracks which contracts are approved to access tokens held in the [Locker](/contracts/locker.md). Approvals are managed by the owner; when a vault is removed, its permissions are revoked to keep the protocol consistent. Signatures come from the `ILockerManager` interface.

### `setManager`

Approves or revokes a manager. Intended for migrations — e.g. disabling an old Listings contract while enabling a new one.

```solidity
function setManager(address _manager, bool _approved) external;
```

**Access:** `onlyOwner`. Reverts on the zero address or a no-op state change.

{% hint style="warning" %}
Having multiple managers enabled at once can be dangerous: if they interact with assets registered on another contract, they can cause protocol issues.
{% endhint %}

| Parameter   | Type      | Description            |
| ----------- | --------- | ---------------------- |
| `_manager`  | `address` | The contract to update |
| `_approved` | `bool`    | The new approval state |

**Returns:** None.

### `isManager`

Returns whether an address is an approved Locker manager.

```solidity
function isManager(address _manager) external view returns (bool);
```

| Parameter  | Type      | Description          |
| ---------- | --------- | -------------------- |
| `_manager` | `address` | The address to check |

| Return    | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| (unnamed) | `bool` | `true` if the manager is approved |

## Launch gates

A launch gate is the external, swappable authority the Locker consults to decide who may create or initialize a collection, and whether token-only (single-sided) liquidity launches are allowed. The interface is `ICollectionLaunchGate`; two implementations ship.

{% hint style="info" %}
The auth methods are declared non-`view` on the interface so a future gate can hold stateful policy without breaking the interface.
{% endhint %}

| Function                                                            | Description                                                                 |
| ------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| `assertCanCreateCollection(address caller, address collection)`     | Reverts unless `caller` may create `collection` through this gate           |
| `assertCanInitializeCollection(address caller, address collection)` | Reverts unless `caller` may initialize `collection` through this gate       |
| `singleSidedAllowed()` → `bool`                                     | Whether token-only single-sided launches are permitted; fixed at deployment |

**Implementations:**

* **`Public`** — permissionless. `assertCanCreateCollection` and `assertCanInitializeCollection` are no-ops, so anyone may create or initialize a collection.
* **`WhiteGlove`** — restricted. Both assertions revert with `LaunchRestricted` unless the caller is the owner (multisig), so only the multisig can create or initialize collections.

## LinearRangeCurve

A Sudoswap-compatible bonding curve used by [Collection Shutdown](/contracts/collection-shutdown.md) liquidations. Price declines linearly over a time range until it reaches zero, prioritising a predictable liquidation schedule over price discovery; buys don't move the spot price and sells aren't allowed.

### `getBuyInfo`

Computes how much a buyer pays to purchase NFTs from the pool, along with the new pool state.

```solidity
function getBuyInfo(uint128 spotPrice, uint128 delta, uint numItems, uint feeMultiplier, uint protocolFeeMultiplier) external view returns (Error error, uint128 newSpotPrice, uint128 newDelta, uint inputValue, uint tradeFee, uint protocolFee);
```

| Parameter               | Type      | Description                                                     |
| ----------------------- | --------- | --------------------------------------------------------------- |
| `spotPrice`             | `uint128` | The current selling spot price, in tokens                       |
| `delta`                 | `uint128` | The curve's delta parameter (here, packed start/end timestamps) |
| `numItems`              | `uint`    | The number of NFTs being bought                                 |
| `feeMultiplier`         | `uint`    | The LP fee for this trade, 18 decimals                          |
| `protocolFeeMultiplier` | `uint`    | The protocol fee for this trade, 18 decimals                    |

| Return         | Type      | Description                                                 |
| -------------- | --------- | ----------------------------------------------------------- |
| `error`        | `Error`   | Math error code; only `Error.OK` means the values are valid |
| `newSpotPrice` | `uint128` | The updated selling spot price                              |
| `newDelta`     | `uint128` | The updated delta                                           |
| `inputValue`   | `uint`    | The amount the buyer should pay, in tokens                  |
| `tradeFee`     | `uint`    | The amount sent to the trade-fee recipient                  |
| `protocolFee`  | `uint`    | The protocol fee, in tokens                                 |

### `getSellInfo`

Selling is not supported — liquidation pools only buy. Always returns `Error.INVALID_NUMITEMS` with zero values.

```solidity
function getSellInfo(uint128, uint128, uint, uint, uint) external pure returns (Error error_, uint128, uint128, uint, uint, uint);
```

### `packDelta` / `unpackDelta`

Helpers to encode and decode the auction's start and end timestamps into the `delta` value.

```solidity
function packDelta(uint32 start, uint32 end) external pure returns (uint128);
function unpackDelta(uint128 delta) external pure returns (uint32 start_, uint32 end_);
```

| Parameter | Type      | Description                         |
| --------- | --------- | ----------------------------------- |
| `start`   | `uint32`  | The unix timestamp the curve starts |
| `end`     | `uint32`  | The unix timestamp the curve ends   |
| `delta`   | `uint128` | The packed delta to decode          |

| Return   | Type     | Description                 |
| -------- | -------- | --------------------------- |
| `start_` | `uint32` | The decoded start timestamp |
| `end_`   | `uint32` | The decoded end timestamp   |

{% hint style="info" %}
`validateDelta` and `validateSpotPrice` both return `true` for any value — a linear curve accepts all deltas and spot prices.
{% endhint %}

## TokenEscrow

A gas-efficient escrow that holds balances for users to claim later. ERC-20 amounts are sent directly to recipients; native ETH is held in escrow. It's inherited by [NFTXV4Hook](/contracts/nftx-v4-hook.md) and other contracts that accrue user-owed balances. Signatures come from the `ITokenEscrow` interface.

### `withdraw`

Withdraws from the caller's escrow position. Funds are always debited from `msg.sender` (the source can't be widened) but may be sent to any non-zero recipient.

```solidity
function withdraw(address _recipient, address _token, uint _amount) external;
```

**Access:** public. Reverts if `_amount` is 0, `_recipient` is the zero address, or the caller has insufficient balance. For the native token (`_token == NATIVE_TOKEN`, i.e. `address(0)`), transfers ETH; otherwise transfers the ERC-20.

| Parameter    | Type      | Description                                         |
| ------------ | --------- | --------------------------------------------------- |
| `_recipient` | `address` | The address to receive the token / ETH              |
| `_token`     | `address` | The token to transfer (`address(0)` for native ETH) |
| `_amount`    | `uint`    | The amount to transfer                              |

**Returns:** None.

### `balances` / `NATIVE_TOKEN`

```solidity
function balances(address _recipient, address _token) external view returns (uint amount_);
function NATIVE_TOKEN() external view returns (address);
```

| Function                       | Description                                                          |
| ------------------------------ | -------------------------------------------------------------------- |
| `balances(_recipient, _token)` | The escrow balance of `_token` allocated to `_recipient` (0 if none) |
| `NATIVE_TOKEN()`               | The sentinel address for native ETH (`address(0)`)                   |
