BrainSmartAccount
Check
Mechanism
Implementation
contract BrainSmartAccount {
struct SessionKey {
address holder;
uint256 validAfter;
uint256 validUntil;
address[] allowedTargets;
bytes4[] allowedSelectors;
address capToken; // address(0) = NATIVE (caps in wei); else ERC20-mode
uint256 maxPerTx; // per-call cap in capToken units (or wei in NATIVE mode)
uint256 maxPerPeriod; // cumulative cap per periodSeconds window (same units)
uint256 periodSeconds; // e.g. 86400 for daily; 0 disables period accounting
bytes32 policyVersion; // bound at grant; must be non-zero
}
address public owner; // tenant root key (hardware/custody)
bytes32 public immutable tenantId;
address public immutable policyRegistry;
// Owner-only: issue a scoped, spend-capped, policyVersion-bound key.
function grantSessionKey(SessionKey calldata key) external onlyOwner;
// Holder-authenticated: execute within the key's bounds, or revert.
function executeViaSessionKey(
uint256 nonceSupplied,
address target,
uint256 value,
bytes calldata data
) external returns (bytes memory result);
// Kill-switch / lifecycle, all owner-only.
function pauseSessionKey(address holder) external;
function unpauseSessionKey(address holder) external;
function revokeSessionKey(address holder) external;
}Cap modes
Mode
When
Caps mean
Constraints
EIP-712 ScopeAttestation
Field
Purpose
Policy Binding
Property
Value
Spend Caps
Field
Purpose
Belt-and-Braces Enforcement
Layer
When
Catches
Threat Scenarios
Scenario
Outcome
Kill-Switch: Pause vs Revoke
Function
Effect
Per-Task Minimum-Privilege Keys
Session-Key Hardening (pre-audit)
Defense
Mechanism
What's Next
Last updated
