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
Name | Type | Description |
---|---|---|
accessController_ | address | The 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
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | The interface identifier, as specified in ERC-165 |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool 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
Name | Type | Description |
---|---|---|
[0] | uint256 | chainId The EIP-155 ID of the chain the token exists on |
[1] | address | tokenContract The contract address of the token |
[2] | uint256 | tokenId 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
Name | Type | Description |
---|---|---|
signer | address | The signer to check |
data | bytes | The data to check against |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | The 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
Name | Type | Description |
---|---|---|
[0] | address | The 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
Name | Type | Description |
---|---|---|
signer | address | The signer to check |
to | address | The recipient of the transaction |
data | bytes | The calldata to check against |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | bool 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
Name | Type | Description |
---|---|---|
to | address | The recipient of the transaction. |
value | uint256 | The amount of Ether to send. |
data | bytes | The data to send along with the transaction. |
signer | address | The signer of the transaction. |
deadline | uint256 | The deadline of the transaction signature. |
signature | bytes | The 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
Name | Type | Description |
---|---|---|
to | address | The recipient of the transaction. |
value | uint256 | The amount of Ether to send. |
data | bytes | The data to send along with the transaction. |
Return Values
Name | Type | Description |
---|---|---|
result | bytes | The 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
Name | Type | Description |
---|---|---|
address | ||
address | ||
uint256 | ||
uint256 | ||
bytes |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | bytes4(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
Name | Type | Description |
---|---|---|
address | ||
address | ||
uint256[] | ||
uint256[] | ||
bytes |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | bytes4(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)
Updated 3 days ago