ERC6551Account
Inherits: IERC6551Account, IERC6551Executable
Title: ERC6551Account
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from ERC-6551 reference (https://github.com/erc6551/reference)
ERC-6551 token-bound account facet. The Diamond becomes an account owned by a specific ERC-721
token; the token's current owner is the sole valid signer and the only caller of execute.
Stateless delegator — logic/storage live in ERC6551AccountLib. v1 supports operation == 0 (CALL)
and resolves ownership only on the token's home chain. The bound token is set once at initialization.
Notes:
- lattice-version: 0.1.0
- lattice-source: ERC-6551
Functions
receive
The account must be able to receive native value.
receive() external payable virtual;isValidSigner
Returns the magic value 0x523e3260 if signer is authorized to act for the account in
context, else bytes4(0).
function isValidSigner(address signer, bytes calldata context) external view virtual returns (bytes4);Parameters
| Name | Type | Description |
|---|---|---|
| signer | address | |
| context | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes4 |
state
A value that changes every time the account state changes (e.g. after each execution).
function state() external view virtual returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
token
The token that owns this account: (chainId, tokenContract, tokenId).
function token() external view virtual returns (uint256 chainId, address tokenContract, uint256 tokenId);Returns
| Name | Type | Description |
|---|---|---|
| chainId | uint256 | |
| tokenContract | address | |
| tokenId | uint256 |
execute
Executes a low-level operation if the caller is a valid signer. operation 0 = CALL.
function execute(address to, uint256 value, bytes calldata data, uint8 operation)
external
payable
virtual
returns (bytes memory);Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| value | uint256 | |
| data | bytes | |
| operation | uint8 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect ERC6551Account methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. receive() has no selector and is not exported: behind a diamond, plain
ETH transfers reach the cut Receive facet (its export is 0x00000000). Chunks:
execute(address,uint256,bytes,uint8) 0x51945447
isValidSigner(address,bytes) 0x523e3260
state() 0xc19d93fb
token() 0xfc0c546a
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |