IPAccountImpl.sol

The Story Protocol's implementation of the IPAccount.

accessController

address accessController

state

uint256 state

Returns the IPAccount's internal nonce for transaction ordering.

receive

receive() external payable

_Allows the account to receive Ether.

Accounts MUST implement a receive function.

Accounts MAY perform arbitrary logic to restrict conditions
under which Ether can be received._

constructor

constructor(address accessController_) public

Creates a new IPAccountImpl contract instance

Initializes the IPAccountImpl with an AccessController address which is stored
in the implementation code's storage.
This means that each cloned IPAccount will inherently use the same AccessController
without the need for individual configuration.

Parameters

NameTypeDescription
accessController_addressThe address of the AccessController contract to be used for permission checks

supportsInterface

function supportsInterface(bytes4 interfaceId) external pure returns (bool)

Checks if the contract supports a specific interface

Parameters

NameTypeDescription
interfaceIdbytes4The interface identifier, as specified in ERC-165

Return Values

NameTypeDescription
[0]boolbool is true if the contract supports the interface, false otherwise

token

function token() public view returns (uint256, address, uint256)

Returns the identifier of the non-fungible token which owns the account

Return Values

NameTypeDescription
[0]uint256chainId The EIP-155 ID of the chain the token exists on
[1]addresstokenContract The contract address of the token
[2]uint256tokenId The ID of the token

isValidSigner

function isValidSigner(address signer, bytes data) external view returns (bytes4)

Checks if the signer is valid for the given data

Parameters

NameTypeDescription
signeraddressThe signer to check
databytesThe data to check against

Return Values

NameTypeDescription
[0]bytes4The function selector if the signer is valid, 0 otherwise

owner

function owner() public view returns (address)

Returns the owner of the IP Account.

Return Values

NameTypeDescription
[0]addressThe address of the owner.

_isValidSigner

function _isValidSigner(address signer, address to, bytes data) internal view returns (bool)

Checks if the signer is valid for the given data and recipient via the AccessController permission system.

Parameters

NameTypeDescription
signeraddressThe signer to check
toaddressThe recipient of the transaction
databytesThe calldata to check against

Return Values

NameTypeDescription
[0]boolbool is true if the signer is valid, false otherwise

executeWithSig

function executeWithSig(address to, uint256 value, bytes data, address signer, uint256 deadline, bytes signature) external payable returns (bytes result)

Executes a transaction from the IP Account on behalf of the signer.

Parameters

NameTypeDescription
toaddressThe recipient of the transaction.
valueuint256The amount of Ether to send.
databytesThe data to send along with the transaction.
signeraddressThe signer of the transaction.
deadlineuint256The deadline of the transaction signature.
signaturebytesThe signature of the transaction, EIP-712 encoded.

execute

function execute(address to, uint256 value, bytes data) external payable returns (bytes result)

Executes a transaction from the IP Account.

Parameters

NameTypeDescription
toaddressThe recipient of the transaction.
valueuint256The amount of Ether to send.
databytesThe data to send along with the transaction.

Return Values

NameTypeDescription
resultbytesThe return data from the transaction.

onERC721Received

function onERC721Received(address, address, uint256, bytes) public pure returns (bytes4)

_Whenever an {IERC721} tokenId token is transferred to this contract via {IERC721-safeTransferFrom}
by operator from from, this function is called.

It must return its Solidity selector to confirm the token transfer.
If any other value is returned or the interface is not implemented by the recipient, the transfer will be
reverted.

The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector._

onERC1155Received

function onERC1155Received(address, address, uint256, uint256, bytes) public pure returns (bytes4)

_Handles the receipt of a single ERC1155 token type. This function is
called at the end of a safeTransferFrom after the balance has been updated.

NOTE: To accept the transfer, this must return
bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
(i.e. 0xf23a6e61, or its own function selector)._

Parameters

NameTypeDescription
address
address
uint256
uint256
bytes

Return Values

NameTypeDescription
[0]bytes4bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) if transfer is allowed

onERC1155BatchReceived

function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) public pure returns (bytes4)

_Handles the receipt of a multiple ERC1155 token types. This function
is called at the end of a safeBatchTransferFrom after the balances have
been updated.

NOTE: To accept the transfer(s), this must return
bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))
(i.e. 0xbc197c81, or its own function selector)._

Parameters

NameTypeDescription
address
address
uint256[]
uint256[]
bytes

Return Values

NameTypeDescription
[0]bytes4bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) if transfer is allowed

_execute

function _execute(address signer, address to, uint256 value, bytes data) internal returns (bytes result)

Executes a transaction from the IP Account.

function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) public pure returns (bytes4)

_execute

function _execute(address signer, address to, uint256 value, bytes data) internal returns (bytes result)