================================================================================ CARBONCORE DEVELOPER GUIDE #01 SMART CONTRACT INFRASTRUCTURE ================================================================================ NETWORK: Ethereum Sepolia Testnet CHAIN ID: 11155111 (0xaa36a7) RPC: https://eth-sepolia.g.alchemy.com/v2/... EXPLORER: https://sepolia.etherscan.io ================================================================================ CONTRACT ADDRESSES ================================================================================ UserUID 0xdc06fD25E479D570310bA0D3b555974d6841c076 Purpose: UID-based user identity and profile management Standard: ERC-721 with extended functionality RoleManager 0x60569F3910459056dA97076b49013BF9AB843102 Purpose: Role-based access control system Roles: ADMIN, LANDOWNER, EXPERT, GOVERNMENT, BUYER, GUEST TerritoryRegistry 0x2Bb231045BcC27ec9925bB7453976c517162a5A7 Purpose: Territory registration and verification workflow Features: Multi-stage verification, expiration tracking CarbonCreditFactory 0x20ACB9DA5a312903822A46DD77728112e9735cC0 Purpose: Project creation and automated token issuance Issuance: Every 24 hours (callable by anyone) TerritoryTokenFactory 0xfC69CbCc115eB28DE6d8f3C3c5A1C19984FD4f93 Purpose: ERC-20 token deployment for territory projects Standard: ERC-20 with 18 decimals RequestManager 0xE52950D4Baa78C2caE0970F282701350f3681ee0 Purpose: Onboarding requests and workflow management Statuses: PENDING, APPROVED, REJECTED, REVISION, COMPLETED, ARCHIVED CommentManager 0x97633F9C80CAD965a2a35AD579Eb4F6060d4cd14 Purpose: Comments and metadata storage StandardValidators 0x571436936Ae7b7E6f0bEcc8Ca7E241FA390b67CC Purpose: Certification standards tracking InsuranceManager 0xE441fAD098C71F27dBa8C83E979b30c34e152Ae9 Purpose: Insurance coverage for projects OTCMarketInterface 0xDAde447FCC8B2480c76cc8E0be23eb5772966C21 Purpose: OTC marketplace semantic layer Features: Instant Buy, RFQ system OTCMarketIndex 0xd154C16A5d1fB9CE16B88F0c76593D1C28Bd046e Purpose: Order indexing and search Features: Filter, sort, pagination ================================================================================ ROLE CONSTANTS (KECCAK256 HASHES) ================================================================================ ADMIN_ROLE 0xa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775 LANDOWNER_ROLE 0xf7349b1c3bccd912e0705395f31ffe0c6540328bca90a43fb582e92a6c4fba65 EXPERT_ROLE 0xc30672a9c8070b0e2d80ad0ec34ad08dc4bb3ab082b8e26f95864700e4684fb9 GOVERNMENT_ROLE 0xd9d062b29c8756d894f301c5167d214c34d627724cd7fc859ab9329c9330cf51 BUYER_ROLE 0xf8cd32ed93fc2f9fc78152a14807c9609af3d99c5fe4dc6b106a801aaddfe90e GUEST_ROLE 0xb6a185f76b0ff8a0f9708ffce8e6b63ce2df58f28ad66179fb4e230e98d0a52f ================================================================================ BASIC CONTRACT INTERACTION ================================================================================ Connect to Contract: const provider = new ethers.providers.Web3Provider(window.ethereum); const signer = provider.getSigner(); const contract = new ethers.Contract(ADDRESS, ABI, signer); Read Data: const territory = await territoryRegistry.getTerritory(territoryId); const project = await carbonCreditFactory.getProject(projectId); Write Transaction: const tx = await contract.functionName(param1, param2); const receipt = await tx.wait(); Check Status: const isPaused = await contract.paused(); const owner = await contract.owner(); ================================================================================ SECURITY FEATURES ================================================================================ 1. ReentrancyGuard - Prevents reentrancy attacks 2. Pausable - Emergency stop capability 3. Ownable - Owner-only functions 4. Role-Based Access Control (RBAC) 5. UID-based ownership (not wallet-based) 6. Multi-signature validation for critical functions 7. Immutable blockchain records ================================================================================ KEY PRINCIPLES ================================================================================ 1. UID Authentication - Users authorized by UIDs, not wallets 2. NFT-based Rights - Carbon credit rights tied to UIDs 3. Automatic Issuance - Tokens issued every 24 hours 4. Public Functions - Anyone can trigger token issuance 5. Beneficiary System - Tokens sent to UID owner ================================================================================