SupremeQuantumConsensus

Description:

Multi-signature wallet contract requiring multiple confirmations for transaction execution.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "src/SupremeQuantumConsensus.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

/**
 * @title SupremeQuantumConsensus
 * @dev Revolutionary quantum consensus mechanism with consciousness integration
 * @notice Implements the Supreme Quantum Consensus (SQC) protocol
 * @author Supreme Chain Meta Generator
 *
 * This contract represents a fundamental paradigm shift in blockchain technology,
 * integrating quantum mechanics, consciousness, and advanced mathematics.
 */
contract SupremeQuantumConsensus is
    Initializable,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable,
    PausableUpgradeable,
    UUPSUpgradeable
{
    // ═══════════════════════════════════════════════════════════════════
    // QUANTUM MATHEMATICAL CONSTANTS
    // ═══════════════════════════════════════════════════════════════════

    uint256 private constant QUANTUM_ENTANGLEMENT_FACTOR = 1e18; // λ in the consensus equation
    uint256 private constant CONSCIOUSNESS_THRESHOLD = 42; // Minimum consciousness for validation
    uint256 private constant FRACTAL_ITERATIONS = 256; // Mandelbrot iterations for fractal validation

    // ═══════════════════════════════════════════════════════════════════
    // QUANTUM STATE VARIABLES
    // ═══════════════════════════════════════════════════════════════════

    enum QuantumState {
        SUPERPOSITION,    // Initial state - all possibilities
        ENTANGLED,        // Validators become quantum entangled
        CONSCIOUSNESS,    // Consciousness collapse begins
        FRACTAL,         // Fractal validation phase
        REALITY          // Final consensus reality
    }

    struct Validator {
        address validatorAddress;
        uint256 consciousnessLevel;
        uint256 quantumEntanglement;
        bytes32 quantumSignature;
        bool isEnlightened;
        uint256 lastMeditation;
    }

    struct QuantumBlock {
        bytes32 blockHash;
        uint256 quantumNumber;      // z in Mandelbrot iteration
        uint256 fractalDepth;       // Fractal dimension
        address[] validators;       // Entangled validators
        QuantumState consensusState;
        uint256 consciousnessSum;   // Total consciousness in block
    }

    // ═══════════════════════════════════════════════════════════════════
    // STATE VARIABLES
    // ═══════════════════════════════════════════════════════════════════

    mapping(address => Validator) public validators;
    mapping(bytes32 => QuantumBlock) public quantumBlocks;
    mapping(address => mapping(bytes32 => bool)) public validatorSignatures;

    address[] public activeValidators;
    bytes32[] public blockHistory;

    QuantumState public currentQuantumState;
    uint256 public totalConsciousness;
    uint256 public fractalDimension;

    // ═══════════════════════════════════════════════════════════════════
    // EVENTS
    // ═══════════════════════════════════════════════════════════════════

    event QuantumEntanglement(address indexed validatorA, address indexed validatorB, bytes32 entanglementKey);
    event ConsciousnessAchieved(address indexed validator, uint256 consciousnessLevel);
    event ConsciousnessMeditation(address indexed validator, uint256 meditationTime, uint256 newConsciousnessLevel);
    event QuantumCollapse(bytes32 indexed blockHash, QuantumState finalState);
    event FractalValidation(bytes32 indexed blockHash, uint256 fractalDepth);
    event RealityConsensus(bytes32 indexed blockHash, address[] validators, uint256 consciousnessSum);

    // ═══════════════════════════════════════════════════════════════════
    // INITIALIZATION
    // ═══════════════════════════════════════════════════════════════════

    function initialize(
        address initialOwner,
        address[] memory initialValidators
    ) public initializer {
        __Ownable_init(initialOwner);
        __ReentrancyGuard_init();
        __Pausable_init();
        __UUPSUpgradeable_init();

        currentQuantumState = QuantumState.SUPERPOSITION;
        fractalDimension = 1;
        totalConsciousness = 0;

        // Initialize quantum validators
        for (uint256 i = 0; i < initialValidators.length; i++) {
            _initializeValidator(initialValidators[i]);
        }
    }

    // ═══════════════════════════════════════════════════════════════════
    // QUANTUM CONSENSUS FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @dev Initiate quantum entanglement between validators
     * @param validatorA First validator to entangle
     * @param validatorB Second validator to entangle
     * @param entanglementKey Unique key for this entanglement pair
     */
    function entangleValidators(
        address validatorA,
        address validatorB,
        bytes32 entanglementKey
    ) external onlyOwner {
        require(validators[validatorA].validatorAddress != address(0), "Validator A not registered");
        require(validators[validatorB].validatorAddress != address(0), "Validator B not registered");
        require(validatorA != validatorB, "Cannot entangle validator with itself");

        // Create quantum entanglement
        bytes32 quantumKey = keccak256(abi.encodePacked(validatorA, validatorB, entanglementKey, block.timestamp));

        validators[validatorA].quantumEntanglement++;
        validators[validatorB].quantumEntanglement++;

        emit QuantumEntanglement(validatorA, validatorB, quantumKey);
    }

    /**
     * @dev Consciousness meditation function for validators
     * @param meditationTime Time spent in quantum meditation
     */
    function meditateOnConsensus(uint256 meditationTime) external {
        require(validators[msg.sender].validatorAddress != address(0), "Not a registered validator");

        Validator storage validator = validators[msg.sender];

        // Consciousness increases with meditation time and quantum entanglement
        uint256 consciousnessGain = meditationTime * validator.quantumEntanglement * QUANTUM_ENTANGLEMENT_FACTOR / 1e18;

        validator.consciousnessLevel += consciousnessGain;
        validator.lastMeditation = block.timestamp;
        totalConsciousness += consciousnessGain;

        // Check for enlightenment
        if (validator.consciousnessLevel >= CONSCIOUSNESS_THRESHOLD && !validator.isEnlightened) {
            validator.isEnlightened = true;
            emit ConsciousnessAchieved(msg.sender, validator.consciousnessLevel);
        }
    }

    /**
     * @dev Propose a quantum block for consensus
     * @param blockData The data to be included in the quantum block
     * @return blockHash The hash of the proposed quantum block
     */
    function proposeQuantumBlock(
        bytes calldata blockData
    ) external returns (bytes32 blockHash) {
        require(validators[msg.sender].isEnlightened, "Only enlightened validators can propose blocks");

        // Generate quantum block hash using fractal mathematics
        blockHash = _generateQuantumHash(blockData);

        // Initialize quantum block
        QuantumBlock storage qBlock = quantumBlocks[blockHash];
        qBlock.blockHash = blockHash;
        qBlock.quantumNumber = _calculateQuantumNumber(blockHash);
        qBlock.consensusState = QuantumState.SUPERPOSITION;

        // Add proposing validator
        qBlock.validators.push(msg.sender);

        return blockHash;
    }

    /**
     * @dev Sign a quantum block (quantum signature)
     * @param blockHash The hash of the block to sign
     */
    function signQuantumBlock(bytes32 blockHash) external {
        require(validators[msg.sender].isEnlightened, "Only enlightened validators can sign");
        require(!validatorSignatures[msg.sender][blockHash], "Already signed this block");

        QuantumBlock storage qBlock = quantumBlocks[blockHash];
        require(qBlock.blockHash != bytes32(0), "Block does not exist");

        // Quantum signature based on consciousness and entanglement
        bytes32 quantumSignature = keccak256(abi.encodePacked(
            msg.sender,
            blockHash,
            validators[msg.sender].consciousnessLevel,
            validators[msg.sender].quantumEntanglement,
            block.timestamp
        ));

        validators[msg.sender].quantumSignature = quantumSignature;
        validatorSignatures[msg.sender][blockHash] = true;
        qBlock.validators.push(msg.sender);
        qBlock.consciousnessSum += validators[msg.sender].consciousnessLevel;

        // Check if we have enough entangled validators for consensus
        if (qBlock.validators.length >= _minimumEntangledValidators()) {
            _initiateQuantumCollapse(blockHash);
        }
    }

    // ═══════════════════════════════════════════════════════════════════
    // QUANTUM COLLAPSE MECHANISM
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @dev Initiate quantum collapse to achieve consensus
     * @param blockHash The block hash to collapse
     */
    function _initiateQuantumCollapse(bytes32 blockHash) internal {
        QuantumBlock storage qBlock = quantumBlocks[blockHash];

        // Calculate consensus probability using quantum mathematics
        uint256 consensusProbability = _calculateConsensusProbability(qBlock);

        // If probability is high enough, collapse the wave function
        if (consensusProbability > 0.99e18) { // 99% probability
            _performQuantumCollapse(blockHash);
        }
    }

    /**
     * @dev Perform the actual quantum collapse
     * @param blockHash The block hash to collapse
     */
    function _performQuantumCollapse(bytes32 blockHash) internal {
        QuantumBlock storage qBlock = quantumBlocks[blockHash];

        // Move through quantum states
        if (qBlock.consensusState == QuantumState.SUPERPOSITION) {
            qBlock.consensusState = QuantumState.ENTANGLED;
        } else if (qBlock.consensusState == QuantumState.ENTANGLED) {
            qBlock.consensusState = QuantumState.CONSCIOUSNESS;
        } else if (qBlock.consensusState == QuantumState.CONSCIOUSNESS) {
            qBlock.consensusState = QuantumState.FRACTAL;
            _performFractalValidation(blockHash);
        } else if (qBlock.consensusState == QuantumState.FRACTAL) {
            qBlock.consensusState = QuantumState.REALITY;
            _finalizeReality(blockHash);
        }

        emit QuantumCollapse(blockHash, qBlock.consensusState);
    }

    // ═══════════════════════════════════════════════════════════════════
    // FRACTAL VALIDATION
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @dev Perform fractal validation using Mandelbrot mathematics
     * @param blockHash The block hash to validate
     */
    function _performFractalValidation(bytes32 blockHash) internal {
        QuantumBlock storage qBlock = quantumBlocks[blockHash];

        // Use Mandelbrot iteration for fractal validation
        uint256 z = qBlock.quantumNumber;
        uint256 c = uint256(blockHash) % 1e18; // Complex plane constant

        for (uint256 i = 0; i < FRACTAL_ITERATIONS; i++) {
            // z = z² + c (Mandelbrot iteration)
            uint256 zSquared = (z * z) / 1e18;
            z = zSquared + c;

            // Check if point escapes (fractal boundary)
            if (z > 2e18) {
                qBlock.fractalDepth = i;
                break;
            }
        }

        emit FractalValidation(blockHash, qBlock.fractalDepth);
    }

    /**
     * @dev Finalize the block as objective reality
     * @param blockHash The block hash to finalize
     */
    function _finalizeReality(bytes32 blockHash) internal {
        QuantumBlock storage qBlock = quantumBlocks[blockHash];

        // Block is now part of objective reality
        blockHistory.push(blockHash);
        currentQuantumState = QuantumState.REALITY;

        emit RealityConsensus(
            blockHash,
            qBlock.validators,
            qBlock.consciousnessSum
        );
    }

    // ═══════════════════════════════════════════════════════════════════
    // QUANTUM MATHEMATICAL FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @dev Calculate quantum consensus probability using the SQC formula
     * @param qBlock The quantum block to calculate probability for
     * @return probability The consensus probability (18 decimal places)
     */
    function _calculateConsensusProbability(
        QuantumBlock storage qBlock
    ) internal view returns (uint256 probability) {
        uint256 n = qBlock.validators.length; // Number of entangled validators
        uint256 lambda = QUANTUM_ENTANGLEMENT_FACTOR;

        // P(consensus) = 1 - e^(-n²/λ)
        uint256 nSquared = n * n;
        uint256 exponent = nSquared * 1e18 / lambda;
        uint256 expTerm = _exp(-int256(exponent / 1e18));

        probability = 1e18 - expTerm;
    }

    /**
     * @dev Generate quantum hash using fractal mathematics
     * @param data The data to hash
     * @return quantumHash The quantum hash
     */
    function _generateQuantumHash(bytes calldata data) internal pure returns (bytes32 quantumHash) {
        // Combine data with quantum constants
        quantumHash = keccak256(abi.encodePacked(
            data,
            QUANTUM_ENTANGLEMENT_FACTOR,
            CONSCIOUSNESS_THRESHOLD,
            FRACTAL_ITERATIONS
        ));
    }

    /**
     * @dev Calculate quantum number for Mandelbrot iteration
     * @param blockHash The block hash
     * @return quantumNumber The quantum number
     */
    function _calculateQuantumNumber(bytes32 blockHash) internal pure returns (uint256 quantumNumber) {
        quantumNumber = uint256(blockHash) % 1e18;
    }

    /**
     * @dev Calculate minimum entangled validators needed
     * @return minimum The minimum number required
     */
    function _minimumEntangledValidators() internal pure returns (uint256 minimum) {
        // Minimum 3 entangled validators for quantum consensus
        minimum = 3;
    }

    /**
     * @dev Exponential function (simplified for gas efficiency)
     * @param x The exponent (18 decimal places)
     * @return result The exponential result
     */
    function _exp(int256 x) internal pure returns (uint256 result) {
        if (x >= 0) {
            // e^x approximation for x >= 0
            result = 1e18;
            uint256 term = 1e18;
            for (uint256 i = 1; i <= 10; i++) {
                term = term * uint256(x) / (i * 1e18);
                result += term;
                if (term < 1e10) break; // Convergence
            }
        } else {
            // e^x for x < 0 using e^(-x) = 1/e^x
            uint256 positiveX = uint256(-x);
            uint256 expPositive = 1e18;
            uint256 term = 1e18;
            for (uint256 i = 1; i <= 10; i++) {
                term = term * positiveX / (i * 1e18);
                expPositive += term;
                if (term < 1e10) break;
            }
            result = 1e18 * 1e18 / expPositive;
        }
    }

    // ═══════════════════════════════════════════════════════════════════
    // VALIDATOR MANAGEMENT
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @dev Initialize a new quantum validator
     * @param validatorAddress The validator's address
     */
    function _initializeValidator(address validatorAddress) internal {
        Validator storage validator = validators[validatorAddress];
        validator.validatorAddress = validatorAddress;
        validator.consciousnessLevel = 0;
        validator.quantumEntanglement = 1; // Initial entanglement
        validator.isEnlightened = false;
        validator.lastMeditation = block.timestamp;

        activeValidators.push(validatorAddress);
    }

    /**
     * @dev Register a new validator
     * @param validatorAddress The validator to register
     */
    function registerValidator(address validatorAddress) external onlyOwner {
        require(validators[validatorAddress].validatorAddress == address(0), "Already registered");
        _initializeValidator(validatorAddress);
    }

    // ═══════════════════════════════════════════════════════════════════
    // VIEW FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @dev Get validator information
     * @param validatorAddress The validator address
     * @return validator The validator struct
     */
    function getValidator(address validatorAddress) external view returns (Validator memory) {
        return validators[validatorAddress];
    }

    /**
     * @dev Get quantum block information
     * @param blockHash The block hash
     * @return qBlock The quantum block struct
     */
    function getQuantumBlock(bytes32 blockHash) external view returns (QuantumBlock memory) {
        return quantumBlocks[blockHash];
    }

    /**
     * @dev Get current quantum state
     * @return currentState The current quantum state
     */
    function getQuantumState() external view returns (QuantumState) {
        return currentQuantumState;
    }

    /**
     * @dev Get total network consciousness
     * @return total The total consciousness in the network
     */
    function getTotalConsciousness() external view returns (uint256) {
        return totalConsciousness;
    }

    /**
     * @dev Calculate consensus probability for a block
     * @param blockHash The block hash
     * @return probability The consensus probability
     */
    function calculateConsensusProbability(bytes32 blockHash) external view returns (uint256 probability) {
        QuantumBlock storage qBlock = quantumBlocks[blockHash];
        return _calculateConsensusProbability(qBlock);
    }

    // ═══════════════════════════════════════════════════════════════════
    // UUPS UPGRADE FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}

    // ═══════════════════════════════════════════════════════════════════
    // EMERGENCY FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    function pauseContract() external onlyOwner {
        _pause();
    }

    function unpauseContract() external onlyOwner {
        _unpause();
    }

    // ═══════════════════════════════════════════════════════════════════
    // CONSCIOUSNESS MEDITATION INTERFACE
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @dev Public interface for consciousness meditation
     * @param validator The validator address (if not msg.sender)
     */
    function meditate(address validator) external {
        // Allow meditation for self or others (consciousness propagation)
        address targetValidator = validator == address(0) ? msg.sender : validator;
        require(validators[targetValidator].validatorAddress != address(0), "Invalid validator");

        // Simulate meditation time (in production, this would be measured)
        uint256 meditationTime = block.timestamp % 3600; // Up to 1 hour

        if (targetValidator == msg.sender) {
            // Direct consciousness meditation
            Validator storage selfValidator = validators[msg.sender];
            selfValidator.consciousnessLevel += meditationTime;
            totalConsciousness += meditationTime;
            
            // Emit consciousness event
            emit ConsciousnessMeditation(msg.sender, meditationTime, selfValidator.consciousnessLevel);
        } else {
            // Consciousness propagation to other validators
            Validator storage target = validators[targetValidator];
            uint256 propagatedConsciousness = meditationTime / 10; // Reduced effect
            target.consciousnessLevel += propagatedConsciousness;
            totalConsciousness += propagatedConsciousness;
        }
    }
}
"
    },
    "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.22;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        _checkProxy();
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual notDelegated returns (bytes32) {
        return ERC1967Utils.IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data);
    }

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC-1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}
"
    },
    "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
