Overview
The AtomWallet smart contract is a core component of the Intuition protocol, functioning as an abstract account associated with a corresponding atom.
Author: 0xIntuition
Contract Inheritance
- BaseAccount (from
@account-abstraction/contracts
) - Initializable and OwnableUpgradeable (from
@openzeppelin/contracts-upgradeable/access
)
State Variables
ethMultiVault
- Type:
IEthMultiVault public
- Description: The EthMultiVault proxy contract address
isClaimed
- Type:
bool public
- Description: Flag indicating if the wallet's ownership has been claimed by the user
OwnableStorageLocation
- Type:
bytes32 private constant
- Description: Storage slot for the AtomWallet contract ownable storage
_entryPoint
- Type:
IEntryPoint private
- Description: The EntryPoint contract's address for facilitating external calls and deposits
Modifiers
onlyOwnerOrEntryPoint
Ensures that only the owner or the EntryPoint can call the function using this modifier.
Functions
init
function init(
IEntryPoint anEntryPoint,
address anOwner,
IEthMultiVault _ethMultiVault
) external initializer
Initializes a new AtomWallet with specified parameters.
execute
function execute(
address dest,
uint256 value,
bytes calldata func
) external onlyOwnerOrEntryPoint
Executes a single transaction from the AtomWallet.
executeBatch
function executeBatch(
address[] calldata dest,
bytes[] calldata func
) external onlyOwnerOrEntryPoint
Executes multiple transactions in a batch.
addDeposit
function addDeposit() public payable
Deposits additional funds to the wallet's account in the EntryPoint.
withdrawDepositTo
function withdrawDepositTo(
address payable withdrawAddress,
uint256 amount
) public
Withdraws specified amount to a given address (owner only).
transferOwnership
function transferOwnership(
address newOwner
) public override onlyOwner
Transfers wallet ownership. Sets claimed status when transferred to user.
View Functions
getDeposit
function getDeposit() public view returns (uint256)
Returns current deposit amount in the EntryPoint.
entryPoint
function entryPoint() public view virtual override returns (IEntryPoint)
Returns the associated EntryPoint contract address.
owner
function owner() public view override returns (address)
Returns the wallet owner (user if claimed, atomWarden if not).
Internal Functions
_validateSignature
function _validateSignature(
UserOperation calldata userOp,
bytes32 userOpHash
) internal virtual override returns (uint256 validationData)
Validates UserOperation signatures.
_call
function _call(
address target,
uint256 value,
bytes memory data
) internal
Performs low-level calls to target addresses.
_getAtomWalletOwnableStorage
function _getAtomWalletOwnableStorage() private pure returns (OwnableStorage storage $)
Retrieves the contract's ownable storage slot.