// 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 Moria v1-1 deployment constants. //! //! Mainnet is unconfigured until a v1-1 deployment exists (fail-closed). use bitcoincash::{Network, TokenID}; use riftenlabs_defi::moria_v1_1::MoriaV11TokenIds; /// Unique tail of the moria v1-1 redeem script. Partial scriptsig match — /// every moria method spends this body. const REDEEM_TAIL: [u8; 20] = [ 0x51, 0xd2, 0x51, 0xcf, 0x88, 0x52, 0xd1, 0x00, 0x88, 0xc4, 0x53, 0x9c, 0x77, 0x77, 0x77, 0x68, 0x68, 0x68, 0x68, 0x68, ]; /// Chipnet v1-1 token categories and loan P2SH32, or `None` on other networks. pub fn token_ids(network: Option) -> Option { match network { Some(Network::Chipnet) => Some(MoriaV11TokenIds { moria: "56d909e16cd3b4cecae685a7ca45baa292bf7550205c2ad59320a342c73754de" .parse::() .expect("valid chipnet moria v1-1 token_id"), bp_oracle: "a0628bc21d10211a23f986fd12770e836bae43878db93db8b164ab8a5ab33c96" .parse::() .expect("valid chipnet bp_oracle v1-1 token_id"), pool: "a533b7e96435af18136b534b43e465dd759db3ac33e8490b9bfd254b8c27ae48" .parse::() .expect("valid chipnet pool v1-1 token_id"), bar: "bc98b2733ca1c2070586cce1a4216418830ccd9b19ff77b5d43d47542bb3b50d" .parse::() .expect("valid chipnet bar v1-1 token_id"), loan_locking_bytecode: hex::decode( "aa20415812e068086c90686635a813d77b6c412427e574e89b16e79feeaa48cf0f0787", ) .expect("valid chipnet loan locking bytecode"), }), _ => None, } } /// Electrum `mempool.get` filter for this network's loan lock + redeem tail. pub fn mempool_filter(network: Option) -> Option { let ids = token_ids(network)?; Some(serde_json::json!({ "scriptsig": hex::encode(REDEEM_TAIL), "scriptpubkey": hex::encode(&ids.loan_locking_bytecode), "operation": "union", })) }