█████╗ ██████╗  █████╗ ██████╗ ████████╗███████╗██████╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██╔══██╗
███████║██║  ██║███████║██████╔╝   ██║   █████╗  ██████╔╝
██╔══██║██║  ██║██╔══██║██╔═══╝    ██║   ██╔══╝  ██╔══██╗
██║  ██║██████╔╝██║  ██║██║        ██║   ███████╗██║  ██║
╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝        ╚═╝   ╚══════╝╚═╝  ╚═╝

ERC-8004 Identity Adapter
for ERC-721, ERC-1155, and ERC-6909 tokens

Bind any external token to an ERC-8004 identity record — upgradeable, admin-managed, ERC-8004 semantics preserved.

Model

┌────────────────────┐      ┌────────────────────┐      ┌────────────────────┐
│                    │      │                    │      │                    │
│   External Token   │ ───▶ │   Adapter8004.sol  │ ───▶ │   ERC-8004         │
│   ERC-721 / 1155 / │      │   Agent bindings   │      │   Identity         │
│   ERC-6909         │      │                    │      │   Registry         │
│                    │      │                    │      │                    │
└────────────────────┘      └────────────────────┘      └────────────────────┘
    controls via                forwards to                holds agentId
    ownerOf / balanceOf         8004 registry              (adapter is owner)

The adapter registers the ERC-8004 identity itself, keeps permanent custody of that ERC-8004 token, and binds the resulting agentId to one external token. Whoever controls the external token controls the identity.

Supported Standards

ERC-721

Single-owner semantics. Control belongs to ownerOf(tokenId). Transferring the token moves control atomically.

ERC-1155

Any balanceOf(account, tokenId) > 0.

ERC-6909

Any balanceOf(account, tokenId) > 0.

ERC-8004 Semantics Preserved

Wrapper Contract

Adapter8004.sol wraps the ERC-8004 identity token. The adapter registers on the ERC-8004 registry, takes permanent custody of the NFT, and forwards all writes on behalf of the bound token’s controller.

setAgentURI

Forwards directly into the ERC-8004 registry.

setMetadata

Single-entry metadata write, controller-gated.

setMetadataBatch

Batched metadata writes with MetadataBatchSet event.

setAgentWallet

Wallet-proof rule enforced by the registry (EIP-712 / ERC-1271).

unsetAgentWallet

Clears the current agentWallet. Called automatically after register.

Admin Model

Upgradeable (UUPS)

The adapter owner can upgrade the implementation via upgradeToAndCall. Gated by _authorizeUpgrade → onlyOwner.

Registry Swap

Admin can call setIdentityRegistry to track future ERC-8004 changes — registry proxy upgrades or migrations to a new registry address.

Quickstart

# clone
git clone https://github.com/idchain-world/erc8004-identity-adapter.git
cd erc8004-identity-adapter

# build + test
forge build
forge test

# deploy proxy
IDENTITY_REGISTRY_ADDRESS=<erc8004_registry> \
ADAPTER_ADMIN=<admin> \
forge script script/DeployAdapter.s.sol --broadcast

See the full quickstart guide for registering your first binding.