// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.24; import {IERC165} from "./IERC165.sol"; /** @dev IERC10001 Interface for onchain agentic wills. * An agentic will spawns a dedicated, self-sovereign afterlife agent after a * verified death event. This interface extends IERC165 for interface detection * and composes with ERC-8004 (agent identity) and ERC-8183 (agentic commerce). */ interface IERC10001 is IERC165 { /** @dev The lifecycle state of an agentic will. * Living: the testator is alive and may revise or revoke the will. * Revoked: the testator revoked the will before death. Terminal. * Activated: death was attested; the afterlife agent executes the will. * Terminated: the agent was halted via the consented governance mechanism. Terminal. */ enum WillState { Living, Revoked, Activated, Terminated } /** @dev Emitted when a testator signs a new agentic will. * `agentId` is the ERC-8004 identity registered for the future afterlife agent. * `willHash` commits to the encrypted will document held in the will vault. */ event WillCreated( uint256 indexed willId, address indexed testator, uint256 indexed agentId, bytes32 willHash ); /// @dev Emitted for each signed revision of the will during the testator's life. event WillRevised( uint256 indexed willId, uint64 version, bytes32 willHash, string willURI ); /// @dev Emitted when the testator revokes the will entirely. event WillRevoked(uint256 indexed willId, address indexed testator); /** @dev Emitted when the authorized death oracle attests the testator's death. * `evidenceHash` commits to offchain evidence: certificates, witness * signatures, institutional attestations, or dead-man-switch expiry proofs. */ event DeathAttested( uint256 indexed willId, address indexed oracle, bytes32 evidenceHash ); /// @dev Emitted when the afterlife agent is spawned and begins persistent execution. event AgentActivated(uint256 indexed willId, address indexed agent); /** @dev Emitted when the agent is halted through the governance mechanism * consented to by the testator in the core will. */ event AgentTerminated( uint256 indexed willId, address indexed governor, string reason ); /** @notice Creates an agentic will and registers the future afterlife agent. * Initializes the will vault, commits the first signed version onchain, and * seeds the agent treasury with any attached value. * @param willHash Commitment to the encrypted will document (version 1). * @param willURI Pointer to the will vault in decentralized storage. * @param agentId The ERC-8004 identity registered for the afterlife agent. * @param deathOracle The mechanism authorized to attest the testator's death. * @return willId The unique identifier of the newly created agentic will. */ function createWill( bytes32 willHash, string calldata willURI, uint256 agentId, address deathOracle ) external payable returns (uint256 willId); /** @notice Signs a new version of the will. A will is not merely a final * declaration but a living negotiation with one's future absence. * MUST revert unless called by the testator while the will is Living. * @param willId The unique identifier of the agentic will. * @param newWillHash Commitment to the revised will document. * @param newWillURI Pointer to the revised will in the will vault. * @return version The monotonically increasing version number. */ function reviseWill( uint256 willId, bytes32 newWillHash, string calldata newWillURI ) external returns (uint64 version); /** @notice Revokes the will entirely and returns treasury funds to the testator. * MUST revert unless called by the testator while the will is Living. * @param willId The unique identifier of the agentic will. */ function revokeWill(uint256 willId) external; /** @notice Attests the death of the testator. * MUST revert unless called by the death oracle designated at creation. * Proof of death is one of the most sensitive interfaces between biological * life and technical infrastructure; see Security Considerations. * @param willId The unique identifier of the agentic will. * @param evidence Offchain evidence supporting the attestation. */ function attestDeath(uint256 willId, bytes calldata evidence) external; /** @notice Activates the afterlife agent after death has been attested. * Hands control of the treasury to the agent, which thereafter sustains its * own compute, storage, and delegated ERC-8183 afterlife work. * MUST revert if no valid death attestation exists or the will is Revoked. * @param willId The unique identifier of the agentic will. * @return agent The address of the activated self-sovereign afterlife agent. */ function activateAgent(uint256 willId) external returns (address agent); /** @notice Adds funds to the will's treasury, before or after activation. * The treasury is what allows the will to operate as a long-term budgeted * process: a constitutional instruction set coupled with assets, memory, * commerce, and delegated execution. * @param willId The unique identifier of the agentic will. */ function fundTreasury(uint256 willId) external payable; /** @notice Halts an activated afterlife agent. * MUST revert unless `governanceProof` satisfies the termination mechanism * that the testator consented to in the core will (e.g. a court order * attestation, a descendant multisig, or a community vote). * @param willId The unique identifier of the agentic will. * @param governanceProof Proof satisfying the consented termination clause. */ function terminateAgent(uint256 willId, bytes calldata governanceProof) external; /// @notice Returns the lifecycle state of an agentic will. function stateOf(uint256 willId) external view returns (WillState); /// @notice Returns the current signed will commitment and its metadata. function willOf(uint256 willId) external view returns ( address testator, uint256 agentId, uint64 version, bytes32 willHash, string memory willURI ); }