IWallet
Inherits: IAccount, IERC721Receiver, IERC1155Receiver, IERC1271
Combines all wallet functionality including ERC-4337, multi-ownership, token receiving, ledger integration, and delegation capabilities
Interface for the modular wallet diamond implementation
Functions
initialize
Initialize the wallet
function initialize(bytes[] calldata owners, string calldata walletType, uint256 requiredApprovals) external;
Parameters
owners
bytes[]
Array of owner data (addresses or WebAuthn pubkeys)
walletType
string
Type of wallet being created (string-based)
requiredApprovals
uint256
Number of approvals required for transactions
execute
Execute a transaction from the wallet
function execute(address target, uint256 value, bytes calldata data)
external
returns (bool success, bytes memory result);
Parameters
target
address
Target contract address
value
uint256
ETH value to send
data
bytes
Transaction data
Returns
success
bool
Whether the transaction succeeded
result
bytes
Return data from the transaction
executeBatch
Execute multiple transactions in batch
function executeBatch(address[] calldata targets, uint256[] calldata values, bytes[] calldata datas) external;
Parameters
targets
address[]
Array of target addresses
values
uint256[]
Array of ETH values
datas
bytes[]
Array of transaction data
getWalletInfo
Get wallet information
function getWalletInfo()
external
view
returns (
string memory walletType,
string memory name,
uint256 ownerCount,
uint256 requiredApprovals,
bool emergencyMode
);
Returns
walletType
string
Type of wallet
name
string
Wallet name
ownerCount
uint256
Number of owners
requiredApprovals
uint256
Required approvals
emergencyMode
bool
Whether emergency mode is active
entryPoint
Get EntryPoint address for ERC-4337
function entryPoint() external view returns (address);
activateEmergencyMode
Activate emergency mode
function activateEmergencyMode() external;
deactivateEmergencyMode
Deactivate emergency mode
function deactivateEmergencyMode() external;
addOwnerAddress
Add an owner by address
function addOwnerAddress(address owner) external;
Parameters
owner
address
Address of the new owner
addOwnerPublicKey
Add an owner by WebAuthn public key
function addOwnerPublicKey(bytes32 x, bytes32 y) external;
Parameters
x
bytes32
X coordinate of the public key
y
bytes32
Y coordinate of the public key
addGovernanceOwner
Add a smart contract as an owner with governance delegation
function addGovernanceOwner(address contractOwner) external;
Parameters
contractOwner
address
Address of the smart contract that will own this wallet
removeGovernanceOwner
Remove a governance owner
function removeGovernanceOwner(uint256 index, bytes calldata owner) external;
Parameters
index
uint256
Index of the owner to remove
owner
bytes
Owner data to verify
removeOwnerAtIndex
Remove an owner at a specific index
function removeOwnerAtIndex(uint256 index, bytes calldata owner) external;
Parameters
index
uint256
Index of the owner to remove
owner
bytes
Owner data to verify
removeLastOwner
Remove the last owner (special case)
function removeLastOwner(uint256 index, bytes calldata owner) external;
Parameters
index
uint256
Index of the last owner
owner
bytes
Owner data to verify
isOwnerAddress
Check if an address is an owner
function isOwnerAddress(address account) external view returns (bool);
Parameters
account
address
Address to check
Returns
<none>
bool
Whether the address is an owner
isOwnerPublicKey
Check if a WebAuthn public key is an owner
function isOwnerPublicKey(bytes32 x, bytes32 y) external view returns (bool);
Parameters
x
bytes32
X coordinate of the public key
y
bytes32
Y coordinate of the public key
Returns
<none>
bool
Whether the public key is an owner
isOwnerBytes
Check if owner data represents an owner
function isOwnerBytes(bytes memory account) external view returns (bool);
Parameters
account
bytes
Owner data to check
Returns
<none>
bool
Whether the data represents an owner
isGovernanceDelegate
Check if an address is a governance delegate owner
function isGovernanceDelegate(address account) external view returns (bool);
Parameters
account
address
Address to check
Returns
<none>
bool
Whether the address is a governance delegate
setGovernanceContract
Set the governance contract for this wallet
function setGovernanceContract(address governanceContract) external;
Parameters
governanceContract
address
Address of the governance contract (0x0 to disable)
getGovernanceContract
Get the governance contract for this wallet
function getGovernanceContract() external view returns (address governanceContract);
Returns
governanceContract
address
Address of the governance contract
requiresGovernanceApproval
Check if an operation requires governance approval
function requiresGovernanceApproval(string calldata operation) external view returns (bool requiresApproval);
Parameters
operation
string
The operation identifier
Returns
requiresApproval
bool
True if governance approval is required
executeWithGovernance
Execute a transaction with governance checks
function executeWithGovernance(address target, uint256 value, bytes calldata data, string calldata operation)
external;
Parameters
target
address
The target address
value
uint256
The ether value
data
bytes
The call data
operation
string
The operation description for governance
ownerAtIndex
Get owner data at a specific index
function ownerAtIndex(uint256 index) external view returns (bytes memory);
Parameters
index
uint256
Index of the owner
Returns
<none>
bytes
Owner data
nextOwnerIndex
Get the next owner index
function nextOwnerIndex() external view returns (uint256);
Returns
<none>
uint256
Next index to be used
ownerCount
Get the total number of active owners
function ownerCount() external view returns (uint256);
Returns
<none>
uint256
Number of active owners
removedOwnersCount
Get the number of removed owners
function removedOwnersCount() external view returns (uint256);
Returns
<none>
uint256
Number of removed owners
configureDelegation
Configure delegation for another wallet
function configureDelegation(
address delegatedWallet,
uint256 maxValue,
uint256 dailyLimit,
bytes4[] calldata allowedSelectors
) external;
Parameters
delegatedWallet
address
Wallet that can execute on behalf of this wallet
maxValue
uint256
Maximum value for delegated transactions
dailyLimit
uint256
Daily spending limit for delegated transactions
allowedSelectors
bytes4[]
Function selectors that can be delegated
revokeDelegation
Revoke delegation for a wallet
function revokeDelegation(address delegatedWallet) external;
Parameters
delegatedWallet
address
Wallet to revoke delegation from
setFunctionDelegation
Set function delegation permission
function setFunctionDelegation(address delegatedWallet, bytes4 selector, bool allowed) external;
Parameters
delegatedWallet
address
Wallet to set permission for
selector
bytes4
Function selector
allowed
bool
Whether the function is allowed
executeDelegated
Execute a delegated transaction
function executeDelegated(address target, uint256 value, bytes calldata data, bytes calldata signature)
external
returns (bool success, bytes memory result);
Parameters
target
address
Target contract address
value
uint256
ETH value to send
data
bytes
Transaction data
signature
bytes
Signature from the delegating wallet
Returns
success
bool
Whether the transaction succeeded
result
bytes
Return data from the transaction
executeDelegatedBatch
Execute multiple delegated transactions in batch
function executeDelegatedBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata datas,
bytes calldata signature
) external;
Parameters
targets
address[]
Array of target addresses
values
uint256[]
Array of ETH values
datas
bytes[]
Array of transaction data
signature
bytes
Signature from the delegating wallet
getDelegationConfig
Get delegation configuration for a wallet
function getDelegationConfig(address delegatedWallet)
external
view
returns (uint256 maxValue, uint256 dailyLimit, uint256 dailySpent, uint256 lastResetTime, bool active);
Parameters
delegatedWallet
address
Wallet to get configuration for
Returns
maxValue
uint256
Maximum value for delegated transactions
dailyLimit
uint256
Daily spending limit
dailySpent
uint256
Amount spent today
lastResetTime
uint256
Last time daily limit was reset
active
bool
Whether delegation is active
isFunctionDelegated
Check if a function is delegated to a wallet
function isFunctionDelegated(address delegatedWallet, bytes4 selector) external view returns (bool);
Parameters
delegatedWallet
address
Wallet to check
selector
bytes4
Function selector to check
Returns
<none>
bool
Whether the function is delegated
getDelegatedWallets
Get all wallets that have delegation from this wallet
function getDelegatedWallets() external view returns (address[] memory);
Returns
<none>
address[]
Array of delegated wallet addresses
updateDailyLimit
Update daily limit for a delegated wallet
function updateDailyLimit(address delegatedWallet, uint256 newDailyLimit) external;
Parameters
delegatedWallet
address
Wallet to update limit for
newDailyLimit
uint256
New daily limit
canDelegate
Check if a wallet can delegate a specific function with a value
function canDelegate(address delegatedWallet, bytes4 selector, uint256 value) external view returns (bool);
Parameters
delegatedWallet
address
Wallet to check
selector
bytes4
Function selector
value
uint256
Transaction value
Returns
<none>
bool
Whether delegation is allowed
configureLedger
Configure ledger integration
function configureLedger(
address ledgerAddress,
string calldata defaultDebitAccount,
string calldata defaultCreditAccount,
bool autoEnabled
) external;
Parameters
ledgerAddress
address
Address of the ledger contract
defaultDebitAccount
string
Default debit account code
defaultCreditAccount
string
Default credit account code
autoEnabled
bool
Whether auto-ledgering is enabled
configurePayrollAccounts
Configure payroll-specific accounts and rates
function configurePayrollAccounts(
uint256 federalTaxRate,
uint256 stateTaxRate,
uint256 ficaTaxRate,
uint256 benefitsRate,
string calldata federalTaxAccount,
string calldata stateTaxAccount,
string calldata ficaTaxAccount,
string calldata benefitsAccount
) external;
Parameters
federalTaxRate
uint256
Federal tax rate in basis points
stateTaxRate
uint256
State tax rate in basis points
ficaTaxRate
uint256
FICA tax rate in basis points
benefitsRate
uint256
Benefits rate in basis points
federalTaxAccount
string
Account code for federal tax withholding
stateTaxAccount
string
Account code for state tax withholding
ficaTaxAccount
string
Account code for FICA tax withholding
benefitsAccount
string
Account code for benefits withholding
mapTokenToAccount
Map a token address to an account code
function mapTokenToAccount(address token, string calldata accountCode) external;
Parameters
token
address
Token address
accountCode
string
Account code for the token
setTransactionDescription
Set transaction description template for a function selector
function setTransactionDescription(bytes4 selector, string calldata description) external;
Parameters
selector
bytes4
Function selector
description
string
Description template
createLedgerEntry
Create a manual ledger entry
function createLedgerEntry(string[] calldata accounts, int256[] calldata amounts, string calldata description)
external;
Parameters
accounts
string[]
Array of account codes
amounts
int256[]
Array of amounts (positive for debit, negative for credit)
description
string
Description of the entry
getLedgerConfig
Get ledger configuration
function getLedgerConfig()
external
view
returns (
address ledgerAddress,
bool autoEnabled,
string memory defaultDebitAccount,
string memory defaultCreditAccount
);
Returns
ledgerAddress
address
Address of the ledger contract
autoEnabled
bool
Whether auto-ledgering is enabled
defaultDebitAccount
string
Default debit account code
defaultCreditAccount
string
Default credit account code
getTokenAccount
Get account code for a token
function getTokenAccount(address token) external view returns (string memory);
Parameters
token
address
Token address
Returns
<none>
string
Account code for the token
setAutoLedgerEnabled
Enable or disable auto-ledgering
function setAutoLedgerEnabled(bool enabled) external;
Parameters
enabled
bool
Whether auto-ledgering should be enabled
eip712Domain
Get EIP-712 domain information
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
Returns
fields
bytes1
Bit mask of fields present
name
string
Domain name
version
string
Domain version
chainId
uint256
Chain ID
verifyingContract
address
Address of this contract
salt
bytes32
Domain salt
extensions
uint256[]
Extensions array
replaySafeHash
Get replay-safe hash for ERC1271
function replaySafeHash(bytes32 hash) external view returns (bytes32);
Parameters
hash
bytes32
Original hash
Returns
<none>
bytes32
Replay-safe hash
domainSeparator
Get domain separator
function domainSeparator() external view returns (bytes32);
Returns
<none>
bytes32
Domain separator hash
Events
WalletInitialized
event WalletInitialized(address indexed wallet, string walletType);
TransactionExecuted
event TransactionExecuted(address indexed target, uint256 value, bytes data, bool success);
OwnerAdded
event OwnerAdded(bytes indexed ownerData);
OwnerRemoved
event OwnerRemoved(bytes indexed ownerData);
AddOwner
event AddOwner(uint256 indexed index, bytes owner);
RemoveOwner
event RemoveOwner(uint256 indexed index, bytes owner);
DelegationConfigured
event DelegationConfigured(address indexed delegatedWallet, uint256 maxValue, uint256 dailyLimit);
DelegationRevoked
event DelegationRevoked(address indexed delegatedWallet);
DelegatedTransactionExecuted
event DelegatedTransactionExecuted(address indexed delegatedWallet, address indexed target, uint256 value);
LedgerConfigured
event LedgerConfigured(address indexed ledgerAddress, bool autoEnabled);
LedgerEntryCreated
event LedgerEntryCreated(string[] accounts, int256[] amounts, string description);
PayrollTransactionProcessed
event PayrollTransactionProcessed(address indexed recipient, uint256 grossPay, uint256 netPay);
GovernanceContractUpdated
event GovernanceContractUpdated(address indexed oldGovernanceContract, address indexed newGovernanceContract);
GovernanceApprovalRequired
event GovernanceApprovalRequired(address indexed governance, string operation, bytes callData);
GovernanceTransactionExecuted
event GovernanceTransactionExecuted(
address indexed governance, address indexed target, uint256 value, string operation
);
Errors
Unauthorized
error Unauthorized();
AlreadyOwner
error AlreadyOwner(bytes owner);
NoOwnerAtIndex
error NoOwnerAtIndex(uint256 index);
WrongOwnerAtIndex
error WrongOwnerAtIndex(uint256 index, bytes expectedOwner, bytes actualOwner);
InvalidOwnerBytesLength
error InvalidOwnerBytesLength(bytes owner);
InvalidEthereumAddressOwner
error InvalidEthereumAddressOwner(bytes owner);
LastOwner
error LastOwner();
NotLastOwner
error NotLastOwner(uint256 ownersRemaining);
AlreadyInitialized
error AlreadyInitialized();
EmergencyModeActive
error EmergencyModeActive();
InsufficientApprovals
error InsufficientApprovals();
NotInitialized
error NotInitialized();
NotOwner
error NotOwner();
InvalidOwner
error InvalidOwner();
GovernanceApprovalMissing
error GovernanceApprovalMissing(address governance, string operation, bytes callData);
InvalidGovernanceContract
error InvalidGovernanceContract();
GovernanceNotSet
error GovernanceNotSet();
Last updated
Was this helpful?