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
| Function | Returns |
|---|---|
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
| Function | Caller | Description |
|---|---|---|
withdraw(_recipient, _token, _amount) | _recipient (or anyone paying gas, if they pass the right _recipient) | Pays out _amount of _token to _recipient |
Errors
| Error | Cause |
|---|---|
CannotWithdrawZeroAmount | _amount == 0 |
InsufficientBalanceAvailable | Not enough escrowed |
RecipientIsZeroAddress | _recipient == address(0) |
Events
| Event | Notes |
|---|---|
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.