Files
smom-dbis-138/contracts/rwa/libraries/RWATaxonomy.sol
T
defiQUGandCursor 651fb59786 Add mainnet checkpoint stack: ISO attestation, participant Etherscan surface, and services.
Ship AddressActivityRegistry V1/V2, ISO20022IntakeGateway, Chain138ParticipantSurface,
checkpoint hub contracts, checkpoint-core package, aggregator/indexer/sdk services,
relay profile guards, M00 diamond bridge facet, and OMNL compliance contracts.

Co-authored-by: Cursor <[email protected]>
2026-06-24 21:54:05 -07:00

55 lines
1.8 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title RWATaxonomy
* @notice On-chain validation helpers for M00 Li* index instruments (not M1 c* eMoney).
*/
library RWATaxonomy {
bytes32 public constant GRU_LAYER_M00 = keccak256("M00");
bytes32 public constant ASSET_CLASS_COMMODITIES = keccak256("Commodities");
bytes32 public constant TICKER_LIXAU = keccak256("LiXAU");
bytes32 public constant TICKER_LIPMG = keccak256("LiPMG");
bytes32 public constant TICKER_LIBMG1 = keccak256("LiBMG1");
bytes32 public constant TICKER_LIBMG2 = keccak256("LiBMG2");
bytes32 public constant TICKER_LIBMG3 = keccak256("LiBMG3");
error InvalidIndexTicker();
error InvalidAssetClass();
error InvalidGruLayer();
error EmptyString();
function hashString(string memory value) internal pure returns (bytes32) {
return keccak256(bytes(value));
}
function isAllowedIndexTicker(bytes32 tickerHash) internal pure returns (bool) {
return tickerHash == TICKER_LIXAU
|| tickerHash == TICKER_LIPMG
|| tickerHash == TICKER_LIBMG1
|| tickerHash == TICKER_LIBMG2
|| tickerHash == TICKER_LIBMG3;
}
function validateProduct(
string memory indexTicker,
string memory assetClass,
string memory gruLayer
) internal pure returns (bytes32 tickerHash) {
if (bytes(indexTicker).length == 0 || bytes(assetClass).length == 0) {
revert EmptyString();
}
tickerHash = hashString(indexTicker);
if (!isAllowedIndexTicker(tickerHash)) {
revert InvalidIndexTicker();
}
if (hashString(assetClass) != ASSET_CLASS_COMMODITIES) {
revert InvalidAssetClass();
}
if (hashString(gruLayer) != GRU_LAYER_M00) {
revert InvalidGruLayer();
}
}
}