Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
55 lines
2.3 KiB
Solidity
Executable File
55 lines
2.3 KiB
Solidity
Executable File
// SPDX-License-Identifier: MIT
|
|
// OpenZeppelin Contracts (last updated v5.2.0) (utils/CAIP10.sol)
|
|
|
|
pragma solidity ^0.8.24;
|
|
|
|
import {Bytes} from "./Bytes.sol";
|
|
import {Strings} from "./Strings.sol";
|
|
import {CAIP2} from "./CAIP2.sol";
|
|
|
|
/**
|
|
* @dev Helper library to format and parse CAIP-10 identifiers
|
|
*
|
|
* https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md[CAIP-10] defines account identifiers as:
|
|
* account_id: chain_id + ":" + account_address
|
|
* chain_id: [-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32} (See {CAIP2})
|
|
* account_address: [-.%a-zA-Z0-9]{1,128}
|
|
*
|
|
* WARNING: According to [CAIP-10's canonicalization section](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-10.md#canonicalization),
|
|
* the implementation remains at the developer's discretion. Please note that case variations may introduce ambiguity.
|
|
* For example, when building hashes to identify accounts or data associated to them, multiple representations of the
|
|
* same account would derive to different hashes. For EVM chains, we recommend using checksummed addresses for the
|
|
* "account_address" part. They can be generated onchain using {Strings-toChecksumHexString}.
|
|
*/
|
|
library CAIP10 {
|
|
using Strings for address;
|
|
using Bytes for bytes;
|
|
|
|
/// @dev Return the CAIP-10 identifier for an account on the current (local) chain.
|
|
function local(address account) internal view returns (string memory) {
|
|
return format(CAIP2.local(), account.toChecksumHexString());
|
|
}
|
|
|
|
/**
|
|
* @dev Return the CAIP-10 identifier for a given caip2 chain and account.
|
|
*
|
|
* NOTE: This function does not verify that the inputs are properly formatted.
|
|
*/
|
|
function format(string memory caip2, string memory account) internal pure returns (string memory) {
|
|
return string.concat(caip2, ":", account);
|
|
}
|
|
|
|
/**
|
|
* @dev Parse a CAIP-10 identifier into its components.
|
|
*
|
|
* NOTE: This function does not verify that the CAIP-10 input is properly formatted. The `caip2` return can be
|
|
* parsed using the {CAIP2} library.
|
|
*/
|
|
function parse(string memory caip10) internal pure returns (string memory caip2, string memory account) {
|
|
bytes memory buffer = bytes(caip10);
|
|
|
|
uint256 pos = buffer.lastIndexOf(":");
|
|
return (string(buffer.slice(0, pos)), string(buffer.slice(pos + 1)));
|
|
}
|
|
}
|