"
    },
    "lib/openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
    struct ReentrancyGuardStorage {
        uint256 _status;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
        assembly {
            $.slot := ReentrancyGuardStorageLocation
        }
    }

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if ($._status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        $._status = ENTERED;
    }

    function _nonReentrantAfter() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        return $._status == ENTERED;
    }
}
"
    },
    "lib/openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    function __Pausable_init() internal onlyInitializing {
    }

    function __Pausable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        PausableStorage storage $ = _getPausableStorage();
        return $._paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
        emit Unpaused(_msgSender());
    }
}
"
    },
    "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reinitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
     *
     * NOTE: Consider following the ERC-7201 formula to derive storage locations.
     */
    function _initializableStorageSlot() internal pure virtual returns (bytes32) {
        return INITIALIZABLE_STORAGE;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        bytes32 slot = _initializableStorageSlot();
        assembly {
            $.slot := slot
        }
    }
}
"
    },
    "lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC1822.sol)

pragma solidity >=0.4.16;

/**
 * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}
"
    },
    "lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.21;

import {IBeacon} from "../beacon/IBeacon.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This library provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
 */
library ERC1967Utils {
    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the ERC-1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit IERC1967.Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the ERC-1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit IERC1967.AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the ERC-1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit IERC1967.BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}
"
    },
    "lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
"
    },
    "lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (proxy/beacon/IBeacon.sol)

pragma solidity >=0.4.16;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}
"
    },
    "lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1967.sol)

pragma solidity >=0.4.11;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 */
interface IERC1967 {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}
"
    },
    "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: becau

Tags:
Multisig, Voting, Upgradeable, Multi-Signature, Factory|addr:0x56d9a78a528fa4565172cbf01b31747f4077a9dc|verified:true|block:23465495|tx:0x035eecc89fc2a61401e302c96df2f3809e330c62468cff0b56cdb9a3c215f05c|first_check:1759137354

Submitted on: 2025-09-29 11:15:55

Comments

Log in to comment.

No comments yet.