ContractsTokenEscrow

TokenEscrow

Contracts/src/contracts/TokenEscrow.sol

Per-payee, per-token claimable balance ledger. Inherited by both Listings and NFTXV4Hook, so listing refunds, sale proceeds, unaccrued tax, and AMM-fee escrow all share the same withdraw surface.

The same (payee, token) pair on both inheriting contracts maintains separate balances on-chain (it’s per-contract storage), but the subgraph TokenEscrow entity intentionally aggregates balances under (chainId, payee, token) since the FE only ever needs to render a single “claimable” total per token per payee.

State views

FunctionReturns
NATIVE_TOKEN()The sentinel address used for native-ETH escrow (typically 0xEEee…EEeE)
balances(_recipient, _token)The amount claimable by _recipient for _token on this contract

Public surface

FunctionCallerDescription
withdraw(_recipient, _token, _amount)_recipient (or anyone paying gas, if they pass the right _recipient)Pays out _amount of _token to _recipient

Errors

ErrorCause
CannotWithdrawZeroAmount_amount == 0
InsufficientBalanceAvailableNot enough escrowed
RecipientIsZeroAddress_recipient == address(0)

Events

EventNotes
Deposit(_payee, _token, _amount)Funds added to escrow
Withdrawal(_payee, _token, _amount)withdraw claim

Subgraph mapping

A single TokenEscrow { id, payee, token, amount, updated } row is maintained per (chainId, payee, token). Writes from Listings and NFTXV4Hook both feed it; the FE doesn’t need to distinguish the two sources for display.