Skip to content
Verified contractExactMIT

BBDToken

Address0xa1458905f9925925769193c7833abfea67e7850f
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.24

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.24+commit.e11b9ed9
Language
solidity
Optimization
Yes, 200 runs
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,327,035
Creation transaction
0xd14f6f497a…2ed4620068

contracts/4_BBDToken.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title BBD Token (BBD) - Master Global Rollout Smart Contract for Buffalo Biodiesel Inc.
 * @author Buffalo Biodiesel Inc. (NY Corp, Est. 2005, EIN: 11-3757608 | Mailing: 17 Court St, Buffalo, NY 14202)
 * @notice Stack-Optimized, Self-Contained ERC-20 Smart Contract for Base Mainnet (Chain ID: 8453).
 *         - Official Corporate Mailing Address: 17 Court Street, Buffalo, New York 14202
 *         - Active NYSDEC Part 360 & Part 364 Permitted Plant: 225 Sawyer Avenue, Tonawanda, NY 14150 (+ $20.0M Plant Upgrades)
 *         - 6-Principal Ledger Flex Hardware Roster:
 *           * 3-of-5 Corporate Safe Signers: Sumit Majumdar, Frank V. Balon, Jeremiah Lenihan, Scott Yerger, Martha Howard
 *           * Independent Physical Security & Progress Oracle: Daniel Granville
 *         - Downtown Buffalo 3-Building Purchases, $60M-Each Rehabs & 10.0 MW Nat-Gas Power Cluster ($196.0M Total):
 *           1. 65 Court Street (The Mahoney Bldg): $3.0M Purchase + $60.0M Rehab into Corporate HQ w/ 2.0 MW Nat-Gas Gensets & 45Q Scrubber ($63.0M)
 *           2. 438 Main Street (Main Court Bldg): $6.5M Purchase + $60.0M Rehab into AI Data Center & Hotel w/ 5.0 MW Nat-Gas Gensets & 45Q Scrubber ($66.5M)
 *           3. 14 Lafayette Square (The Rand Bldg): $6.5M Purchase + $60.0M Rehab into AI Data Center & Hotel w/ 3.0 MW Nat-Gas Gensets & 45Q Scrubber ($66.5M)
 *         - Gro-Green, Inc. (703-717 Elk St, 6.9 Acres - $12.0M Purchase + $12.0M BBB-WDG, PVOH Concrete Bag & Smooth Traffic Stop Lines = $24.0M)
 *         - Regional Specialty Plants: Springfield (Mayo/Butter Depackaging - $14.0M), Toledo OH (500C Biochar - $18.0M), Highland (Dual Depack/Biochar - $22.0M)
 *         - Core UCO & Food Waste Moat: 30,000 Non-Stainless Vats, $200M Oil Contract EV ($10M 2026 EBITDA @ 20x) + $110M Hard Assets + 685,850 MT CO2e/yr
 */

interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 value) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 value) external returns (bool);
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

interface IERC20Metadata is IERC20 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
}

abstract contract ReentrancyGuard {
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;
    uint256 private _status;

    constructor() {
        _status = NOT_ENTERED;
    }

    modifier nonReentrant() {
        require(_status != ENTERED, "BBD: Reentrant call");
        _status = ENTERED;
        _;
        _status = NOT_ENTERED;
    }
}

