Skip to content

Refactor: Centralized Configuration Management for Predictify Hybrid Contract#132

Merged
greatest0fallt1me merged 8 commits into
Predictify-org:masterfrom
1nonlypiece:config
Jul 6, 2025
Merged

Refactor: Centralized Configuration Management for Predictify Hybrid Contract#132
greatest0fallt1me merged 8 commits into
Predictify-org:masterfrom
1nonlypiece:config

Conversation

@1nonlypiece

Copy link
Copy Markdown
Contributor

Overview

This PR introduces a comprehensive configuration management system for the Predictify Hybrid contract, centralizing all constants, configuration structs, and environment-specific settings into a new config.rs module. This improves maintainability, flexibility, and clarity for all contract configuration.

Key Changes

  • New config.rs module:

    • Centralizes all contract constants (fees, voting, market, extension, resolution, oracle, storage).
    • Provides configuration structs for each settings group (fees, voting, market, extension, resolution, oracle, network).
    • Implements environment-specific configuration (development, testnet, mainnet).
    • Adds configuration validation and helper utilities.
    • Includes configuration testing utilities and documentation.
  • Refactored usage across modules:

    • All constants in fees.rs, voting.rs, extensions.rs, and related modules now reference config.rs.
    • Contract interface exposes configuration management methods:
      • initialize_with_config
      • get_contract_config
      • update_contract_config
      • reset_config_to_defaults
      • get_config_summary
      • fees_enabled
      • get_environment
      • validate_configuration
  • Test Coverage:

    • Added comprehensive tests for configuration initialization, update, reset, validation, and environment detection.
  • Removed duplication:

    • All configuration values are now defined in one place, eliminating scattered constants.

Benefits

  • Clean, organized configuration management
  • Centralized and modular configuration
  • Environment-specific and flexible settings
  • Improved validation and documentation
  • Easier maintenance and extensibility

Closes: #111

…dictify Hybrid contract, including constants, environment support, and validation utilities
…fy Hybrid contract, including ConfigurationNotFound and InvalidFeeConfig
…with new methods for initialization, updating, and resetting configurations
…sistency in Predictify Hybrid contract configuration
…tion, updating, validation, and environment detection in Predictify Hybrid contract
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Looks good to me! @1nonlypiece

@greatest0fallt1me greatest0fallt1me merged commit f906e71 into Predictify-org:master Jul 6, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants