Files
smom-dbis-138/contracts/rwa/diamond/libraries/RWAUriCodec.sol
defiQUG c336809676
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m3s
CI/CD Pipeline / Security Scanning (push) Successful in 2m18s
CI/CD Pipeline / Lint and Format (push) Failing after 34s
CI/CD Pipeline / Terraform Validation (push) Failing after 20s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 22s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 40s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 49s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 21s
Validation / validate-genesis (push) Successful in 25s
Validation / validate-terraform (push) Failing after 21s
Validation / validate-kubernetes (push) Failing after 8s
Validation / validate-smart-contracts (push) Failing after 8s
Validation / validate-security (push) Failing after 1m11s
Validation / validate-documentation (push) Failing after 14s
Verify Deployment / Verify Deployment (push) Failing after 45s
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 <cursoragent@cursor.com>
2026-05-25 00:30:45 -07:00

41 lines
1.4 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "../RWAStorage.sol";
/**
* @title RWAUriCodec
* @notice Canonical URI hashing for IPFS, Filecoin, Arweave, HTTPS, internal refs.
*/
library RWAUriCodec {
error RWAUriCodec_invalidUri(string uri);
function uriHash(string memory uri) internal pure returns (bytes32) {
bytes memory b = bytes(uri);
if (b.length == 0) revert RWAUriCodec_invalidUri(uri);
return keccak256(b);
}
function detectScheme(string memory uri) internal pure returns (RWAStorage.UriScheme) {
bytes memory b = bytes(uri);
if (b.length < 7) return RWAStorage.UriScheme.None;
if (_startsWith(b, "ipfs://")) return RWAStorage.UriScheme.IPFS;
if (_startsWith(b, "filecoin://")) return RWAStorage.UriScheme.Filecoin;
if (_startsWith(b, "ar://") || _startsWith(b, "arweave://")) {
return RWAStorage.UriScheme.Arweave;
}
if (_startsWith(b, "https://")) return RWAStorage.UriScheme.HTTPS;
if (_startsWith(b, "dbis://")) return RWAStorage.UriScheme.InternalDB;
return RWAStorage.UriScheme.None;
}
function _startsWith(bytes memory data, string memory prefix) private pure returns (bool) {
bytes memory p = bytes(prefix);
if (data.length < p.length) return false;
for (uint256 i = 0; i < p.length; i++) {
if (data[i] != p[i]) return false;
}
return true;
}
}