contract BBDToken is IERC20, IERC20Metadata, ReentrancyGuard {
    // --- Standard ERC-20 State ---
    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;
    uint256 private _totalSupply;
    string private _name = "BBD Token";
    string private _symbol = "BBD";

    // --- AccessControl Roles (6-Principal Ledger Flex Hardware Roster) ---
    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
    bytes32 public constant ORACLE_PROGRESS_ROLE = keccak256("ORACLE_PROGRESS_ROLE");
    bytes32 public constant TREASURY_MULTISIG_ROLE = keccak256("TREASURY_MULTISIG_ROLE");

    mapping(bytes32 => mapping(address => bool)) private _roles;
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    modifier onlyRole(bytes32 role) {
        require(hasRole(role, msg.sender), "BBD: Unauthorized role");
        _;
    }

    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role][account];
    }

    function grantRole(bytes32 role, address account) public onlyRole(DEFAULT_ADMIN_ROLE) {
        _grantRole(role, account);
    }

    function revokeRole(bytes32 role, address account) public onlyRole(DEFAULT_ADMIN_ROLE) {
        if (_roles[role][account]) {
            _roles[role][account] = false;
            emit RoleRevoked(role, account, msg.sender);
        }
    }

    function _grantRole(bytes32 role, address account) internal {
        if (!_roles[role][account]) {
            _roles[role][account] = true;
            emit RoleGranted(role, account, msg.sender);
        }
    }

    // --- Canonical Base Mainnet Native USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) ---
    IERC20 public immutable usdcToken;
    address public treasuryMultiSig;

    // --- Constitutional 50.00 GW Global Microgrid & Infrastructure Cap ---
    uint256 public constant TARGET_GLOBAL_BTM_GW = 50;
    uint256 public constant TARGET_GLOBAL_BTM_KW = 50_000_000;
    uint256 public constant STANDARD_BLOCK_SIZE_MW = 500;
    uint256 public constant TOKENS_PER_500MW_BLOCK = 500_000_000 * 1e18;
    uint256 public constant MAX_MASTER_BLUEPRINT_SUPPLY = 50_000_000_000 * 1e18;
    uint256 public constant DAY1_GENESIS_MINT_SUPPLY = 5_500_000_000 * 1e18;
    uint256 public constant MAX_BPS = 10_000;

    // --- Audited Day-1 Enterprise, Downtown Buffalo Building, Part 360 Upgrade, Vat, Slag & Carbon Constants ---
    string public constant OFFICIAL_MAILING_ADDRESS = "17 Court Street, Buffalo, New York 14202";
    string public constant CURRENT_PART360_OPERATING_PLANT = "225 Sawyer Avenue, Tonawanda, NY 14150 (NYSDEC Part 360 & Part 364 Permitted Facility + Lackawanna, NY)";
    string public constant DOWNTOWN_BUFFALO_ACQUISITIONS = "65 Court St ($3.0M Purchase + $60M Rehab = Corporate HQ) | 438 Main St ($6.5M Purchase + $60M Rehab = Data Center & Hotel) | 14 Lafayette Sq Rand Bldg ($6.5M Purchase + $60M Rehab = Data Center & Hotel) w/ 10MW Nat-Gas Gensets";
    string public constant REGIONAL_SPECIALTY_PLANTS = "Springfield (Mayo & Butter Depackaging/Cracking) | Toledo, OH (500C Biochar) | Highland (Dual Mayo/Butter Depackaging + 500C Biochar)";
    uint256 public constant COURT_ST_65_HQ_PURCHASE_USD = 3_000_000;
    uint256 public constant COURT_ST_65_HQ_REHAB_USD = 60_000_000;
    uint256 public constant MAIN_ST_438_PURCHASE_USD = 6_500_000;
    uint256 public constant MAIN_ST_438_REHAB_USD = 60_000_000;
    uint256 public constant LAFAYETTE_SQ_RAND_PURCHASE_USD = 6_500_000;
    uint256 public constant LAFAYETTE_SQ_RAND_REHAB_USD = 60_000_000;
    uint256 public constant EXISTING_FACILITIES_PART360_UPGRADES_USD = 20_000_000;
    uint256 public constant GRO_GREEN_ELK_ST_TOTAL_USD = 24_000_000;
    uint256 public constant EXISTING_BBD_HARD_ASSETS_USD = 110_000_000;
    uint256 public constant EXISTING_UCO_EBITDA_2026_USD = 10_000_000;
    uint256 public constant OIL_CONTRACT_EV_MULTIPLE = 20;
    uint256 public constant OIL_CONTRACT_ENTERPRISE_VALUE_USD = 200_000_000;
    uint256 public constant EXISTING_NON_STAINLESS_UCO_VATS = 30_000;
    uint256 public constant BETHLEHEM_STEEL_SLAG_TONS = 8_400_000;
    uint256 public constant HERO_BX_GLYCERINE_LBS_PER_YR = 600_000_000;
    uint256 public constant BBB_WDG_BIOCHAR_VALUE_ADD_PER_MT_USD = 6_500;
    uint256 public constant BATTERY_HARD_CARBON_ANODE_PER_MT_USD = 9_500;
    uint256 public constant GENESIS_2025_SINGLE_YEAR_CO2E_MT = 685_850;
    uint256 public constant GENESIS_22YR_CUMULATIVE_CO2E_MT = 6_858_500;
    string public constant GENESIS_PERMIT_ID = "BBD-EIN-11-3757608-NYSDEC-PART360-364-17COURT-65COURT3M-438MAIN6.5M-LAFAYETTE6.5M-180MREHAB-20MUPGRADES";

    // --- Corporate Structure & Wyoming Parent Holding Company Reorganization Registry ---
    string public primaryOperatingSubsidiary = "Buffalo Biodiesel Inc. (NY Corp, Est. 2005, EIN: 11-3757608 | Mailing: 17 Court St | Corporate HQ: 65 Court St | Part 360 Plant: 225 Sawyer Ave)";
    string public parentHoldingCompanyStructure = "Buffalo Biodiesel Inc. (NY Flagship Issuer; Authorized for IRC Sec. 351/368 Drop-Down Under Wyoming Parent Holding Company & Sister Project SPVs)";

    // --- Institutional OTC Benchmark Price & Floor Split ---
    uint256 public institutionalBenchmarkPriceUsdc = 5_000_000; // $5.00 USDC (6 decimals)
    uint256 public floorVaultAllocationBps = 1_500;             // 15% to USDC Floor Vault, 85% to Corporate Safe
    bool public directInstitutionalSaleActive = true;

    // --- 1. STACK-OPTIMIZED 7-TRANCHE MASTER FINANCING SCHEDULE (6 Fields Max) ---
    struct MasterFinancingTranche {
        string trancheNameAndScope;
        uint256 targetCapitalUsd;
        uint256 projectedRunRateEbitdaUsd;
        uint256 impliedEnterpriseValuationUsd;
        uint256 usdAndUsdcFundedSoFar;
        bool isCompleted;
    }

    MasterFinancingTranche[7] public masterTrancheSchedule;

    // --- 2. VERIFIED 2026 U.S. FEDERAL TAX CREDIT (45Q, 45Z, 45X, 48E) & EPA RIN LEDGER (5 Fields Max) ---
    struct UsTaxCreditAndRinLedger {
        uint256 section45QAndCorcsMT;
        uint256 section45ZCleanFuelGallonsEquiv;
        uint256 section45XAnd48ECreditsUsd;
        uint256 epaRfsRinsGeneratedD3D4D5;
        uint256 cumulativeTaxCreditCashRealizedUsd;
    }

    UsTaxCreditAndRinLedger public usIncentiveLedger;

    // --- 3. INSTITUTIONAL CREDIT & REPO COLLATERAL LOCKBOX (6 Fields Max) ---
    struct CreditCollateralLock {
        address lenderOrCustodian;
        string facilityAgreementRef;
        uint256 bbdLockedWei;
        uint256 usdLoanPrincipal;
        uint256 unlockTimestamp;
        bool isActive;
    }

    mapping(uint256 => CreditCollateralLock) public creditCollateralLocks;
    uint256 public nextLockId;
    uint256 public totalBbdLockedInCollateralWei;

    // --- 4. MASTER ON-CHAIN CATALOG: 10 VERIFIED GLOBAL DIVISIONS (6 Fields Max) ---
    struct GlobalDivisionSpec {
        string divisionName;
        string includedProductsAndTech;
        uint256 avgUnitPriceCents;
        uint256 avgUnitCostCents;
        uint256 cumulativeOutput;
        bool isActive;
    }

    GlobalDivisionSpec[10] public globalDivisions;

    struct IndividualSkuSpec {
        string skuName;
        uint256 unitPriceCents;
        uint256 unitCostCents;
        uint256 cumulativeVolume;
        bool isConfigured;
    }

    mapping(uint256 => IndividualSkuSpec) public masterSkuRegistry;

    // --- 5. PRE-LOADED 7-TIER GLOBAL ROLLOUT BLUEPRINT (6 Fields Max) ---
    struct RolloutTierSlot {
        string tierNameAndScope;
        uint256 targetBtmPowerKW;
        uint256 maxTokenAllocationWei;
        uint256 verifiedProgressBps;
        uint256 mintedSoFarWei;
        string latestAuditIpfsHash;
    }

    RolloutTierSlot[7] public rolloutBlueprint;

    // --- Global Telemetry & Treasury State ---
    uint256 public activeInstalledBtmKW;
    uint256 public usdcTreasuryReserve;
    uint256 public totalUsdcRaisedOnChain;
    uint256 public totalOffChainFedwireSettledUsd;
    uint256 public totalTokensRetiredForClaims;

    struct RetirementReceipt {
        address beneficiary;
        uint256 bbdTokensBurned;
        string registrySerialBatch;
        string retirementPurpose;
        uint256 timestamp;
    }

    mapping(uint256 => RetirementReceipt) public retirementReceipts;
    uint256 public nextReceiptId;

    // --- Events (Capped at <= 5 Parameters Each) ---
    event TierProgressUpdatedAndMinted(uint256 indexed tierId, uint256 newProgressBps, uint256 newlyMintedTokensWei, string auditIpfsHash);
    event InstitutionalTranchePurchased(address indexed buyer, uint256 usdcPaid, uint256 bbdDelivered, string allocationMemo);
    event OffChainFedwireSettled(uint256 indexed trancheId, address indexed institutionalRecipient, uint256 usdWireAmount, uint256 bbdDeliveredWei, string fedwireRef);
    event CollateralLockedForCredit(uint256 indexed lockId, address indexed lenderOrCustodian, uint256 bbdLockedWei, uint256 usdLoanPrincipal, string facilityRef);
    event CollateralReleased(uint256 indexed lockId, address indexed returnedTo, uint256 bbdAmountWei);
    event MasterTrancheUpdated(uint256 indexed trancheId, uint256 totalUsdFunded, bool isCompleted);
    event UsTaxCreditsAndRinsRecorded(uint256 total45QAndCorcsMT, uint256 total45ZGal, uint256 total45XAnd48EUsd, uint256 totalRins, uint256 totalCashRealizedUsd);
    event CorporateHoldingStructureUpdated(string parentStructure, string operatingSubsidiary);
    event TreasuryMultiSigUpdated(address indexed oldSafe, address indexed newSafe);
    event BenchmarkPriceUpdated(uint256 oldPriceUsdc, uint256 newPriceUsdc, uint256 floorBps, bool saleActive);
    event DivisionSpecAdjusted(uint256 indexed divisionId, uint256 newAvgPriceCents, uint256 newAvgCostCents, bool isActive);
    event SkuAdjusted(uint256 indexed skuId, string skuName, uint256 priceCents, uint256 costCents);
    event DivisionOutputRecorded(uint256 indexed divisionId, uint256 unitsAdded, uint256 newTotal);
    event UsdcRevenueSwept(address indexed depositor, uint256 usdcAmount, uint256 newTreasuryTotal);
    event AttributeRetired(uint256 indexed receiptId, address indexed beneficiary, uint256 bbdTokensBurned, string registrySerialBatch);
    event FloorRedemptionExecuted(address indexed holder, uint256 bbdTokensBurned, uint256 usdcPayout);

    /**
     * @param _usdcAddress Base Mainnet Native USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
     * @param _adminMultiSig Buffalo Biodiesel Inc. 3-of-5 Corporate Safe Multi-Sig Address on Base
     * @param _oracleAuditor Independent Physical Security & Progress Oracle Wallet Address (Daniel Granville)
     */
    constructor(
        address _usdcAddress,
        address _adminMultiSig,
        address _oracleAuditor
    ) {
        require(_usdcAddress != address(0), "BBD: Invalid USDC address");
        require(_adminMultiSig != address(0), "BBD: Invalid Multi-Sig address");
        require(_oracleAuditor != address(0), "BBD: Invalid Oracle address");

        usdcToken = IERC20(_usdcAddress);
        treasuryMultiSig = _adminMultiSig;

        _grantRole(DEFAULT_ADMIN_ROLE, _adminMultiSig);
        _grantRole(TREASURY_MULTISIG_ROLE, _adminMultiSig);
        _grantRole(ORACLE_PROGRESS_ROLE, _oracleAuditor);

        _initializeMasterTrancheSchedule();
        _initializeTenGlobalDivisions();
        _initializeFlagshipSkus();
        _initializeSevenRolloutTiers(_adminMultiSig);
    }

    // --- Standard ERC-20 & Burnable Functions ---
    function name() public view override returns (string memory) { return _name; }
    function symbol() public view override returns (string memory) { return _symbol; }
    function decimals() public pure override returns (uint8) { return 18; }
    function totalSupply() public view override returns (uint256) { return _totalSupply; }
    function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }

    function transfer(address to, uint256 value) public override returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function allowance(address owner, address spender) public view override returns (uint256) {
        return _allowances[owner][spender];
    }

    function approve(address spender, uint256 value) public override returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) public override returns (bool) {
        uint256 currentAllowance = _allowances[from][msg.sender];
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= value, "BBD: Insufficient allowance");
            unchecked { _approve(from, msg.sender, currentAllowance - value); }
        }
        _transfer(from, to, value);
        return true;
    }

    function burn(uint256 value) public {
        _burn(msg.sender, value);
    }

    function burnFrom(address account, uint256 value) public {
        uint256 currentAllowance = _allowances[account][msg.sender];
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= value, "BBD: Insufficient allowance");
            unchecked { _approve(account, msg.sender, currentAllowance - value); }
        }
        _burn(account, value);
    }

    function _transfer(address from, address to, uint256 value) internal {
        require(from != address(0) && to != address(0), "BBD: Zero address");
        uint256 fromBalance = _balances[from];
        require(fromBalance >= value, "BBD: Insufficient balance");
        unchecked {
            _balances[from] = fromBalance - value;
            _balances[to] += value;
        }
        emit Transfer(from, to, value);
    }

    function _mint(address account, uint256 value) internal {
        require(account != address(0), "BBD: Zero address");
        _totalSupply += value;
        unchecked { _balances[account] += value; }
        emit Transfer(address(0), account, value);
    }

    function _burn(address account, uint256 value) internal {
        require(account != address(0), "BBD: Zero address");
        uint256 accountBalance = _balances[account];
        require(accountBalance >= value, "BBD: Burn exceeds balance");
        unchecked {
            _balances[account] = accountBalance - value;
            _totalSupply -= value;
        }
        emit Transfer(account, address(0), value);
    }

    function _approve(address owner, address spender, uint256 value) internal {
        require(owner != address(0) && spender != address(0), "BBD: Zero address");
        _allowances[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _safeTransferUsdc(address to, uint256 value) internal {
        (bool success, bytes memory data) = address(usdcToken).call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BBD: USDC transfer failed");
    }

    function _safeTransferFromUsdc(address from, address to, uint256 value) internal {
        (bool success, bytes memory data) = address(usdcToken).call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BBD: USDC transferFrom failed");
    }

    // --- Initializers (Zero Local Stack Variables) ---
    function _initializeMasterTrancheSchedule() internal {
        masterTrancheSchedule[0] = MasterFinancingTranche(
            "Tranche 1 ($430MM): 65 Court HQ ($3M+$60M Rehab/2MW Gensets) + 438 Main Data/Hotel ($6.5M+$60M Rehab/5MW Gensets) + 14 Lafayette Sq Data/Hotel ($6.5M+$60M Rehab/3MW Gensets) + $20M Part 360 Plant Upgrades + $24M Gro-Green Elk St + $75M Springfield/Toledo/Highland/UCO/RNG + $55M Hero BX + $25M Chemicals + $15M Slag + $20M Hard Carbon",
            430_000_000, 745_000_000, 16_500_000_000, 0, false
        );
        masterTrancheSchedule[1] = MasterFinancingTranche(
            "Tranche 2 ($375MM): $300MM Savannah 735-Ac Deepwater Port & Dual Rail Mega-Campus Bid Escrow/SPV + $75MM Tonawanda 94-Ac Huntley Waterfront & 756-ft Ship Dock Deed",
            375_000_000, 1_010_000_000, 22_500_000_000, 0, false
        );
        masterTrancheSchedule[2] = MasterFinancingTranche(
            "Tranche 3 ($1.50B): $431M Hero BX 500MW BTM, 600M Lb Glycerine & SAF (45Z/D4 RINs/45Q) + $600M 15 Nationwide Food-Waste/Manure RNG Plants w/ BBB-WDG + $250M 2 GWh Hard Carbon Anode & BESS Plant (45X/48E) + $219M Global Chemical Rollout",
            1_500_000_000, 4_910_000_000, 108_000_000_000, 0, false
        );
        masterTrancheSchedule[3] = MasterFinancingTranche(
            "Tranche 4 ($3.50B): $1.075B Tonawanda Underground 600MW AI Vault, 20x GE TM2500 Nat-Gas Microgrid w/ 45Q CO2 Scrubbers & B3 Shrimp + $1.346B Savannah First 1.0GW Microgrids + $1.079B 35 Nationwide RNG, Depackaging & Wood/Ag Microgrid Hubs",
            3_500_000_000, 11_460_000_000, 252_000_000_000, 0, false
        );
        masterTrancheSchedule[4] = MasterFinancingTranche(
            "Tranche 5 ($8.50B): $3.36B Tonawanda Surface 75-Ac Sports Dome, 5,500-Rm Hotel & BBD Airlines Runway + Savannah Expansion to 5.0GW + 10 GWh Hard Carbon BESS Gigafactory (45X/48E) + Full 8.4M-Ton Bethlehem Slag 45Q Carbonation",
            8_500_000_000, 24_660_000_000, 555_000_000_000, 0, false
        );
        masterTrancheSchedule[5] = MasterFinancingTranche(
            "Tranche 6 ($16.00B): 30x 500MW Global Hybrid Microgrid Blocks (>=5MW Clustered Nat-Gas w/ 85% Stack / 70% Ambient CO2 Scrubbers + Wood/Ag Waste) + 20 GWh/Yr Biochar Hard-Carbon Sodium-Ion BESS across NA, EU & APAC",
            16_000_000_000, 41_560_000_000, 955_000_000_000, 0, false
        );
        masterTrancheSchedule[6] = MasterFinancingTranche(
            "Tranche 7 ($25.50B): Final 40x 500MW Global Microgrid & ZLD Brine Mining Blocks completing the 50.00 GW Global Footprint ($64.34B/Yr Run-Rate EBITDA supporting $1.5T-$2.5T+ Global Enterprise Valuation)",
            25_500_000_000, 64_340_000_000, 1_855_000_000_000, 0, false
        );
    }

    function _initializeTenGlobalDivisions() internal {
        globalDivisions[0] = GlobalDivisionSpec(
            "Div 1: Nationwide UCO (30,000 Vats, $200M EV, NYSDEC Part 360 Plant + $20M Upgrades), Springfield & Highland Mayo/Butter Depack + RNG",
            "225 Sawyer Part 360 Plant ($20M Upgrades), 30,000 Vats, Springfield (Mayo/Butter Depack), Highland (Dual Depack/Biochar) + 50+ RNG Plants w/ BBB-WDG (D3/D5 RINs & 45Z)",
            18500, 2400, 0, true
        );
        globalDivisions[1] = GlobalDivisionSpec(
            "Div 2: Bio-Chemical Formulations & Blending Equipment: Form Release, Tire Shine, Asphalt Rejuvenator, Rope Dope & Bio Shield",
            "Zero-VOC Form Release ($15/$22 gal), Tire Shine ($24/gal), Asphalt/Shingle Rejuvenator ($65/gal), Rope Dope ($28/gal) & Bio Shield ($18/gal) at 225 Sawyer & Global Hubs",
            3500, 410, 0, true
        );
        globalDivisions[2] = GlobalDivisionSpec(
            "Div 3: Downtown Buffalo Purchases & $60M-Each Rehabs (65 Court HQ [$3M], 438 Main Data/Hotel [$6.5M], Lafayette Sq Data/Hotel [$6.5M]) + Gro-Green & Slag",
            "65 Court HQ ($63M), 438 Main Data/Hotel ($66.5M), 14 Lafayette Sq Data/Hotel ($66.5M) w/ 10MW Nat-Gas Gensets (45Q) + 703-717 Elk St: PVOH Concrete Bags ($19.92) & Traffic Stops ($58)",
            2900, 350, 0, true
        );
        globalDivisions[3] = GlobalDivisionSpec(
            "Div 4: Toledo & Highland 500C Biochar Plants + Gro-Green (703-717 Elk St) Buffalo Biogas Booster (BBB-WDG @ $6,500/MT)",
            "Toledo & Highland 500C Biochar Hubs feeding Gro-Green Wet-Granulated BBB-WDG Digester Catalyst ($6,500/MT) + Gro-Green Biochar Turf/Ag Fertilizers",
            32500, 2100, 0, true
        );
        globalDivisions[4] = GlobalDivisionSpec(
            "Div 5: Biochar Credits (CORCs @ $180/MT) & Upgrading to Battery-Grade Hard Carbon Anodes ($9,500/MT) + Sodium-Ion / Li-Ion BESS",
            "Puro.earth CORCs ($180/MT) + 1,300C Biochar Hard Carbon Anodes (10% 45X Electrode Active Material Credit) & Containerized BESS ($45/kWh 45X + 30%-50% 48E ITC)",
            950000, 145000, 0, true
        );
        globalDivisions[5] = GlobalDivisionSpec(
            "Div 6: Hero BX Dual-Site Buyout (Erie PA 75-Ac & Moundville AL 54-Ac), 600M Lb/Yr Glycerine, BBD Airlines HEFA SAF & 45Z/RINs",
            "600M Lb/Yr USP & FAA Glycerine De-Icer ($0.85/lb), ASTM HEFA SAF ($6.80/gal), BBD Airlines Fleet, 500MW BTM Power, PA 45Q Seq & 45Z/D4 RINs ($803M FCF)",
            680, 245, 0, true
        );
        globalDivisions[6] = GlobalDivisionSpec(
            "Div 7: Global Microgrid Rollout (50.00 GW): Wood Waste (Mulch to Pallets) + Ag Waste + >=5MW Natural Gas Blocks with CO2 Scrubbers",
            "267 TPH Wood/Ag Pyrolysis CHP (30%-50% 48E ITC) + >=5MW Clustered Nat-Gas Microgrids (65 Court/438 Main/Lafayette Sq & Global) w/ Amino-Acid CO2 Scrubbers ($85/$180 45Q)",
            13500, 2200, 0, true
        );
        globalDivisions[7] = GlobalDivisionSpec(
            "Div 8: Savannah 735-Acre Deepwater Port & Rail Mega-Campus ($300MM Bid Escrow / Global Port SPV + 5.00 GW Microgrid & AI Hub)",
            "10x 500MW Wood/Ag/Tire Pyrolysis & Nat-Gas Scrubber Microgrids, Subterranean AI Vaults, Hard Carbon Battery Plant & 50-Ac Cell C Tire Hose/Mat Extrusion",
            14500, 2300, 0, true
        );
        globalDivisions[8] = GlobalDivisionSpec(
            "Div 9: Project Tonawanda (94-Ac Huntley Megaplex): 600MW AI Vault, 20x TM2500s w/ 45Q CO2 Scrubbers, B3 Shrimp, 75-Ac Dome & 5,500-Rm Hotel",
            "$4.51B Net CAPEX ($2.81B Rev / $2.05B EBITDA): 20x GE TM2500s w/ 45Q CO2 Scrubber, 600MW AI Vault, 75.25-Ac B3 Shrimp, 75-Ac Sports Dome, Hotel & Jet Runway",
            19500, 4700, 0, true
        );
        globalDivisions[9] = GlobalDivisionSpec(
            "Div 10: Global ZLD Thermal Desalination, Brine Mining (Li/Mg/Br/NaCl), Whole-Building Water Skids & Global SRE Fuel",
            "30 MGD/GW Distilled Water, Direct Lithium (DLE), Mg(OH)2, Bromine, NaCl, Whole-Building Biochar-Ozone Water Skids ($18,500) & SRE Fuel Capsules",
            65000, 14300, 0, true
        );
    }

    function _initializeFlagshipSkus() internal {
        masterSkuRegistry[1] = IndividualSkuSpec("SKU-1: Buffalo Bio Form Release (Zero-VOC Saponified UCO/Mayo-Lipid Concrete Form Release - Per Gal)", 1500, 225, 0, true);
        masterSkuRegistry[2] = IndividualSkuSpec("SKU-2: Buffalo Bio Asphalt Release Agent (Zero-VOC Sub-Micron Biochar Slip - Per Gal)", 2200, 310, 0, true);
        masterSkuRegistry[3] = IndividualSkuSpec("SKU-3: Buffalo Bio Tire Shine (Commercial Fleet & Retail UCO/Glycerine/Nano-Char - Per Gal)", 2400, 320, 0, true);
        masterSkuRegistry[4] = IndividualSkuSpec("SKU-4: Buffalo Bio Asphalt & Shingle Rejuvenator (1:5 UCO Bio-Restorer - Per Gal)", 6500, 680, 0, true);
        masterSkuRegistry[5] = IndividualSkuSpec("SKU-5: Buffalo Bio Rope Dope (Wood-Tar/UCO/Micro-Char Marine Cordage & Wire-Rope Lubricant - Per Gal)", 2800, 350, 0, true);
        masterSkuRegistry[6] = IndividualSkuSpec("SKU-6: Buffalo Bio Shield (AWPA Wood-Tar & Wood Vinegar Utility Pole/Tie Preservative - Per Gal)", 1800, 240, 0, true);
        masterSkuRegistry[7] = IndividualSkuSpec("SKU-7: Buffalo Bio Concrete Additive Bag (12-lb Water-Soluble PVOH Bimodal Biochar & 45Q-Carbonated Bethlehem Slag Bag)", 1992, 265, 0, true);
        masterSkuRegistry[8] = IndividualSkuSpec("SKU-8: Buffalo Bio Traffic Stop / Parking Bumper (Smooth Mortar-Finished Carbonated Bethlehem Slag & Biochar Precast)", 5800, 790, 0, true);
        masterSkuRegistry[9] = IndividualSkuSpec("SKU-9: Carbonated Bethlehem Steel Slag Mineralized Aggregate (Per Ton - Sequestering Scrubber CO2 under $85/MT 45Q & CORC1000+)", 4500, 650, 0, true);
        masterSkuRegistry[10] = IndividualSkuSpec("SKU-10: Buffalo Biogas Booster (BBB-WDG) 1-Ton Super-Sack AD Catalyst ($6,500/MT Primary Biochar Value-Add)", 650000, 74000, 0, true);
        masterSkuRegistry[11] = IndividualSkuSpec("SKU-11: Gro-Green Biochar-Enhanced Commercial Turf & Lawn Fertilizer (50-lb Wet-Granulated Bag)", 4800, 890, 0, true);
        masterSkuRegistry[12] = IndividualSkuSpec("SKU-12: Restaurant Food-Waste, Springfield/Highland Mayo-Butter & Manure RNG (Per MMBtu Stacked w/ D3/D5 RINs & 45Z)", 3000, 620, 0, true);
        masterSkuRegistry[13] = IndividualSkuSpec("SKU-13: Battery-Grade Biochar Hard Carbon Anode Material (Toledo/Highland/Buffalo - 10% IRA Section 45X Credit - Per MT)", 950000, 145000, 0, true);
        masterSkuRegistry[14] = IndividualSkuSpec("SKU-14: Containerized 2.0 MWh Sodium-Ion Hard-Carbon Microgrid & Marine Battery System ($45/kWh 45X + 30%-50% 48E ITC)", 48000000, 19500000, 0, true);
        masterSkuRegistry[15] = IndividualSkuSpec("SKU-15: Hero BX Refined USP & FAA-Certified Glycerine De-Icer (600M Lb/Yr Capacity - Per Gal)", 850, 190, 0, true);
        masterSkuRegistry[16] = IndividualSkuSpec("SKU-16: Hero BX / BBD Airlines ASTM D7566 HEFA SAF (Per Gal - Stacked w/ Section 45Z & EPA D4 RINs)", 680, 245, 0, true);
    }

    function _initializeSevenRolloutTiers(address _adminMultiSig) internal {
        rolloutBlueprint[0] = RolloutTierSlot(
            "TIER-0: Core BBD ($200M Oil Contract EV @ 20x $10M EBITDA, 30,000 Vats, $110M Assets at Part 360 Plant + $20M Upgrades, 685,850 MT CO2e) & Springfield/Toledo/Highland",
            500_000, 500_000_000 * 1e18, 10_000, 500_000_000 * 1e18, "GENESIS-TIER0-PART360-20MUPGRADES-SPRINGFIELD-TOLEDO-HIGHLAND"
        );
        rolloutBlueprint[1] = RolloutTierSlot(
            "TIER-1: Purchase & $60M-Each Rehab of 65 Court HQ ($3M), 438 Main Data/Hotel ($6.5M) & Lafayette Sq Data/Hotel ($6.5M) w/ 10MW Nat-Gas Gensets + Gro-Green, Slag, BBB-WDG & Chemicals",
            500_000, 500_000_000 * 1e18, 10_000, 500_000_000 * 1e18, "GENESIS-TIER1-65COURT3M-438MAIN6.5M-LAFAYETTE6.5M-180MREHAB"
        );
        rolloutBlueprint[2] = RolloutTierSlot(
            "TIER-2: Project Tonawanda (94-Ac Huntley Megaplex - 600MW AI / 20x TM2500s w/ $85-$180/MT 45Q CO2 Scrubbers / B3 Shrimp / 75-Ac Dome & 5,500-Rm Hotel)",
            1_000_000, 1_000_000_000 * 1e18, 10_000, 1_000_000_000 * 1e18, "GENESIS-TIER2-TONAWANDA-HUNTLEY-MEGAPLEX-45Q-SCRUBBERS"
        );
        rolloutBlueprint[3] = RolloutTierSlot(
            "TIER-3: Hero BX Buyout (Erie PA 75-Ac & Moundville AL 54-Ac), 600M Lb/Yr Glycerine Buildout, HEFA SAF, Food-Waste/Manure RNG & 45Z/45Q/D4 RINs",
            500_000, 500_000_000 * 1e18, 10_000, 500_000_000 * 1e18, "GENESIS-TIER3-HERO-BX-BUYOUT-600MLB-GLYCERINE-SAF-45Z-RINS"
        );
        rolloutBlueprint[4] = RolloutTierSlot(
            "TIER-4: Springfield (Mayo/Butter Depack), Toledo (Biochar), Highland (Dual Depack/Biochar) & 50 Nationwide Food-Waste/Manure RNG & Microgrid Depots (2.50 GW)",
            2_500_000, 2_500_000_000 * 1e18, 2_000, 500_000_000 * 1e18, "GENESIS-TIER4-SPRINGFIELD-TOLEDO-HIGHLAND-NATIONWIDE-RNG"
        );
        rolloutBlueprint[5] = RolloutTierSlot(
            "TIER-5: Savannah GA 735-Ac Port Mega-Campus ($300MM Bid Escrow / Global Port SPV + 5.00 GW Wood/Ag/Nat-Gas Scrubber Microgrids & Hard Carbon BESS)",
            5_000_000, 5_000_000_000 * 1e18, 2_000, 1_000_000_000 * 1e18, "GENESIS-TIER5-SAVANNAH-735AC-PORT-AND-HARDCARBON-BESS"
        );
        rolloutBlueprint[6] = RolloutTierSlot(
            "TIER-6: Global 40.00 GW Wood/Ag & Nat-Gas CO2-Scrubber Microgrids, 20 GWh Hard-Carbon BESS & ZLD Brine Mining (Li/Mg/Br/NaCl)",
            40_000_000, 40_000_000_000 * 1e18, 375, 1_500_000_000 * 1e18, "GENESIS-TIER6-40GW-GLOBAL-MICROGRIDS-HARDCARBON-AND-BRINE"
        );

        activeInstalledBtmKW = 5_500_000;
        _mint(_adminMultiSig, DAY1_GENESIS_MINT_SUPPLY);
    }

    // --- Core Governance, Oracle & Settlement Functions ---
    function updateCorporateHoldingStructure(
        string calldata _newParentHoldingStructure,
        string calldata _operatingSubsidiaryNote
    ) external onlyRole(TREASURY_MULTISIG_ROLE) {
        parentHoldingCompanyStructure = _newParentHoldingStructure;
        primaryOperatingSubsidiary = _operatingSubsidiaryNote;
        emit CorporateHoldingStructureUpdated(_newParentHoldingStructure, _operatingSubsidiaryNote);
    }

    function updateTreasuryMultiSig(address _newTreasuryMultiSig) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_newTreasuryMultiSig != address(0), "BBD: Invalid Safe address");
        address oldSafe = treasuryMultiSig;
        treasuryMultiSig = _newTreasuryMultiSig;
        _grantRole(DEFAULT_ADMIN_ROLE, _newTreasuryMultiSig);
        _grantRole(TREASURY_MULTISIG_ROLE, _newTreasuryMultiSig);
        emit TreasuryMultiSigUpdated(oldSafe, _newTreasuryMultiSig);
    }

    function recordUsTaxCreditsAndRins(
        uint256 _added45QAndCorcsMT,
        uint256 _added45ZGal,
        uint256 _added45XAnd48EUsd,
        uint256 _addedRins,
        uint256 _cashRealizedUsd
    ) external onlyRole(ORACLE_PROGRESS_ROLE) {
        usIncentiveLedger.section45QAndCorcsMT += _added45QAndCorcsMT;
        usIncentiveLedger.section45ZCleanFuelGallonsEquiv += _added45ZGal;
        usIncentiveLedger.section45XAnd48ECreditsUsd += _added45XAnd48EUsd;
        usIncentiveLedger.epaRfsRinsGeneratedD3D4D5 += _addedRins;
        usIncentiveLedger.cumulativeTaxCreditCashRealizedUsd += _cashRealizedUsd;

        emit UsTaxCreditsAndRinsRecorded(
            usIncentiveLedger.section45QAndCorcsMT,
            usIncentiveLedger.section45ZCleanFuelGallonsEquiv,
            usIncentiveLedger.section45XAnd48ECreditsUsd,
            usIncentiveLedger.epaRfsRinsGeneratedD3D4D5,
            usIncentiveLedger.cumulativeTaxCreditCashRealizedUsd
        );
    }

    function purchaseFromTreasuryWithUsdc(
        uint256 _usdcAmount,
        string calldata _allocationMemo
    ) external nonReentrant returns (uint256 bbdDelivered) {
        require(directInstitutionalSaleActive, "BBD: Direct institutional window paused");
        require(_usdcAmount > 0, "BBD: USDC amount must be > 0");

        bbdDelivered = (_usdcAmount * 1e18) / institutionalBenchmarkPriceUsdc;
        require(bbdDelivered > 0, "BBD: Purchase amount too small");

        uint256 usdcToFloor = (_usdcAmount * floorVaultAllocationBps) / MAX_BPS;
        uint256 usdcToClosingSafe = _usdcAmount - usdcToFloor;

        if (usdcToClosingSafe > 0) {
            _safeTransferFromUsdc(msg.sender, treasuryMultiSig, usdcToClosingSafe);
            totalUsdcRaisedOnChain += usdcToClosingSafe;
        }

        if (usdcToFloor > 0) {
            _safeTransferFromUsdc(msg.sender, address(this), usdcToFloor);
            usdcTreasuryReserve += usdcToFloor;
        }

        _transfer(treasuryMultiSig, msg.sender, bbdDelivered);

        emit InstitutionalTranchePurchased(msg.sender, _usdcAmount, bbdDelivered, _allocationMemo);
    }

    function settleOffChainFedwireDrawdown(
        uint256 _trancheId,
        address _institutionalRecipient,
        uint256 _usdWireAmountWholeDollars,
        string calldata _fedwireOrEscrowRef,
        bool _markTrancheCompleted
    ) external nonReentrant onlyRole(TREASURY_MULTISIG_ROLE) returns (uint256 bbdDeliveredWei) {
        require(_trancheId < 7, "BBD: Invalid tranche ID (0-6)");
        require(_institutionalRecipient != address(0), "BBD: Invalid recipient");
        require(_usdWireAmountWholeDollars > 0, "BBD: USD amount must be > 0");

        bbdDeliveredWei = (_usdWireAmountWholeDollars * 1e6 * 1e18) / institutionalBenchmarkPriceUsdc;

        MasterFinancingTranche storage tranche = masterTrancheSchedule[_trancheId];
        tranche.usdAndUsdcFundedSoFar += _usdWireAmountWholeDollars;
        if (_markTrancheCompleted) {
            tranche.isCompleted = true;
        }

        totalOffChainFedwireSettledUsd += _usdWireAmountWholeDollars;
        _transfer(treasuryMultiSig, _institutionalRecipient, bbdDeliveredWei);

        emit OffChainFedwireSettled(_trancheId, _institutionalRecipient, _usdWireAmountWholeDollars, bbdDeliveredWei, _fedwireOrEscrowRef);
        emit MasterTrancheUpdated(_trancheId, tranche.usdAndUsdcFundedSoFar, tranche.isCompleted);
    }

    function lockCollateralForCreditFacility(
        address _lenderOrCustodian,
        uint256 _bbdLockAmountWei,
        uint256 _usdLoanPrincipal,
        uint256 _lockDurationDays,
        string calldata _facilityAgreementRef
    ) external nonReentrant onlyRole(TREASURY_MULTISIG_ROLE) returns (uint256 lockId) {
        require(_lenderOrCustodian != address(0), "BBD: Invalid lender address");
        require(_bbdLockAmountWei > 0, "BBD: Lock amount must be > 0");

        _transfer(treasuryMultiSig, address(this), _bbdLockAmountWei);

        lockId = ++nextLockId;
        creditCollateralLocks[lockId] = CreditCollateralLock({
            lenderOrCustodian: _lenderOrCustodian,
            facilityAgreementRef: _facilityAgreementRef,
            bbdLockedWei: _bbdLockAmountWei,
            usdLoanPrincipal: _usdLoanPrincipal,
            unlockTimestamp: block.timestamp + (_lockDurationDays * 1 days),
            isActive: true
        });

        totalBbdLockedInCollateralWei += _bbdLockAmountWei;

        emit CollateralLockedForCredit(lockId, _lenderOrCustodian, _bbdLockAmountWei, _usdLoanPrincipal, _facilityAgreementRef);
    }

    function releaseCollateralFacility(
        uint256 _lockId,
        address _releaseDestination
    ) external nonReentrant onlyRole(TREASURY_MULTISIG_ROLE) {
        CreditCollateralLock storage lockItem = creditCollateralLocks[_lockId];
        require(lockItem.isActive, "BBD: Lock not active");
        require(_releaseDestination != address(0), "BBD: Invalid destination");

        uint256 amount = lockItem.bbdLockedWei;
        lockItem.isActive = false;
        lockItem.bbdLockedWei = 0;
        totalBbdLockedInCollateralWei -= amount;

        _transfer(address(this), _releaseDestination, amount);

        emit CollateralReleased(_lockId, _releaseDestination, amount);
    }

    function setInstitutionalBenchmarkTerms(
        uint256 _newPriceUsdc,
        uint256 _newFloorBps,
        bool _isActive
    ) external onlyRole(TREASURY_MULTISIG_ROLE) {
        require(_newPriceUsdc > 0, "BBD: Price must be > 0");
        require(_newFloorBps <= MAX_BPS, "BBD: Invalid bps");
        uint256 oldPrice = institutionalBenchmarkPriceUsdc;
        institutionalBenchmarkPriceUsdc = _newPriceUsdc;
        floorVaultAllocationBps = _newFloorBps;
        directInstitutionalSaleActive = _isActive;

        emit BenchmarkPriceUpdated(oldPrice, _newPriceUsdc, _newFloorBps, _isActive);
    }

    function adjustGlobalDivision(
        uint256 _divisionId,
        string calldata _newName,
        string calldata _newIncludedTech,
        uint256 _newAvgPriceCents,
        uint256 _newAvgCostCents,
        bool _isActive
    ) external onlyRole(TREASURY_MULTISIG_ROLE) {
        require(_divisionId < 10, "BBD: Invalid Division ID (0-9)");
        GlobalDivisionSpec storage div = globalDivisions[_divisionId];
        div.divisionName = _newName;
        div.includedProductsAndTech = _newIncludedTech;
        div.avgUnitPriceCents = _newAvgPriceCents;
        div.avgUnitCostCents = _newAvgCostCents;
        div.isActive = _isActive;

        emit DivisionSpecAdjusted(_divisionId, _newAvgPriceCents, _newAvgCostCents, _isActive);
    }

    function setIndividualSku(
        uint256 _skuId,
        string calldata _skuName,
        uint256 _priceCents,
        uint256 _costCents
    ) external onlyRole(TREASURY_MULTISIG_ROLE) {
        require(_skuId >= 1 && _skuId <= 120, "BBD: SKU must be 1 to 120");
        masterSkuRegistry[_skuId] = IndividualSkuSpec({
            skuName: _skuName,
            unitPriceCents: _priceCents,
            unitCostCents: _costCents,
            cumulativeVolume: masterSkuRegistry[_skuId].cumulativeVolume,
            isConfigured: true
        });

        emit SkuAdjusted(_skuId, _skuName, _priceCents, _costCents);
    }

    function updateTierProgress(
        uint256 _tierId,
        uint256 _newProgressBps,
        string calldata _auditIpfsHash
    ) external onlyRole(ORACLE_PROGRESS_ROLE) {
        require(_tierId < 7, "BBD: Invalid Tier ID (0-6)");
        require(_newProgressBps <= MAX_BPS, "BBD: Progress cannot exceed 10000 bps (100%)");

        RolloutTierSlot storage tier = rolloutBlueprint[_tierId];
        require(_newProgressBps > tier.verifiedProgressBps, "BBD: Progress must move forward");

        uint256 deltaBps = _newProgressBps - tier.verifiedProgressBps;
        tier.verifiedProgressBps = _newProgressBps;
        tier.latestAuditIpfsHash = _auditIpfsHash;

        if (tier.targetBtmPowerKW > 0) {
            activeInstalledBtmKW += (tier.targetBtmPowerKW * deltaBps) / MAX_BPS;
        }
    }

    function mintUnlockedTierProgress(uint256 _tierId)
        external
        nonReentrant
        onlyRole(TREASURY_MULTISIG_ROLE)
        returns (uint256 newlyMintedWei)
    {
        require(_tierId < 7, "BBD: Invalid Tier ID (0-6)");
        RolloutTierSlot storage tier = rolloutBlueprint[_tierId];

        uint256 totalUnlockedWei = (tier.maxTokenAllocationWei * tier.verifiedProgressBps) / MAX_BPS;
        require(totalUnlockedWei > tier.mintedSoFarWei, "BBD: No new progress to mint");

        newlyMintedWei = totalUnlockedWei - tier.mintedSoFarWei;
        require(_totalSupply + newlyMintedWei <= MAX_MASTER_BLUEPRINT_SUPPLY, "BBD: Exceeds 50B constitutional cap");

        tier.mintedSoFarWei = totalUnlockedWei;

        _mint(treasuryMultiSig, newlyMintedWei);

        emit TierProgressUpdatedAndMinted(_tierId, tier.verifiedProgressBps, newlyMintedWei, tier.latestAuditIpfsHash);
    }

    function recordDivisionOutput(uint256 _divisionId, uint256 _unitsAdded)
        external
        onlyRole(ORACLE_PROGRESS_ROLE)
    {
        require(_divisionId < 10, "BBD: Invalid Division ID (0-9)");
        globalDivisions[_divisionId].cumulativeOutput += _unitsAdded;

        emit DivisionOutputRecorded(_divisionId, _unitsAdded, globalDivisions[_divisionId].cumulativeOutput);
    }

    function depositUsdcRevenueSweep(uint256 _usdcAmount) external nonReentrant {
        require(_usdcAmount > 0, "BBD: Sweep amount must be > 0");
        _safeTransferFromUsdc(msg.sender, address(this), _usdcAmount);
        usdcTreasuryReserve += _usdcAmount;

        emit UsdcRevenueSwept(msg.sender, _usdcAmount, usdcTreasuryReserve);
    }

    function burnToRetireAttributes(
        uint256 _bbdTokenAmount,
        string calldata _registrySerialBatch,
        string calldata _retirementPurpose
    ) external nonReentrant returns (uint256 receiptId) {
        require(_bbdTokenAmount > 0, "BBD: Burn amount must be > 0");
        _burn(msg.sender, _bbdTokenAmount);

        receiptId = ++nextReceiptId;
        retirementReceipts[receiptId] = RetirementReceipt({
            beneficiary: msg.sender,
            bbdTokensBurned: _bbdTokenAmount,
            registrySerialBatch: _registrySerialBatch,
            retirementPurpose: _retirementPurpose,
            timestamp: block.timestamp
        });

        totalTokensRetiredForClaims += _bbdTokenAmount;
        emit AttributeRetired(receiptId, msg.sender, _bbdTokenAmount, _registrySerialBatch);
    }

    function redeemForUsdcFloor(uint256 _bbdTokenAmount) external nonReentrant {
        require(_bbdTokenAmount > 0, "BBD: Amount must be > 0");
        require(_totalSupply > 0 && usdcTreasuryReserve > 0, "BBD: No reserve available");

        uint256 usdcPayout = (_bbdTokenAmount * usdcTreasuryReserve) / _totalSupply;
        require(usdcPayout > 0, "BBD: Payout below minimum USDC unit");

        _burn(msg.sender, _bbdTokenAmount);
        usdcTreasuryReserve -= usdcPayout;
        _safeTransferUsdc(msg.sender, usdcPayout);

        emit FloorRedemptionExecuted(msg.sender, _bbdTokenAmount, usdcPayout);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.