AtomWallet
Inherits: Initializable, BaseAccount, Ownable2StepUpgradeable, ReentrancyGuardUpgradeable
Author: 0xIntuition
Core contract of the Intuition protocol. This contract is an abstract account associated with a corresponding atom.
State Variables
ethMultiVault
The EthMultiVault contract address
IEthMultiVault public ethMultiVault;
isClaimed
The flag to indicate if the wallet's ownership has been claimed by the user
bool public isClaimed;
AtomWalletOwnerStorageLocation
The storage slot for the AtomWallet owner
bytes32 private constant AtomWalletOwnerStorageLocation =
0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;
AtomWalletPendingOwnerStorageLocation
The storage slot for the AtomWallet pending owner
bytes32 private constant AtomWalletPendingOwnerStorageLocation =
0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00;
_entryPoint
The entry point contract address
IEntryPoint private _entryPoint;
__gap
Gap for upgrade safety
uint256[50] private __gap;
Functions
onlyOwnerOrEntryPoint
Modifier to allow only the owner or entry point to call a function
modifier onlyOwnerOrEntryPoint();
init
Initialize the AtomWallet contract
function init(IEntryPoint anEntryPoint, IEthMultiVault _ethMultiVault) external initializer;
Parameters
Name | Type | Description |
---|---|---|
anEntryPoint | IEntryPoint | the entry point contract address |
_ethMultiVault | IEthMultiVault | the EthMultiVault contract address |
receive
receive() external payable;
execute
function execute(address dest, uint256 value, bytes calldata func)
external
payable
onlyOwnerOrEntryPoint
nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
dest | address | the target address |
value | uint256 | the value to send |
func | bytes | the function call data |
executeBatch
Execute a sequence (batch) of transactions
function executeBatch(address[] calldata dest, uint256[] calldata values, bytes[] calldata func)
external
payable
onlyOwnerOrEntryPoint
nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
dest | address[] | the target addresses array |
values | uint256[] | |
func | bytes[] | the function call data array |
addDeposit
Add deposit to the account in the entry point contract
function addDeposit() public payable;
withdrawDepositTo
Withdraws value from the account's deposit
function withdrawDepositTo(address payable withdrawAddress, uint256 amount) public;
Parameters
Name | Type | Description |
---|---|---|
withdrawAddress | address payable | target to send to |
amount | uint256 | to withdraw |
transferOwnership
Initiates the ownership transfer over the wallet to a new owner.
function transferOwnership(address newOwner) public override onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
newOwner | address | the new owner of the wallet (becomes the pending owner) NOTE: Overrides the transferOwnership function of Ownable2StepUpgradeable |
acceptOwnership
The new owner accepts the ownership over the wallet. If the wallet's ownership is being accepted by the user, the wallet is considered claimed. Once claimed, wallet is considered owned by the user and this action cannot be undone. NOTE: Overrides the acceptOwnership function of Ownable2StepUpgradeable
function acceptOwnership() public override;
getDeposit
Returns the deposit of the account in the entry point contract
function getDeposit() public view returns (uint256);
entryPoint
Get the entry point contract address
function entryPoint() public view virtual override returns (IEntryPoint);
Returns
Name | Type | Description |
---|---|---|
<none> | IEntryPoint | the entry point contract address NOTE: Overrides the entryPoint function of BaseAccount |
owner
Returns the owner of the wallet. If the wallet has been claimed, the owner is the user. Otherwise, the owner is the atomWarden.
function owner() public view override returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | the owner of the wallet NOTE: Overrides the owner function of OwnableUpgradeable |
_validateSignature
Validate the signature of the user operation
function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)
internal
virtual
override
returns (uint256 validationData);
Parameters
Name | Type | Description |
---|---|---|
userOp | UserOperation | the user operation |
userOpHash | bytes32 | the hash of the user operation |
Returns
Name | Type | Description |
---|---|---|
validationData | uint256 | the validation data (0 if successful) NOTE: Implements the template method of BaseAccount |
_call
An internal method that calls a target address with value and data
function _call(address target, uint256 value, bytes memory data) internal;
Parameters
Name | Type | Description |
---|---|---|
target | address | the target address |
value | uint256 | the value to send |
data | bytes | the function call data |
extractValidUntilAndValidAfter
Extract the validUntil and validAfter from the call data
function extractValidUntilAndValidAfter(bytes calldata callData)
internal
pure
returns (uint256 validUntil, uint256 validAfter, bytes memory actualCallData);
Parameters
Name | Type | Description |
---|---|---|
callData | bytes | the call data |
Returns
Name | Type | Description |
---|---|---|
validUntil | uint256 | the valid until timestamp |
validAfter | uint256 | the valid after timestamp |
actualCallData | bytes | the actual call data of the user operation |
_getAtomWalletOwnerStorage
Get the storage slot for the AtomWallet contract owner
function _getAtomWalletOwnerStorage() private pure returns (OwnableStorage storage $);
Returns
Name | Type | Description |
---|---|---|
$ | OwnableStorage | the storage slot |
_getAtomWalletPendingOwnerStorage
Get the storage slot for the AtomWallet contract pending owner
function _getAtomWalletPendingOwnerStorage() private pure returns (Ownable2StepStorage storage $);
Returns
Name | Type | Description |
---|---|---|
$ | Ownable2StepStorage | the storage slot |