What it does:
Allows users to designate beneficiaries for their digital assets (crypto, NFTs, documents, subscriptions) and automate transfer or access upon death verification.
Why it matters:
Ensures digital assets are preserved and transferred according to the owner’s wishes, prevents loss or unauthorized access, and provides transparent, verifiable inheritance.
How it works:
Users register digital assets and assign beneficiaries on-chain
Smart contract locks assets securely until triggering conditions are met (e.g., death verification by oracles)
Beneficiaries gain access automatically once conditions are verified
Assets can include wallets, NFTs, subscriptions, and other tokenized digital content
Integrates with Smart Will & Testament, Time-Capsule Messages, and decentralized storage
Dashboards show asset status, beneficiary assignments, and unlock conditions
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title DigitalLegacyManagement
* @author Nam
* @notice Manages inheritance of digital assets and automated beneficiary access on-chain
*/
contract DigitalLegacyManagement is Ownable {
struct Asset {
address owner;
address payable beneficiary;
string assetType; // e.g., NFT, wallet, document
string assetIdentifier; // e.g., contract address or IPFS hash
bool transferred;
}
mapping(uint256 => Asset) public assets;
uint256 public assetCount;
mapping(address => bool) public authorizedOracles;
// -------------------- EVENTS --------------------
event OracleApproved(address oracle);
event OracleRevoked(address oracle);
event AssetRegistered(uint256 indexed assetId, address owner, address beneficiary);
event AssetTransferred(uint256 indexed assetId, address beneficiary);
// -------------------- ORACLE MANAGEMENT --------------------
function approveOracle(address _oracle) external onlyOwner {
authorizedOracles[_oracle] = true;
emit OracleApproved(_oracle);
}
function revokeOracle(address _oracle) external onlyOwner {
authorizedOracles[_oracle] = false;
emit OracleRevoked(_oracle);
}
modifier onlyOracle() {
require(authorizedOracles[msg.sender], "Not authorized oracle");
_;
}
// -------------------- ASSET MANAGEMENT --------------------
function registerAsset(address payable _beneficiary, string calldata _assetType, string calldata _assetIdentifier) external {
require(_beneficiary != address(0), "Invalid beneficiary");
assetCount += 1;
assets[assetCount] = Asset({
owner: msg.sender,
beneficiary: _beneficiary,
assetType: _assetType,
assetIdentifier: _assetIdentifier,
transferred: false
});
emit AssetRegistered(assetCount, msg.sender, _beneficiary);
}
function transferAsset(uint256 _assetId) external onlyOracle {
Asset storage a = assets[_assetId];
require(!a.transferred, "Asset already transferred");
a.transferred = true;
// Transfer logic depends on asset type; for ETH or ERC20/721 it would be integrated here
// For demo purposes, we only mark as transferred
emit AssetTransferred(_assetId, a.beneficiary);
}
// -------------------- VIEW FUNCTIONS --------------------
function getAsset(uint256 _assetId) external view returns (Asset memory) {
return assets[_assetId];
}
}
Build and Grow By Nam Le Thanh