// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "../interfaces/INumenAssetRegistry.sol";
import "../libraries/NumenAssetTypes.sol";
/**
* @title NumenAssetRegistry
* @notice Canonical asset discovery and identity registry for the
* Numen Asset Protocol.
*
* Canonical registration is self-registration:
*
* msg.sender == request.assetContract
*
* Canonical scoped identity:
*
* assetContract + scope + tokenId
*
* Registration does not prove physical authenticity, legal ownership,
* regulatory compliance, provenance, issuer legitimacy or metadata
* correctness.
*
* Controller transfers use a two-step propose/accept process.
*
* Inactive assets preserve their historical registry record but
* mutable metadata and classification updates are locked until the
* asset is reactivated.
*/
contract NumenAssetRegistry is INumenAssetRegistry {
// =============================================================
// ERRORS
// =============================================================
error ZeroAddress();
error InvalidAssetContract();
error InvalidAssetClass();
error InvalidAssetStandard();
error InvalidClassStandardCombination();
error InvalidAssetScope();
error InvalidScopeTokenCombination();
error UnauthorizedAssetRegistration(
address caller,
address assetContract
);
error AssetAlreadyRegistered(
address assetContract,
NumenAssetTypes.AssetScope scope,
uint256 tokenId
);
error AssetNotFound(
bytes32 assetId
);
error AssetAlreadyActive(
bytes32 assetId
);
error AssetAlreadyInactive(
bytes32 assetId
);
error AssetInactive(
bytes32 assetId
);
error Unauthorized(
bytes32 assetId,
address caller
);
error InvalidIndex(
uint256 index,
uint256 length
);
error SameController();
error NoPendingControllerTransfer(
bytes32 assetId
);
error UnauthorizedPendingController(
bytes32 assetId,
address caller,
address expectedController
);
// =============================================================
// CONSTANTS
// =============================================================
bytes32 private constant _REGISTRY_VERSION =
keccak256(
"NUMEN_ASSET_REGISTRY_V2"
);
// =============================================================
// STORAGE
// =============================================================
uint256 private _registrationNonce;
mapping(bytes32 => AssetRecord)
private _assets;
mapping(bytes32 => bool)
private _assetExists;
mapping(
address =>
mapping(
NumenAssetTypes.AssetScope =>
mapping(
uint256 => bytes32
)
)
)
private _assetIdsByIdentity;
bytes32[] private _allAssetIds;
mapping(address => bytes32[])
private _creatorAssetIds;
mapping(address => bytes32[])
private _controllerAssetIds;
mapping(bytes32 => uint256)
private _controllerAssetIndexes;
mapping(bytes32 => address)
private _pendingAssetControllers;
// =============================================================
// MODIFIERS
// =============================================================
modifier onlyExistingAsset(
bytes32 assetId
) {
if (!_assetExists[assetId]) {
revert AssetNotFound(
assetId
);
}
_;
}
modifier onlyAssetController(
bytes32 assetId
) {
if (!_assetExists[assetId]) {
revert AssetNotFound(
assetId
);
}
if (
_assets[assetId]
.controller !=
msg.sender
) {
revert Unauthorized(
assetId,
msg.sender
);
}
_;
}
modifier onlyActiveAsset(
bytes32 assetId
) {
if (!_assetExists[assetId]) {
revert AssetNotFound(
assetId
);
}
if (
!_assets[
assetId
].active
) {
revert AssetInactive(
assetId
);
}
_;
}
// =============================================================
// PROTOCOL INFORMATION
// =============================================================
function registryVersion()
external
pure
override
returns (bytes32)
{
return _REGISTRY_VERSION;
}
// =============================================================
// REGISTRATION
// =============================================================
function registerAsset(
RegisterAssetRequest calldata request
)
external
override
returns (
bytes32 assetId
)
{
_validateRegistrationRequest(
request
);
if (
msg.sender !=
request.assetContract
) {
revert UnauthorizedAssetRegistration(
msg.sender,
request.assetContract
);
}
if (
_assetIdsByIdentity[
request.assetContract
][
request.scope
][
request.tokenId
] != bytes32(0)
) {
revert AssetAlreadyRegistered(
request.assetContract,
request.scope,
request.tokenId
);
}
unchecked {
++_registrationNonce;
}
assetId = keccak256(
abi.encode(
block.chainid,
address(this),
request.assetContract,
request.scope,
request.tokenId,
request.creator,
_registrationNonce
)
);
assert(
assetId !=
bytes32(0)
);
uint64 timestamp =
uint64(
block.timestamp
);
AssetRecord storage record =
_assets[
assetId
];
record.assetId =
assetId;
record.assetClass =
request.assetClass;
record.standard =
request.standard;
record.scope =
request.scope;
record.category =
request.category;
record.representation =
request.representation;
record.assetContract =
request.assetContract;
record.tokenId =
request.tokenId;
record.creator =
request.creator;
record.controller =
request.controller;
record.metadataURI =
request.metadataURI;
record.metadataHash =
request.metadataHash;
record.createdAt =
timestamp;
record.updatedAt =
timestamp;
record.active =
true;
_assetExists[
assetId
] = true;
_assetIdsByIdentity[
request.assetContract
][
request.scope
][
request.tokenId
] = assetId;
_allAssetIds.push(
assetId
);
_creatorAssetIds[
request.creator
].push(
assetId
);
_addControllerAsset(
request.controller,
assetId
);
emit AssetRegistered(
assetId,
request.assetContract,
request.creator,
request.scope,
request.tokenId,
request.assetClass,
request.standard,
request.category,
request.representation
);
}
// =============================================================
// LOOKUPS
// =============================================================
function assetExists(
bytes32 assetId
)
external
view
override
returns (bool)
{
return
_assetExists[
assetId
];
}
function isAssetActive(
bytes32 assetId
)
external
view
override
returns (bool)
{
if (
!_assetExists[
assetId
]
) {
return false;
}
return
_assets[
assetId
].active;
}
function getAsset(
bytes32 assetId
)
external
view
override
onlyExistingAsset(
assetId
)
returns (
AssetRecord memory
)
{
return
_assets[
assetId
];
}
function getAssetId(
address assetContract,
NumenAssetTypes.AssetScope scope,
uint256 tokenId
)
external
view
override
returns (
bytes32
)
{
return
_assetIdsByIdentity[
assetContract
][
scope
][
tokenId
];
}
function isRegisteredAsset(
address assetContract,
NumenAssetTypes.AssetScope scope,
uint256 tokenId
)
external
view
override
returns (bool)
{
return (
_assetIdsByIdentity[
assetContract
][
scope
][
tokenId
] !=
bytes32(0)
);
}
// =============================================================
// COUNTERS
// =============================================================
function totalAssets()
external
view
override
returns (
uint256
)
{
return
_allAssetIds.length;
}
function assetIdAt(
uint256 index
)
external
view
override
returns (
bytes32
)
{
uint256 length =
_allAssetIds.length;
if (
index >= length
) {
revert InvalidIndex(
index,
length
);
}
return
_allAssetIds[
index
];
}
// =============================================================
// CREATOR INDEX
// =============================================================
function creatorAssetCount(
address creator
)
external
view
override
returns (
uint256
)
{
return
_creatorAssetIds[
creator
].length;
}
function creatorAssetIdAt(
address creator,
uint256 index
)
external
view
override
returns (
bytes32
)
{
uint256 length =
_creatorAssetIds[
creator
].length;
if (
index >= length
) {
revert InvalidIndex(
index,
length
);
}
return
_creatorAssetIds[
creator
][
index
];
}
// =============================================================
// CONTROLLER INDEX
// =============================================================
function controllerAssetCount(
address controller
)
external
view
override
returns (
uint256
)
{
return
_controllerAssetIds[
controller
].length;
}
function controllerAssetIdAt(
address controller,
uint256 index
)
external
view
override
returns (
bytes32
)
{
uint256 length =
_controllerAssetIds[
controller
].length;
if (
index >= length
) {
revert InvalidIndex(
index,
length
);
}
return
_controllerAssetIds[
controller
][
index
];
}
// =============================================================
// CLASSIFICATION
// =============================================================
function updateClassification(
bytes32 assetId,
NumenAssetTypes.AssetCategory
category,
NumenAssetTypes.RepresentationType
representation
)
external
override
onlyAssetController(
assetId
)
onlyActiveAsset(
assetId
)
{
AssetRecord storage record =
_assets[
assetId
];
record.category =
category;
record.representation =
representation;
record.updatedAt =
uint64(
block.timestamp
);
emit AssetClassificationUpdated(
assetId,
category,
representation,
msg.sender
);
}
// =============================================================
// METADATA
// =============================================================
function updateMetadata(
bytes32 assetId,
string calldata metadataURI,
bytes32 metadataHash
)
external
override
onlyAssetController(
assetId
)
onlyActiveAsset(
assetId
)
{
AssetRecord storage record =
_assets[
assetId
];
record.metadataURI =
metadataURI;
record.metadataHash =
metadataHash;
record.updatedAt =
uint64(
block.timestamp
);
emit AssetMetadataUpdated(
assetId,
metadataURI,
metadataHash,
msg.sender
);
}
// =============================================================
// CONTROLLER MANAGEMENT
// =============================================================
function proposeAssetController(
bytes32 assetId,
address newController
)
external
override
onlyAssetController(
assetId
)
{
if (
newController ==
address(0)
) {
revert ZeroAddress();
}
address currentController =
_assets[
assetId
].controller;
if (
newController ==
currentController
) {
revert SameController();
}
_pendingAssetControllers[
assetId
] =
newController;
emit AssetControllerTransferProposed(
assetId,
currentController,
newController
);
}
function acceptAssetController(
bytes32 assetId
)
external
override
onlyExistingAsset(
assetId
)
{
address pendingController =
_pendingAssetControllers[
assetId
];
if (
pendingController ==
address(0)
) {
revert NoPendingControllerTransfer(
assetId
);
}
if (
msg.sender !=
pendingController
) {
revert UnauthorizedPendingController(
assetId,
msg.sender,
pendingController
);
}
AssetRecord storage record =
_assets[
assetId
];
address previousController =
record.controller;
delete
_pendingAssetControllers[
assetId
];
_removeControllerAsset(
previousController,
assetId
);
record.controller =
pendingController;
record.updatedAt =
uint64(
block.timestamp
);
_addControllerAsset(
pendingController,
assetId
);
emit AssetControllerTransferred(
assetId,
previousController,
pendingController
);
}
function cancelAssetControllerTransfer(
bytes32 assetId
)
external
override
onlyAssetController(
assetId
)
{
address pendingController =
_pendingAssetControllers[
assetId
];
if (
pendingController ==
address(0)
) {
revert NoPendingControllerTransfer(
assetId
);
}
delete
_pendingAssetControllers[
assetId
];
emit AssetControllerTransferCancelled(
assetId,
msg.sender,
pendingController
);
}
function pendingAssetController(
bytes32 assetId
)
external
view
override
onlyExistingAsset(
assetId
)
returns (address)
{
return
_pendingAssetControllers[
assetId
];
}
// =============================================================
// ACTIVE STATUS
// =============================================================
function deactivateAsset(
bytes32 assetId
)
external
override
onlyAssetController(
assetId
)
{
AssetRecord storage record =
_assets[
assetId
];
if (!record.active) {
revert AssetAlreadyInactive(
assetId
);
}
record.active =
false;
record.updatedAt =
uint64(
block.timestamp
);
emit AssetDeactivated(
assetId,
msg.sender
);
}
function reactivateAsset(
bytes32 assetId
)
external
override
onlyAssetController(
assetId
)
{
AssetRecord storage record =
_assets[
assetId
];
if (record.active) {
revert AssetAlreadyActive(
assetId
);
}
record.active =
true;
record.updatedAt =
uint64(
block.timestamp
);
emit AssetReactivated(
assetId,
msg.sender
);
}
// =============================================================
// INTERNAL VALIDATION
// =============================================================
function _validateRegistrationRequest(
RegisterAssetRequest calldata request
)
internal
view
{
if (
request.assetContract ==
address(0) ||
request.creator ==
address(0) ||
request.controller ==
address(0)
) {
revert ZeroAddress();
}
if (
request
.assetContract
.code
.length == 0
) {
revert InvalidAssetContract();
}
if (
uint8(
request.assetClass
) >
uint8(
NumenAssetTypes
.AssetClass
.NON_FUNGIBLE
)
) {
revert InvalidAssetClass();
}
if (
request.standard ==
NumenAssetTypes
.AssetStandard
.NONE
) {
revert InvalidAssetStandard();
}
if (
uint8(
request.scope
) >
uint8(
NumenAssetTypes
.AssetScope
.TOKEN
)
) {
revert InvalidAssetScope();
}
bool validCombination;
if (
request.assetClass ==
NumenAssetTypes
.AssetClass
.FUNGIBLE
) {
validCombination =
request.standard ==
NumenAssetTypes
.AssetStandard
.ERC20;
} else {
validCombination =
request.standard ==
NumenAssetTypes
.AssetStandard
.ERC721 ||
request.standard ==
NumenAssetTypes
.AssetStandard
.ERC1155;
}
if (
!validCombination
) {
revert InvalidClassStandardCombination();
}
/*
* ERC20:
*
* CONTRACT / 0 only.
*/
if (
request.standard ==
NumenAssetTypes
.AssetStandard
.ERC20
) {
if (
request.scope !=
NumenAssetTypes
.AssetScope
.CONTRACT ||
request.tokenId != 0
) {
revert InvalidScopeTokenCombination();
}
return;
}
/*
* ERC721 / ERC1155:
*
* CONTRACT scope requires tokenId 0.
*
* TOKEN scope may use any uint256 tokenId,
* including tokenId 0.
*/
if (
request.scope ==
NumenAssetTypes
.AssetScope
.CONTRACT &&
request.tokenId != 0
) {
revert InvalidScopeTokenCombination();
}
}
// =============================================================
// INTERNAL CONTROLLER INDEX
// =============================================================
function _addControllerAsset(
address controller,
bytes32 assetId
)
internal
{
_controllerAssetIndexes[
assetId
] =
_controllerAssetIds[
controller
].length;
_controllerAssetIds[
controller
].push(
assetId
);
}
function _removeControllerAsset(
address controller,
bytes32 assetId
)
internal
{
bytes32[] storage assets =
_controllerAssetIds[
controller
];
uint256 removeIndex =
_controllerAssetIndexes[
assetId
];
uint256 lastIndex =
assets.length - 1;
if (
removeIndex !=
lastIndex
) {
bytes32 lastAssetId =
assets[
lastIndex
];
assets[
removeIndex
] =
lastAssetId;
_controllerAssetIndexes[
lastAssetId
] =
removeIndex;
}
assets.pop();
delete
_controllerAssetIndexes[
assetId
];
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "../libraries/NumenAssetTypes.sol";
/**
* @title INumenAssetRegistry
* @notice Canonical registry interface for the Numen Asset Protocol.
*
* Registration means that an asset record exists in the
* Numen Asset Protocol.
*
* Registration does NOT by itself prove physical authenticity,
* legal ownership, regulatory compliance, provenance, issuer
* legitimacy or correctness of metadata.
*/
interface INumenAssetRegistry {
// =============================================================
// EVENTS
// =============================================================
event AssetRegistered(
bytes32 indexed assetId,
address indexed assetContract,
address indexed creator,
NumenAssetTypes.AssetScope scope,
uint256 tokenId,
NumenAssetTypes.AssetClass assetClass,
NumenAssetTypes.AssetStandard standard,
NumenAssetTypes.AssetCategory category,
NumenAssetTypes.RepresentationType representation
);
event AssetClassificationUpdated(
bytes32 indexed assetId,
NumenAssetTypes.AssetCategory category,
NumenAssetTypes.RepresentationType representation,
address indexed updatedBy
);
event AssetMetadataUpdated(
bytes32 indexed assetId,
string metadataURI,
bytes32 metadataHash,
address indexed updatedBy
);
event AssetDeactivated(
bytes32 indexed assetId,
address indexed deactivatedBy
);
event AssetReactivated(
bytes32 indexed assetId,
address indexed reactivatedBy
);
/**
* @notice Emitted when the current controller proposes a new
* controller.
*/
event AssetControllerTransferProposed(
bytes32 indexed assetId,
address indexed currentController,
address indexed proposedController
);
/**
* @notice Emitted when a pending controller transfer is cancelled.
*/
event AssetControllerTransferCancelled(
bytes32 indexed assetId,
address indexed controller,
address indexed cancelledProposedController
);
/**
* @notice Emitted only after the proposed controller explicitly
* accepts control.
*/
event AssetControllerTransferred(
bytes32 indexed assetId,
address indexed previousController,
address indexed newController
);
// =============================================================
// REGISTRATION REQUEST
// =============================================================
struct RegisterAssetRequest {
NumenAssetTypes.AssetClass assetClass;
NumenAssetTypes.AssetStandard standard;
NumenAssetTypes.AssetScope scope;
NumenAssetTypes.AssetCategory category;
NumenAssetTypes.RepresentationType representation;
address assetContract;
uint256 tokenId;
address creator;
address controller;
string metadataURI;
bytes32 metadataHash;
}
// =============================================================
// REGISTRY RECORD
// =============================================================
struct AssetRecord {
bytes32 assetId;
NumenAssetTypes.AssetClass assetClass;
NumenAssetTypes.AssetStandard standard;
NumenAssetTypes.AssetScope scope;
NumenAssetTypes.AssetCategory category;
NumenAssetTypes.RepresentationType representation;
address assetContract;
uint256 tokenId;
address creator;
address controller;
string metadataURI;
bytes32 metadataHash;
uint64 createdAt;
uint64 updatedAt;
bool active;
}
// =============================================================
// REGISTRATION
// =============================================================
function registerAsset(
RegisterAssetRequest calldata request
)
external
returns (bytes32 assetId);
// =============================================================
// LOOKUPS
// =============================================================
function assetExists(
bytes32 assetId
)
external
view
returns (bool);
function isAssetActive(
bytes32 assetId
)
external
view
returns (bool);
function getAsset(
bytes32 assetId
)
external
view
returns (AssetRecord memory);
function getAssetId(
address assetContract,
NumenAssetTypes.AssetScope scope,
uint256 tokenId
)
external
view
returns (bytes32);
function isRegisteredAsset(
address assetContract,
NumenAssetTypes.AssetScope scope,
uint256 tokenId
)
external
view
returns (bool);
// =============================================================
// COUNTERS
// =============================================================
function totalAssets()
external
view
returns (uint256);
function assetIdAt(
uint256 index
)
external
view
returns (bytes32);
// =============================================================
// CREATOR / CONTROLLER INDEX
// =============================================================
function creatorAssetCount(
address creator
)
external
view
returns (uint256);
function creatorAssetIdAt(
address creator,
uint256 index
)
external
view
returns (bytes32);
function controllerAssetCount(
address controller
)
external
view
returns (uint256);
function controllerAssetIdAt(
address controller,
uint256 index
)
external
view
returns (bytes32);
// =============================================================
// MUTABLE DATA
// =============================================================
function updateClassification(
bytes32 assetId,
NumenAssetTypes.AssetCategory category,
NumenAssetTypes.RepresentationType representation
)
external;
function updateMetadata(
bytes32 assetId,
string calldata metadataURI,
bytes32 metadataHash
)
external;
// =============================================================
// CONTROLLER MANAGEMENT
// =============================================================
/**
* @notice Proposes transfer of control to a new address.
*
* @dev The proposed controller receives no authority until
* acceptAssetController() is called by that address.
*/
function proposeAssetController(
bytes32 assetId,
address newController
)
external;
/**
* @notice Accepts a pending controller transfer.
*
* @dev Only the currently proposed controller may accept.
*/
function acceptAssetController(
bytes32 assetId
)
external;
/**
* @notice Cancels the pending controller transfer.
*
* @dev Only the current controller may cancel.
*/
function cancelAssetControllerTransfer(
bytes32 assetId
)
external;
/**
* @notice Returns the currently proposed controller.
*
* @return Zero address when no transfer is pending.
*/
function pendingAssetController(
bytes32 assetId
)
external
view
returns (address);
// =============================================================
// ACTIVE STATUS
// =============================================================
function deactivateAsset(
bytes32 assetId
)
external;
function reactivateAsset(
bytes32 assetId
)
external;
// =============================================================
// PROTOCOL INFORMATION
// =============================================================
function registryVersion()
external
pure
returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/**
* @title NumenAssetTypes
* @notice Shared data types for the Numen Asset Protocol.
*
* @dev
* This library defines the common vocabulary used by:
*
* - Fungible assets
* - Non-fungible assets
* - Real-world assets (RWA)
* - Digital twins
* - Physical / 3D-linked assets
* - Product passports
* - Certificates
* - Collections
* - Future Numen Object Registry integrations
*
* IMPORTANT:
*
* A physical or 3D association does NOT by itself prove authenticity,
* legal ownership, provenance, or physical-world identity.
*
* Verification and attestation states must be represented separately.
*/
library NumenAssetTypes {
// =============================================================
// ASSET CLASS
// =============================================================
/**
* @notice Fundamental economic class of an asset.
*/
enum AssetClass {
FUNGIBLE,
NON_FUNGIBLE
}
// =============================================================
// ASSET STANDARD
// =============================================================
/**
* @notice Technical representation used by an asset.
*
* NONE is useful for registry records that are not themselves
* represented by a token contract.
*/
enum AssetStandard {
NONE,
ERC20,
ERC721,
ERC1155
}
// =============================================================
// ASSET SCOPE
// =============================================================
/**
* @notice Defines whether a registry record represents an entire
* token contract / collection or one individual token ID.
*
* CONTRACT:
* - ERC20 assets
* - ERC721 collection-level records
* - ERC1155 collection-level records
*
* TOKEN:
* - Individual ERC721 tokens
* - Individual ERC1155 token types
*
* Scope is part of canonical Numen asset identity.
*
* This makes the following two identities distinct:
*
* contract = 0xABC...
* scope = CONTRACT
* tokenId = 0
*
* and:
*
* contract = 0xABC...
* scope = TOKEN
* tokenId = 0
*
* This distinction is required because NFT token ID 0 is valid.
*/
enum AssetScope {
CONTRACT,
TOKEN
}
// =============================================================
// ASSET CATEGORY
// =============================================================
/**
* @notice High-level semantic category of an asset.
*
* CUSTOM allows applications to provide a human-readable
* category through metadata without requiring a protocol upgrade.
*/
enum AssetCategory {
UNSPECIFIED,
CURRENCY,
PAYMENT,
UTILITY,
GOVERNANCE,
COMMUNITY,
GAMING,
COMMODITY,
REAL_ESTATE,
PRECIOUS_METAL,
PRECIOUS_STONE,
COLLECTIBLE,
ARTWORK,
CULTURAL_HERITAGE,
PRODUCT,
VEHICLE,
MACHINERY,
INTELLECTUAL_PROPERTY,
MEDIA,
CERTIFICATE,
IDENTITY,
FINANCIAL_ASSET,
CUSTOM
}
// =============================================================
// REPRESENTATION TYPE
// =============================================================
/**
* @notice Describes what the on-chain asset represents.
*
* This is deliberately separate from AssetCategory.
*
* Example:
*
* category = REAL_ESTATE
* representation = FRACTIONAL_INTEREST
*/
enum RepresentationType {
UNSPECIFIED,
DIGITAL_ASSET,
PHYSICAL_REFERENCE,
DIGITAL_TWIN,
FRACTIONAL_INTEREST,
OWNERSHIP_CLAIM,
USAGE_RIGHT,
REVENUE_RIGHT,
CERTIFICATE,
PRODUCT_PASSPORT,
MEMBERSHIP,
LICENSE,
CUSTOM
}
// =============================================================
// SUPPLY MODEL
// =============================================================
/**
* @notice Supply policy for fungible or multi-token assets.
*/
enum SupplyModel {
NOT_APPLICABLE,
FIXED,
CAPPED,
UNCAPPED
}
// =============================================================
// PROPERTY VALUE TYPE
// =============================================================
/**
* @notice Supported value types for extensible asset properties.
*
* Properties are intended for data such as:
*
* Weight -> DECIMAL
* Serial No. -> TEXT
* Certified -> BOOLEAN
* Manufacture -> DATE
* Document -> URI / HASH
*/
enum PropertyValueType {
TEXT,
INTEGER,
DECIMAL,
BOOLEAN,
DATE,
URI,
HASH,
ADDRESS,
BYTES
}
// =============================================================
// ATTESTATION TYPE
// =============================================================
/**
* @notice Semantic purpose of an attestation.
*
* An attestation means that an identifiable party made a claim.
* It does not automatically make that claim true.
*/
enum AttestationType {
CUSTOM,
ISSUER,
MANUFACTURER,
OWNERSHIP,
ORIGIN,
INSPECTION,
APPRAISAL,
CUSTODY,
AUDIT,
LEGAL,
DOCUMENT,
MODEL,
SCAN
}
// =============================================================
// VERIFICATION STATUS
// =============================================================
/**
* @notice Generic lifecycle for an independently verifiable claim.
*/
enum VerificationStatus {
NONE,
PENDING,
VERIFIED,
REJECTED,
REVOKED,
EXPIRED
}
// =============================================================
// OBJECT LINK TYPE
// =============================================================
/**
* @notice Relationship between an asset and an object record.
*
* Multiple assets may reference the same object.
*
* Example:
*
* Object
* ├── DIGITAL_TWIN -> ERC721
* ├── FRACTIONALIZATION -> ERC20
* └── CERTIFICATE -> ERC721
*/
enum ObjectLinkType {
UNSPECIFIED,
PRIMARY,
DIGITAL_TWIN,
FRACTIONALIZATION,
CERTIFICATE,
OWNERSHIP,
USAGE_RIGHT,
PROVENANCE,
CUSTOM
}
// =============================================================
// ASSET IDENTITY
// =============================================================
/**
* @notice Core registry identity for an asset.
*
* assetId:
* Protocol-generated identifier.
*
* assetContract:
* ERC20 / ERC721 / ERC1155 contract address when applicable.
*
* scope:
* CONTRACT when the record represents the whole token contract
* or collection.
*
* TOKEN when the record represents one specific ERC721 or
* ERC1155 token ID.
*
* tokenId:
* Must be 0 for CONTRACT-scoped records.
*
* For TOKEN-scoped ERC721 / ERC1155 records, this is the
* corresponding token ID. Token ID 0 is valid and is distinct
* from a CONTRACT-scoped record because scope is part of the
* canonical identity.
*/
struct AssetIdentity {
bytes32 assetId;
AssetClass assetClass;
AssetStandard standard;
AssetScope scope;
AssetCategory category;
RepresentationType representation;
address assetContract;
uint256 tokenId;
address creator;
uint64 createdAt;
}
// =============================================================
// ASSET METADATA
// =============================================================
/**
* @notice Human-readable and external metadata references.
*
* Large files and metadata should generally remain off-chain.
* Hashes can be committed on-chain independently.
*/
struct AssetMetadata {
string name;
string symbol;
string description;
string metadataURI;
bytes32 metadataHash;
}
// =============================================================
// CUSTOM PROPERTY
// =============================================================
/**
* @notice Extensible property attached to an asset.
*
* The value is encoded as bytes so the registry can support
* additional property semantics without redeploying every asset.
*
* Example:
*
* key = keccak256("weight")
* name = "Weight"
* valueType = DECIMAL
* value = abi.encode("1.75388")
* unit = "kg"
*/
struct AssetProperty {
bytes32 key;
string name;
PropertyValueType valueType;
bytes value;
string unit;
address addedBy;
uint64 createdAt;
uint64 updatedAt;
}
// =============================================================
// 3D MODEL DATA
// =============================================================
/**
* @notice Information about a digital 3D model associated
* with an asset or object.
*
* modelHash commits to the exact model bytes.
*
* spectralFingerprint may reference a separately generated
* asset-oriented geometric fingerprint.
*
* This MUST NOT be interpreted as the PoScan mining work hash
* and MUST NOT by itself be represented as proof of physical
* authenticity.
*/
struct ModelData {
string modelURI;
bytes32 modelHash;
bytes32 spectralFingerprint;
string spectralVersion;
address submittedBy;
uint64 createdAt;
}
// =============================================================
// OBJECT RECORD
// =============================================================
/**
* @notice Registry record for an object that may later be
* associated with one or more digital assets.
*
* objectId is a protocol-level identifier.
*
* The existence of an ObjectRecord means that an object record
* exists on-chain. It does NOT automatically mean the physical
* object has been independently authenticated.
*/
struct ObjectRecord {
bytes32 objectId;
address creator;
bytes32 primaryModelHash;
bytes32 spectralFingerprint;
string metadataURI;
uint64 createdAt;
bool active;
}
// =============================================================
// OBJECT BINDING
// =============================================================
/**
* @notice Relationship between an object and an asset.
*/
struct ObjectBinding {
bytes32 objectId;
bytes32 assetId;
ObjectLinkType linkType;
address createdBy;
uint64 createdAt;
bool active;
}
// =============================================================
// ATTESTATION
// =============================================================
/**
* @notice Signed/registered claim made about an asset or object.
*
* subjectId may be an assetId or objectId depending on the
* registry context.
*
* evidenceHash can commit to a report, certificate, scan,
* inspection, legal document, or other evidence.
*/
struct Attestation {
bytes32 attestationId;
bytes32 subjectId;
AttestationType attestationType;
address attester;
bytes32 evidenceHash;
string evidenceURI;
VerificationStatus status;
uint64 issuedAt;
uint64 expiresAt;
}
// =============================================================
// DOCUMENT
// =============================================================
/**
* @notice Document reference associated with an asset or object.
*
* Sensitive documents do not need to expose their contents.
* documentHash can be recorded without publishing documentURI.
*/
struct DocumentReference {
bytes32 documentId;
bytes32 subjectId;
string documentType;
string documentURI;
bytes32 documentHash;
address submittedBy;
uint64 createdAt;
}
// =============================================================
// PROVENANCE
// =============================================================
/**
* @notice Generic historical event for an asset or object.
*
* eventType is intentionally bytes32 so applications can define
* additional event types without modifying this library.
*/
struct ProvenanceEvent {
bytes32 eventId;
bytes32 subjectId;
bytes32 eventType;
address actor;
bytes32 dataHash;
string dataURI;
uint64 timestamp;
}
// =============================================================
// FUNGIBLE CONFIGURATION
// =============================================================
/**
* @notice Configuration recorded for fungible assets.
*
* Feature flags describe the deployed asset's capabilities.
* They do not themselves grant permissions.
*/
struct FungibleConfig {
SupplyModel supplyModel;
uint8 decimals;
uint256 initialSupply;
uint256 maxSupply;
bool mintable;
bool burnable;
bool pausable;
bool permitEnabled;
bool votesEnabled;
}
// =============================================================
// NON-FUNGIBLE CONFIGURATION
// =============================================================
/**
* @notice Configuration recorded for NFT / multi-token assets.
*/
struct NonFungibleConfig {
bool multiToken;
bool burnable;
bool pausable;
bool enumerable;
bool royaltyEnabled;
uint96 royaltyBps;
address royaltyReceiver;
}
}[
{
"name": "AssetAlreadyActive",
"type": "error",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
]
},
{
"name": "AssetAlreadyInactive",
"type": "error",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
]
},
{
"name": "AssetAlreadyRegistered",
"type": "error",
"inputs": [
{
"name": "assetContract",
"type": "address",
"internalType": "address"
},
{
"name": "scope",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetScope"
},
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "AssetInactive",
"type": "error",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
]
},
{
"name": "AssetNotFound",
"type": "error",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
]
},
{
"name": "InvalidAssetClass",
"type": "error",
"inputs": []
},
{
"name": "InvalidAssetContract",
"type": "error",
"inputs": []
},
{
"name": "InvalidAssetScope",
"type": "error",
"inputs": []
},
{
"name": "InvalidAssetStandard",
"type": "error",
"inputs": []
},
{
"name": "InvalidClassStandardCombination",
"type": "error",
"inputs": []
},
{
"name": "InvalidIndex",
"type": "error",
"inputs": [
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "length",
"type": "uint256",
"internalType": "uint256"
}
]
},
{
"name": "InvalidScopeTokenCombination",
"type": "error",
"inputs": []
},
{
"name": "NoPendingControllerTransfer",
"type": "error",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
]
},
{
"name": "SameController",
"type": "error",
"inputs": []
},
{
"name": "Unauthorized",
"type": "error",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "caller",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "UnauthorizedAssetRegistration",
"type": "error",
"inputs": [
{
"name": "caller",
"type": "address",
"internalType": "address"
},
{
"name": "assetContract",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "UnauthorizedPendingController",
"type": "error",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "caller",
"type": "address",
"internalType": "address"
},
{
"name": "expectedController",
"type": "address",
"internalType": "address"
}
]
},
{
"name": "ZeroAddress",
"type": "error",
"inputs": []
},
{
"name": "AssetClassificationUpdated",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "category",
"type": "uint8",
"indexed": false,
"internalType": "enum NumenAssetTypes.AssetCategory"
},
{
"name": "representation",
"type": "uint8",
"indexed": false,
"internalType": "enum NumenAssetTypes.RepresentationType"
},
{
"name": "updatedBy",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "AssetControllerTransferCancelled",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "controller",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "cancelledProposedController",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "AssetControllerTransferProposed",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "currentController",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "proposedController",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "AssetControllerTransferred",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "previousController",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newController",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "AssetDeactivated",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "deactivatedBy",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "AssetMetadataUpdated",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "metadataURI",
"type": "string",
"indexed": false,
"internalType": "string"
},
{
"name": "metadataHash",
"type": "bytes32",
"indexed": false,
"internalType": "bytes32"
},
{
"name": "updatedBy",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "AssetReactivated",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "reactivatedBy",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "AssetRegistered",
"type": "event",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"indexed": true,
"internalType": "bytes32"
},
{
"name": "assetContract",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "creator",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "scope",
"type": "uint8",
"indexed": false,
"internalType": "enum NumenAssetTypes.AssetScope"
},
{
"name": "tokenId",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "assetClass",
"type": "uint8",
"indexed": false,
"internalType": "enum NumenAssetTypes.AssetClass"
},
{
"name": "standard",
"type": "uint8",
"indexed": false,
"internalType": "enum NumenAssetTypes.AssetStandard"
},
{
"name": "category",
"type": "uint8",
"indexed": false,
"internalType": "enum NumenAssetTypes.AssetCategory"
},
{
"name": "representation",
"type": "uint8",
"indexed": false,
"internalType": "enum NumenAssetTypes.RepresentationType"
}
],
"anonymous": false
},
{
"name": "acceptAssetController",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "assetExists",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "assetIdAt",
"type": "function",
"inputs": [
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"name": "cancelAssetControllerTransfer",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "controllerAssetCount",
"type": "function",
"inputs": [
{
"name": "controller",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "controllerAssetIdAt",
"type": "function",
"inputs": [
{
"name": "controller",
"type": "address",
"internalType": "address"
},
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"name": "creatorAssetCount",
"type": "function",
"inputs": [
{
"name": "creator",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "creatorAssetIdAt",
"type": "function",
"inputs": [
{
"name": "creator",
"type": "address",
"internalType": "address"
},
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"name": "deactivateAsset",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "getAsset",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [
{
"name": "",
"type": "tuple",
"components": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "assetClass",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetClass"
},
{
"name": "standard",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetStandard"
},
{
"name": "scope",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetScope"
},
{
"name": "category",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetCategory"
},
{
"name": "representation",
"type": "uint8",
"internalType": "enum NumenAssetTypes.RepresentationType"
},
{
"name": "assetContract",
"type": "address",
"internalType": "address"
},
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "creator",
"type": "address",
"internalType": "address"
},
{
"name": "controller",
"type": "address",
"internalType": "address"
},
{
"name": "metadataURI",
"type": "string",
"internalType": "string"
},
{
"name": "metadataHash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "createdAt",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "updatedAt",
"type": "uint64",
"internalType": "uint64"
},
{
"name": "active",
"type": "bool",
"internalType": "bool"
}
],
"internalType": "struct INumenAssetRegistry.AssetRecord"
}
],
"stateMutability": "view"
},
{
"name": "getAssetId",
"type": "function",
"inputs": [
{
"name": "assetContract",
"type": "address",
"internalType": "address"
},
{
"name": "scope",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetScope"
},
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"name": "isAssetActive",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "isRegisteredAsset",
"type": "function",
"inputs": [
{
"name": "assetContract",
"type": "address",
"internalType": "address"
},
{
"name": "scope",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetScope"
},
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"name": "pendingAssetController",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"name": "proposeAssetController",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "newController",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "reactivateAsset",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "registerAsset",
"type": "function",
"inputs": [
{
"name": "request",
"type": "tuple",
"components": [
{
"name": "assetClass",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetClass"
},
{
"name": "standard",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetStandard"
},
{
"name": "scope",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetScope"
},
{
"name": "category",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetCategory"
},
{
"name": "representation",
"type": "uint8",
"internalType": "enum NumenAssetTypes.RepresentationType"
},
{
"name": "assetContract",
"type": "address",
"internalType": "address"
},
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "creator",
"type": "address",
"internalType": "address"
},
{
"name": "controller",
"type": "address",
"internalType": "address"
},
{
"name": "metadataURI",
"type": "string",
"internalType": "string"
},
{
"name": "metadataHash",
"type": "bytes32",
"internalType": "bytes32"
}
],
"internalType": "struct INumenAssetRegistry.RegisterAssetRequest"
}
],
"outputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "nonpayable"
},
{
"name": "registryVersion",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "pure"
},
{
"name": "totalAssets",
"type": "function",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"name": "updateClassification",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "category",
"type": "uint8",
"internalType": "enum NumenAssetTypes.AssetCategory"
},
{
"name": "representation",
"type": "uint8",
"internalType": "enum NumenAssetTypes.RepresentationType"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"name": "updateMetadata",
"type": "function",
"inputs": [
{
"name": "assetId",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "metadataURI",
"type": "string",
"internalType": "string"
},
{
"name": "metadataHash",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
}
]