// Copyright (C) 2024-2026 Whiterun LLC // // This software is licensed under the GNU Affero General Public License (AGPL), version 3.0 or later. // A copy of the license can be found in the LICENSE file or at https://www.gnu.org/licenses/agpl-3.0.html //! Per-network ORB DAO parameter-NFT categories — the single place to set them. //! //! ORB governs protocol revenue through two parameter NFTs (see libriften //! `docs/orb.md`): a `PoolParams` NFT whose commitment pins delegation-pool fee //! parameters, and an `IdoParams` NFT whose commitment pins IDO parameters. Each //! NFT is identified by its **token category**, which is a per-network deployment //! constant. A pool/IDO is only an ORB-protocol member if its init transaction //! spends the network's live params NFT (see the `orb` / `ido` admission code). //! //! Categories are stored in **display byte order** (like a token id string), the //! convention the indexer compares against (`token.id` reversed). Until a real //! category is set, its placeholder is the all-zero sentinel — [`is_configured`] //! is false and admission fails **closed** (no pools/IDOs admitted), never open. use bitcoincash::Network; // --- IdoParams NFT category --------------------------------------------------- /// Chipnet `IdoParams` NFT category. Every IDO preinit must spend this NFT /// (input #1, preserved at output #10); its commitment carries the economic /// parameters the announced IDO is validated against. pub const CHIPNET_IDO_PARAMS_NFT_CATEGORY: &[u8; 32] = &[ 0xc9, 0x16, 0x7d, 0x12, 0x39, 0x46, 0x27, 0xba, 0x28, 0x30, 0x70, 0x5f, 0xb2, 0xb0, 0xf0, 0x0b, 0x49, 0xeb, 0x28, 0x46, 0x9e, 0x65, 0xda, 0x53, 0x69, 0x12, 0xd0, 0x50, 0x75, 0x89, 0x08, 0x00, ]; // TODO:: set the ido params nft category for mainnet pub const MAINNET_IDO_PARAMS_NFT_CATEGORY: &[u8; 32] = &[0u8; 32]; // --- PoolParams NFT category -------------------------------------------------- // Every delegation-pool creation (token-token and token-BCH) must spend the // `PoolParams` NFT; its commitment pins the platform fee rate + collector the // pool is validated against. // pub const CHIPNET_POOL_PARAMS_NFT_CATEGORY: &[u8; 32] = &[ 0x04, 0xb7, 0x36, 0xed, 0x20, 0x6d, 0x34, 0xfa, 0xe2, 0xd2, 0xfb, 0x4b, 0x95, 0x28, 0x54, 0xc9, 0xd5, 0xcf, 0x07, 0x38, 0x73, 0x2e, 0xe3, 0xaa, 0x61, 0xdb, 0x17, 0xe2, 0x3e, 0xaf, 0x2d, 0x12, ]; // TODO:: set the pool params nft category for mainnet pub const MAINNET_POOL_PARAMS_NFT_CATEGORY: &[u8; 32] = &[0u8; 32]; /// The ORB `IdoParams` NFT category for the given network (display byte order). pub fn ido_params_nft_category(network: Option) -> [u8; 32] { match network { Some(Network::Chipnet) => *CHIPNET_IDO_PARAMS_NFT_CATEGORY, Some(Network::Bitcoin) => *MAINNET_IDO_PARAMS_NFT_CATEGORY, _ => *MAINNET_IDO_PARAMS_NFT_CATEGORY, } } /// The ORB `PoolParams` NFT category for the given network (display byte order). /// While a network's category is the all-zero placeholder, no delegation pool is /// admitted on it (fail closed) — see [`is_configured`]. pub fn pool_params_nft_category(network: Option) -> [u8; 32] { match network { Some(Network::Chipnet) => *CHIPNET_POOL_PARAMS_NFT_CATEGORY, Some(Network::Bitcoin) => *MAINNET_POOL_PARAMS_NFT_CATEGORY, _ => *MAINNET_POOL_PARAMS_NFT_CATEGORY, } } /// True once a real (non-placeholder) category is configured. A caller can log a /// one-time warning when this is false so the inert admission gate (nothing /// indexed) is not mistaken for "no pools/IDOs exist". pub fn is_configured(category: &[u8; 32]) -> bool { category != &[0u8; 32] }