| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.20; |
| 3 | |
| 4 | /// @dev the ERC-165 identifier for this interface is `0x6faff5f1` |
| 5 | interface IERC6551Account { |
| 6 | /** |
| 7 | * @dev Allows the account to receive Ether |
| 8 | * |
| 9 | * Accounts MUST implement a `receive` function |
| 10 | * |
| 11 | * Accounts MAY perform arbitrary logic to restrict conditions |
| 12 | * under which Ether can be received |
| 13 | */ |
| 14 | receive() external payable; |
| 15 | |
| 16 | /** |
| 17 | * @dev Returns the identifier of the non-fungible token which owns the account |
| 18 | * |
| 19 | * The return value of this function MUST be constant - it MUST NOT change over time |
| 20 | * |
| 21 | * @return chainId The EIP-155 ID of the chain the token exists on |
| 22 | * @return tokenContract The contract address of the token |
| 23 | * @return tokenId The ID of the token |
| 24 | */ |
| 25 | function token() |
| 26 | external |
| 27 | view |
| 28 | returns (uint256 chainId, address tokenContract, uint256 tokenId); |
| 29 | |
| 30 | /** |
| 31 | * @dev Returns a value that SHOULD be modified each time the account changes state |
| 32 | * |
| 33 | * @return The current account state |
| 34 | */ |
| 35 | function state() external view returns (uint256); |
| 36 | |
| 37 | /** |
| 38 | * @dev Returns a magic value indicating whether a given signer is authorized to act on behalf |
| 39 | * of the account |
| 40 | * |
| 41 | * MUST return the bytes4 magic value 0x523e3260 if the given signer is valid |
| 42 | * |
| 43 | * By default, the holder of the non-fungible token the account is bound to MUST be considered |
| 44 | * a valid signer |
| 45 | * |
| 46 | * Accounts MAY implement additional authorization logic which invalidates the holder as a |
| 47 | * signer or grants signing permissions to other non-holder accounts |
| 48 | * |
| 49 | * @param signer The address to check signing authorization for |
| 50 | * @param context Additional data used to determine whether the signer is valid |
| 51 | * @return magicValue Magic value indicating whether the signer is valid |
| 52 | */ |
| 53 | function isValidSigner( |
| 54 | address signer, |
| 55 | bytes calldata context |
| 56 | ) external view returns (bytes4 magicValue); |
| 57 | } |