From f9db39d6ab604498c9e90f5848d103b5d9bca629 Mon Sep 17 00:00:00 2001 From: GitHub Copilot Date: Sat, 17 Oct 2026 22:43:49 +0000 Subject: [PATCH] refactor: separate voting delegation helpers --- contracts/predictify-hybrid/src/lib.rs | 2 +- .../src/voting_delegation.rs | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 contracts/predictify-hybrid/src/voting_delegation.rs diff --git a/contracts/predictify-hybrid/src/lib.rs b/contracts/predictify-hybrid/src/lib.rs index fdbd729b..afe93909 100644 --- a/contracts/predictify-hybrid/src/lib.rs +++ b/contracts/predictify-hybrid/src/lib.rs @@ -34,7 +34,6 @@ pub mod gov_registry; mod fees; mod gas; mod governance; -mod delegation; mod markets; mod monitoring; mod oracles; @@ -71,6 +70,7 @@ mod utils; mod validation; mod versioning; mod voting; +mod voting_delegation; mod voting_delegation_integration; mod market_analytics; mod performance_benchmarks; diff --git a/contracts/predictify-hybrid/src/voting_delegation.rs b/contracts/predictify-hybrid/src/voting_delegation.rs new file mode 100644 index 00000000..12328150 --- /dev/null +++ b/contracts/predictify-hybrid/src/voting_delegation.rs @@ -0,0 +1,28 @@ +//! Delegation-aware voting helpers. +//! +//! This module keeps delegation-specific voting logic separated from the core +//! voting mechanics defined in [`crate::voting`]. It re-exports the shared +//! integration implementation so both the historical path and the dedicated +//! delegation module remain available. + +pub use crate::voting_delegation_integration::{VotingAuthority, VotingIntegration}; + +#[cfg(test)] +mod tests { + use super::*; + use soroban_sdk::{testutils::Address as _, Address, Env}; + + #[test] + fn test_voting_integration_is_available_from_delegation_module() { + let env = Env::default(); + let user = Address::generate(&env); + let contract_id = env.register(crate::PredictifyHybrid, ()); + + env.as_contract(&contract_id, || { + let authority = VotingIntegration::resolve_voting_authority(&env, &user).unwrap(); + assert_eq!(authority.vote_owner, user); + assert_eq!(authority.executing_authority, user); + assert!(!authority.is_delegated); + }); + } +}