ETH Price: $2,927.50 (-0.87%)

Contract

0xF807611bEf9c52D893d7f3d63d2F254E684112a3

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

3 Internal Transactions found.

Latest 3 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
174259162025-11-26 14:52:0760 days ago1764168727
0xF807611b...E684112a3
0 ETH
174259162025-11-26 14:52:0760 days ago1764168727
0xF807611b...E684112a3
0 ETH
174259162025-11-26 14:52:0760 days ago1764168727
0xF807611b...E684112a3
0 ETH

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LockToVotePlugin

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.28;

import {ILockManager} from "./interfaces/ILockManager.sol";
import {LockToGovernBase} from "./base/LockToGovernBase.sol";
import {ILockToVote} from "./interfaces/ILockToVote.sol";
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {Action} from "@aragon/osx-commons-contracts/src/executors/IExecutor.sol";
import {IPlugin} from "@aragon/osx-commons-contracts/src/plugin/IPlugin.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IProposal} from "@aragon/osx-commons-contracts/src/plugin/extensions/proposal/IProposal.sol";
import {SafeCastUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";
import {MajorityVotingBase} from "./base/MajorityVotingBase.sol";
import {ILockToGovernBase} from "./interfaces/ILockToGovernBase.sol";

contract LockToVotePlugin is ILockToVote, MajorityVotingBase, LockToGovernBase {
    /// @notice The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID of the contract.
    bytes4 internal constant LOCK_TO_VOTE_INTERFACE_ID =
        this.minProposerVotingPower.selector ^ this.createProposal.selector;

    /// @notice The ID of the permission required to call the `createProposal` functions.
    bytes32 public constant CREATE_PROPOSAL_PERMISSION_ID = keccak256("CREATE_PROPOSAL_PERMISSION");

    /// @notice The ID of the permission required to call `vote` and `clearVote`.
    bytes32 public constant LOCK_MANAGER_PERMISSION_ID = keccak256("LOCK_MANAGER_PERMISSION");

    /// @notice Thrown when a user's vote has been cleared.
    /// @param proposalId the ID of the proposal where the vote was cleared.
    /// @param voter The address of the token holder whose vote was cleared.
    event VoteCleared(uint256 indexed proposalId, address indexed voter);

    /// @notice Thrown when attempting to call clearVote() from an address other than the LockManager.
    /// @param caller The address calling clearVote().
    error VoteRemovalUnauthorized(address caller);

    /// @notice Thrown when attempting to remove a vote, because it is still active or because the plugin mode doesn't allow it.
    /// @param proposalId The ID of the proposal.
    /// @param voter The address of the voter.
    error VoteRemovalForbidden(uint256 proposalId, address voter);

    /// @notice Thrown when atempting to set the plugin or the LockManager as execution targets
    error InvalidTargetAddress();

    /// @notice Thrown when a proposal action is targeting address(0) or the LockManager
    /// @param actionIdx The index of the action
    /// @param target The invalid address that was passed
    error InvalidActionTarget(uint256 actionIdx, address target);

    /// @notice Initializes the component.
    /// @dev This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).
    /// @param _dao The IDAO interface of the associated DAO.
    /// @param _votingSettings The voting settings.
    /// @param _targetConfig Configuration for the execution target, specifying the target address and operation type
    ///     (either `Call` or `DelegateCall`). Defined by `TargetConfig` in the `IPlugin` interface,
    ///     part of the `osx-commons-contracts` package, added in build 3.
    /// @param _pluginMetadata The plugin specific information encoded in bytes.
    ///     This can also be an ipfs cid encoded in bytes.
    function initialize(
        IDAO _dao,
        ILockManager _lockManager,
        VotingSettings calldata _votingSettings,
        IPlugin.TargetConfig calldata _targetConfig,
        bytes calldata _pluginMetadata
    ) external onlyCallAtInitialization reinitializer(1) {
        __MajorityVotingBase_init(_dao, _votingSettings, _targetConfig, _pluginMetadata);
        __LockToGovernBase_init(_lockManager);

        emit MembershipContractAnnounced({definingContract: address(_lockManager.token())});
    }

    /// @notice Checks if this or the parent contract supports an interface by its ID.
    /// @param _interfaceId The ID of the interface.
    /// @return Returns `true` if the interface is supported.
    function supportsInterface(bytes4 _interfaceId)
        public
        view
        virtual
        override(MajorityVotingBase, LockToGovernBase)
        returns (bool)
    {
        return _interfaceId == LOCK_TO_VOTE_INTERFACE_ID || _interfaceId == type(ILockToVote).interfaceId
            || super.supportsInterface(_interfaceId);
    }

    /// @inheritdoc IProposal
    function customProposalParamsABI() external pure override returns (string memory) {
        return "(uint256 allowFailureMap)";
    }

    /// @inheritdoc IProposal
    /// @param _endDate UNUSED: The parameter is kept for compatibility with IProposal but its value is computed internally. It should be set to 0.
    /// @dev Requires the `CREATE_PROPOSAL_PERMISSION_ID` permission.
    function createProposal(
        bytes calldata _metadata,
        Action[] memory _actions,
        uint64 _startDate,
        uint64 _endDate,
        bytes memory _data
    )
        external
        /// @dev `minProposerVotingPower` is checked at the the permission condition behind auth(CREATE_PROPOSAL_PERMISSION_ID)
        auth(CREATE_PROPOSAL_PERMISSION_ID)
        returns (uint256 proposalId)
    {
        uint256 _allowFailureMap;

        if (_data.length != 0) {
            (_allowFailureMap) = abi.decode(_data, (uint256));
        }

        if (currentTokenSupply() == 0) {
            revert NoVotingPower();
        }

        (_startDate, _endDate) = _computeProposalDates(_startDate);

        proposalId = _createProposalId(keccak256(abi.encode(_actions, _metadata)));

        if (_proposalExists(proposalId)) {
            revert ProposalAlreadyExists(proposalId);
        }

        // Store proposal related information
        Proposal storage proposal_ = proposals[proposalId];

        proposal_.parameters.votingMode = votingMode();
        proposal_.parameters.supportThresholdRatio = supportThresholdRatio();
        proposal_.parameters.startDate = _startDate;
        proposal_.parameters.endDate = _endDate;
        proposal_.parameters.minParticipationRatio = minParticipationRatio();
        proposal_.parameters.minApprovalRatio = minApprovalRatio();

        proposal_.targetConfig = getTargetConfig();

        // Reduce costs
        if (_allowFailureMap != 0) {
            proposal_.allowFailureMap = _allowFailureMap;
        }

        for (uint256 i; i < _actions.length; i++) {
            if (_actions[i].to == address(0) || _actions[i].to == address(lockManager)) {
                revert InvalidActionTarget(i, _actions[i].to);
            }

            proposal_.actions.push(_actions[i]);
        }

        emit ProposalCreated(proposalId, _msgSender(), _startDate, _endDate, _metadata, _actions, _allowFailureMap);

        lockManager.proposalCreated(proposalId, _msgSender());
    }

    /// @inheritdoc ILockToVote
    /// @dev Reverts if the proposal with the given `_proposalId` does not exist.
    function canVote(uint256 _proposalId, address _voter, VoteOption _voteOption) public view returns (bool) {
        if (!_proposalExists(_proposalId)) {
            revert NonexistentProposal(_proposalId);
        }

        Proposal storage proposal_ = proposals[_proposalId];
        return _canVote(proposal_, _voter, _voteOption, lockManager.getLockedBalance(_voter));
    }

    /// @inheritdoc ILockToVote
    function vote(uint256 _proposalId, address _voter, VoteOption _voteOption, uint256 _newVotingPower)
        public
        override
        auth(LOCK_MANAGER_PERMISSION_ID)
    {
        /// @dev The DAO can disable auth(LOCK_MANAGER_PERMISSION_ID) from above but not define an arbitrary address other than LockManager
        if (msg.sender != address(lockManager)) {
            revert VoteCallForbidden(address(lockManager));
        } else if (!_proposalExists(_proposalId)) {
            revert NonexistentProposal(_proposalId);
        }

        Proposal storage proposal_ = proposals[_proposalId];

        if (!_canVote(proposal_, _voter, _voteOption, _newVotingPower)) {
            revert VoteCastForbidden(_proposalId, _voter);
        }

        // Same vote
        if (_voteOption == proposal_.votes[_voter].voteOption) {
            // Same value, nothing to do
            if (_newVotingPower == proposal_.votes[_voter].votingPower) return;

            // More balance
            /// @dev diff > 0 is guaranteed, as _canVote() above will return false and revert otherwise
            uint256 diff = _newVotingPower - proposal_.votes[_voter].votingPower;
            proposal_.votes[_voter].votingPower = _newVotingPower;

            if (proposal_.votes[_voter].voteOption == VoteOption.Yes) {
                proposal_.tally.yes += diff;
            } else if (proposal_.votes[_voter].voteOption == VoteOption.No) {
                proposal_.tally.no += diff;
            } else {
                /// @dev Voting none is not possible, as _canVote() above will return false and revert if so
                proposal_.tally.abstain += diff;
            }
        } else {
            /// @dev VoteReplacement has already been enforced by _canVote()

            // Was there a vote?
            if (proposal_.votes[_voter].votingPower > 0) {
                // Undo that vote
                if (proposal_.votes[_voter].voteOption == VoteOption.Yes) {
                    proposal_.tally.yes -= proposal_.votes[_voter].votingPower;
                } else if (proposal_.votes[_voter].voteOption == VoteOption.No) {
                    proposal_.tally.no -= proposal_.votes[_voter].votingPower;
                } else {
                    /// @dev Voting none is not possible, only abstain is left
                    proposal_.tally.abstain -= proposal_.votes[_voter].votingPower;
                }
            }

            // Register the new vote
            if (_voteOption == VoteOption.Yes) {
                proposal_.tally.yes += _newVotingPower;
            } else if (_voteOption == VoteOption.No) {
                proposal_.tally.no += _newVotingPower;
            } else {
                /// @dev Voting none is not possible, only abstain is left
                proposal_.tally.abstain += _newVotingPower;
            }
            proposal_.votes[_voter].voteOption = _voteOption;
            proposal_.votes[_voter].votingPower = _newVotingPower;
        }

        emit VoteCast(_proposalId, _voter, _voteOption, _newVotingPower);
    }

    /// @inheritdoc ILockToVote
    function clearVote(uint256 _proposalId, address _voter) external {
        /// @dev The LockManager can always call clearVote(), regardless of LOCK_MANAGER_PERMISSION_ID
        if (msg.sender != address(lockManager)) {
            revert VoteRemovalUnauthorized(msg.sender);
        }

        Proposal storage proposal_ = proposals[_proposalId];
        if (!_isProposalOpen(proposal_)) {
            revert VoteRemovalForbidden(_proposalId, _voter);
        } else if (proposal_.parameters.votingMode != VotingMode.VoteReplacement) {
            revert VoteRemovalForbidden(_proposalId, _voter);
        } else if (proposal_.votes[_voter].votingPower == 0) {
            // Nothing to do
            return;
        }

        // Undo that vote
        if (proposal_.votes[_voter].voteOption == VoteOption.Yes) {
            proposal_.tally.yes -= proposal_.votes[_voter].votingPower;
        } else if (proposal_.votes[_voter].voteOption == VoteOption.No) {
            proposal_.tally.no -= proposal_.votes[_voter].votingPower;
        }
        /// @dev Double checking for abstain, even though canVote prevents any other voteOption value
        else if (proposal_.votes[_voter].voteOption == VoteOption.Abstain) {
            proposal_.tally.abstain -= proposal_.votes[_voter].votingPower;
        }
        proposal_.votes[_voter].votingPower = 0;
        proposal_.votes[_voter].voteOption = VoteOption.None;

        emit VoteCleared(_proposalId, _voter);
    }

    /// @inheritdoc ILockToGovernBase
    function isProposalOpen(uint256 _proposalId) external view returns (bool) {
        Proposal storage proposal_ = proposals[_proposalId];
        return _isProposalOpen(proposal_);
    }

    /// @inheritdoc ILockToGovernBase
    function isProposalEnded(uint256 _proposalId) external view returns (bool) {
        Proposal storage proposal_ = proposals[_proposalId];
        return _isProposalEnded(proposal_);
    }

    /// @inheritdoc MajorityVotingBase
    function minProposerVotingPower() public view override(ILockToGovernBase, MajorityVotingBase) returns (uint256) {
        return MajorityVotingBase.minProposerVotingPower();
    }

    /// @inheritdoc MajorityVotingBase
    function currentTokenSupply() public view override returns (uint256) {
        return IERC20(lockManager.token()).totalSupply();
    }

    /// @inheritdoc ILockToGovernBase
    function usedVotingPower(uint256 _proposalId, address _voter) public view returns (uint256) {
        return proposals[_proposalId].votes[_voter].votingPower;
    }

    /// @notice Defines of the IExecutor contract where executable actions will be sent to.
    ///         IMPORTANT: The executor address (target) should only be set to the DAO or to the Executor contract deployed by Aragon.
    ///         IMPORTANT: Defining any other executor in DelegateCall mode (operation), can lead to undefined behaviour.
    /// @param _targetConfig The target Config containing the executor address and operation mode.
    /// @dev The caller must have the `SET_TARGET_CONFIG_PERMISSION_ID` permission.
    function setTargetConfig(TargetConfig calldata _targetConfig)
        public
        virtual
        override
        auth(SET_TARGET_CONFIG_PERMISSION_ID)
    {
        if (_targetConfig.target == address(this) || _targetConfig.target == address(lockManager)) {
            revert InvalidTargetAddress();
        }

        _setTargetConfig(_targetConfig);
    }

    // Internal helpers

    function _canVote(Proposal storage proposal_, address _voter, VoteOption _voteOption, uint256 _newVotingPower)
        internal
        view
        returns (bool)
    {
        uint256 _currentVotingPower = proposal_.votes[_voter].votingPower;

        // The proposal vote hasn't started or has already ended.
        if (!_isProposalOpen(proposal_)) {
            return false;
        } else if (_voteOption == VoteOption.None) {
            return false;
        }
        // Standard voting
        else if (proposal_.parameters.votingMode != VotingMode.VoteReplacement) {
            // Lowering the existing voting power (or the same) is not allowed
            if (_newVotingPower <= _currentVotingPower) {
                return false;
            }
            // The voter already voted a different option but vote replacment is not allowed.
            else if (
                proposal_.votes[_voter].voteOption != VoteOption.None
                    && _voteOption != proposal_.votes[_voter].voteOption
            ) {
                return false;
            }
        }
        // Vote replacement mode
        else {
            // Lowering the existing voting power is not allowed
            if (_newVotingPower == 0 || _newVotingPower < _currentVotingPower) {
                return false;
            }
            // Voting the same option with the same balance is not allowed
            else if (_newVotingPower == _currentVotingPower && _voteOption == proposal_.votes[_voter].voteOption) {
                return false;
            }
        }

        return true;
    }

    function _execute(uint256 _proposalId) internal override {
        super._execute(_proposalId);

        // Notify the LockManager to stop tracking this proposal ID
        lockManager.proposalSettled(_proposalId);
    }

    /// @notice This empty reserved space is put in place to allow future versions to add
    /// new variables without shifting down storage in the inheritance chain
    /// (see [OpenZeppelin's guide about storage gaps]
    /// (https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
    uint256[50] private __gap;
}

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.28;

import {ILockToGovernBase} from "./ILockToGovernBase.sol";
import {IMajorityVoting} from "./IMajorityVoting.sol";

/// @notice Defines wether the accepted plugin types. Currently: voting.
///     Placeholder for future plugin variants
enum PluginMode {
    Voting
}

/// @notice The struct containing the LockManager helper settings. They are immutable after deployed.
struct LockManagerSettings {
    /// @notice The type of governance plugin expected
    PluginMode pluginMode;
}

/// @title ILockManager
/// @author Aragon X 2025
/// @notice Helper contract acting as the vault for locked tokens used to vote on LockToGovern plugins.
interface ILockManager {
    /// @notice Returns the current settings of the LockManager.
    /// @return pluginMode The plugin mode (currently, voting only)
    function settings() external view returns (PluginMode pluginMode);

    /// @notice Returns the address of the voting plugin.
    /// @return The LockToVote plugin address.
    function plugin() external view returns (ILockToGovernBase);

    /// @notice Returns the address of the token contract used to determine the voting power.
    /// @return The token used for voting.
    function token() external view returns (address);

    /// @notice Returns the currently locked balance that the given account has on the contract.
    /// @param account The address whose locked balance is returned.
    function getLockedBalance(address account) external view returns (uint256);

    /// @notice Returns how many active proposalID's were created by the given address
    /// @param _creator The address to use for filtering
    function activeProposalsCreatedBy(address _creator) external view returns (uint256 _result);

    /// @notice Locks the balance currently allowed by msg.sender on this contract
    /// NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest.
    /// They can only be unlocked when all active proposals with votes have ended.
    function lock() external;

    /// @notice Locks the given amount from msg.sender on this contract
    /// NOTE: Tokens locked and not allocated into a proposal are treated in the same way as the rest.
    /// They can only be unlocked when all active proposals with votes have ended.
    /// @param amount How many tokens the contract should lock
    function lock(uint256 amount) external;

    /// @notice Locks the balance currently allowed by msg.sender on this contract and registers the given vote on the target plugin
    /// @param proposalId The ID of the proposal where the vote will be registered
    /// @param vote The vote to cast (Yes, No, Abstain)
    function lockAndVote(uint256 proposalId, IMajorityVoting.VoteOption vote) external;

    /// @notice Locks the given amount from msg.sender on this contract and registers the given vote on the target plugin
    /// @param proposalId The ID of the proposal where the vote will be registered
    /// @param vote The vote to cast (Yes, No, Abstain)
    /// @param amount How many tokens the contract should lock and use for voting
    function lockAndVote(uint256 proposalId, IMajorityVoting.VoteOption vote, uint256 amount) external;

    /// @notice Uses the locked balance to vote on the given proposal for the registered plugin
    /// @param proposalId The ID of the proposal where the vote will be registered
    /// @param vote The vote to cast (Yes, No, Abstain)
    function vote(uint256 proposalId, IMajorityVoting.VoteOption vote) external;

    /// @notice Checks if an account can participate on a proposal. This can be because the proposal
    /// - has not started,
    /// - has ended,
    /// - was executed, or
    /// - the voter doesn't have any tokens locked.
    /// @param proposalId The proposal Id.
    /// @param voter The account address to be checked.
    /// @param voteOption The value of the new vote to register.
    /// @return Returns true if the account is allowed to vote.
    /// @dev The function assumes that the queried proposal exists.
    function canVote(uint256 proposalId, address voter, IMajorityVoting.VoteOption voteOption)
        external
        view
        returns (bool);

    /// @notice If the governance plugin allows it, releases all active locks placed on active proposals and transfers msg.sender's locked balance back. Depending on the current mode, it withdraws only if no locks are being used in active proposals.
    function unlock() external;

    /// @notice Called by the lock to vote plugin whenever a proposal is created. It instructs the manager to start tracking the given proposal.
    /// @param proposalId The ID of the proposal that msg.sender is reporting as created.
    /// @param creator The address creating the proposal.
    function proposalCreated(uint256 proposalId, address creator) external;

    /// @notice Called by the lock to vote plugin whenever a proposal is executed (or settled).
    ///     It instructs the manager to remove the proposal from the list of active proposal locks.
    ///     There's no guarantee that `proposalSettled()` will be reliably called for a proposal ID.
    ///     Manually checking a proposal's state may be necessary in order to verify that it has ended.
    /// @param proposalId The ID of the proposal that msg.sender is reporting as done.
    function proposalSettled(uint256 proposalId) external;

    /// @notice Triggers a manual cleanup of the known proposal ID's that have already ended.
    ///         Settled proposals are garbage collected when they are executed or when a user unlocks his tokens.
    ///         Use this method if a long list of unsettled yet ended proposals ever creates a gas bottleneck that discourages users from unlocking.
    /// @param count How many proposals should be cleaned up, at most.
    function pruneProposals(uint256 count) external;

    /// @notice Defines the given plugin address as the target for voting.
    /// @param plugin The address of the contract to use as the plugin.
    function setPluginAddress(ILockToGovernBase plugin) external;
}

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.28;

/* solhint-disable max-line-length */

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ILockManager} from "../interfaces/ILockManager.sol";
import {ILockToGovernBase} from "../interfaces/ILockToGovernBase.sol";
import {IMembership} from "@aragon/osx-commons-contracts/src/plugin/extensions/membership/IMembership.sol";
import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";

/// @title LockToGovernBase
/// @author Aragon X 2024-2025
abstract contract LockToGovernBase is ILockToGovernBase, IMembership, ERC165Upgradeable {
    /// @notice Emitted when the address of the LockManager is set.
    /// @param lockManager The address of the LockManager contract
    event LockManagerDefined(ILockManager indexed lockManager);

    /// @notice Thrown when creating a proposal without any locked tokens.
    error NoVotingPower();

    /// @notice Thrown when attempting to define the address of the LockManager after it was already set.
    error LockManagerAlreadyDefined();

    /// @inheritdoc ILockToGovernBase
    ILockManager public lockManager;

    /// @notice Initializes the component to be used by inheriting contracts.
    /// @param _lockManager The address of the contract with the ability to manager votes on behalf of users.
    function __LockToGovernBase_init(ILockManager _lockManager) internal onlyInitializing {
        _setLockManager(_lockManager);
    }

    /// @notice Checks if this or the parent contract supports an interface by its ID.
    /// @param _interfaceId The ID of the interface.
    /// @return Returns `true` if the interface is supported.
    function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC165Upgradeable) returns (bool) {
        return _interfaceId == type(ILockToGovernBase).interfaceId || _interfaceId == type(IMembership).interfaceId
            || super.supportsInterface(_interfaceId);
    }

    /// @inheritdoc ILockToGovernBase
    function token() public view returns (IERC20) {
        return IERC20(lockManager.token());
    }

    /// @inheritdoc IMembership
    function isMember(address _account) external view returns (bool) {
        if (lockManager.getLockedBalance(_account) > 0) return true;

        IERC20 _token = token();
        if (address(_token) != address(0)) {
            if (_token.balanceOf(_account) > 0) return true;
        }

        return false;
    }

    function _setLockManager(ILockManager _lockManager) private {
        if (address(lockManager) != address(0)) {
            revert LockManagerAlreadyDefined();
        }

        lockManager = _lockManager;

        emit LockManagerDefined(_lockManager);
    }

    /// @notice This empty reserved space is put in place to allow future versions to add
    /// new variables without shifting down storage in the inheritance chain
    /// (see [OpenZeppelin's guide about storage gaps]
    /// (https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
    uint256[49] private __gap;
}

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.28;

import {ILockToGovernBase} from "./ILockToGovernBase.sol";
import {IMajorityVoting} from "./IMajorityVoting.sol";

/// @title ILockToVote
/// @author Aragon X
/// @notice Governance plugin allowing token holders to use tokens locked without a snapshot requirement and engage in proposals immediately
interface ILockToVote is ILockToGovernBase {
    /// @notice Checks if an account can participate on a proposal. This can fail because the vote
    /// - has not started,
    /// - has ended,
    /// - was executed, or
    /// - the voter doesn't have voting powers.
    /// - the voter can increase the amount of tokens assigned
    /// @param proposalId The proposal Id.
    /// @param voter The account address to be checked.
    /// @dev `voteOption`, 1 -> abstain, 2 -> yes, 3 -> no
    /// @param voteOption The value of the new vote to register. If an existing vote existed, it will be replaced.
    /// @return Returns true if the account is allowed to vote.
    function canVote(uint256 proposalId, address voter, IMajorityVoting.VoteOption voteOption)
        external
        view
        returns (bool);

    /// @notice Votes on a proposal and, depending on the mode, executes it.
    /// @dev `voteOption`, 1 -> abstain, 2 -> yes, 3 -> no
    /// @param proposalId The ID of the proposal to vote on.
    /// @param voter The address of the account whose vote will be registered
    /// @param voteOption The value of the new vote to register. If an existing vote existed, it will be replaced.
    /// @param votingPower The new balance that should be allocated to the voter. It can only be bigger.
    /// @dev votingPower updates any prior voting power, it does not add to the existing amount.
    function vote(uint256 proposalId, address voter, IMajorityVoting.VoteOption voteOption, uint256 votingPower)
        external;

    /// @notice Reverts if the vote cannot be cleared due to the voting settings. This can be because:
    ///     - The plugin is in Standard votingMode and the voter has votes registered on active proposals
    /// @param proposalId The ID of the proposal.
    /// @param voter The voter's address.
    function clearVote(uint256 proposalId, address voter) external;
}

// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

/// @title IDAO
/// @author Aragon X - 2022-2024
/// @notice The interface required for DAOs within the Aragon App DAO framework.
/// @custom:security-contact [email protected]
interface IDAO {
    /// @notice Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.
    /// @param _where The address of the contract.
    /// @param _who The address of a EOA or contract to give the permissions.
    /// @param _permissionId The permission identifier.
    /// @param _data The optional data passed to the `PermissionCondition` registered.
    /// @return Returns true if the address has permission, false if not.
    function hasPermission(
        address _where,
        address _who,
        bytes32 _permissionId,
        bytes memory _data
    ) external view returns (bool);

    /// @notice Updates the DAO metadata (e.g., an IPFS hash).
    /// @param _metadata The IPFS hash of the new metadata object.
    function setMetadata(bytes calldata _metadata) external;

    /// @notice Emitted when the DAO metadata is updated.
    /// @param metadata The IPFS hash of the new metadata object.
    event MetadataSet(bytes metadata);

    /// @notice Emitted when a standard callback is registered.
    /// @param interfaceId The ID of the interface.
    /// @param callbackSelector The selector of the callback function.
    /// @param magicNumber The magic number to be registered for the callback function selector.
    event StandardCallbackRegistered(
        bytes4 interfaceId,
        bytes4 callbackSelector,
        bytes4 magicNumber
    );

    /// @notice Deposits (native) tokens to the DAO contract with a reference string.
    /// @param _token The address of the token or address(0) in case of the native token.
    /// @param _amount The amount of tokens to deposit.
    /// @param _reference The reference describing the deposit reason.
    function deposit(address _token, uint256 _amount, string calldata _reference) external payable;

    /// @notice Emitted when a token deposit has been made to the DAO.
    /// @param sender The address of the sender.
    /// @param token The address of the deposited token.
    /// @param amount The amount of tokens deposited.
    /// @param _reference The reference describing the deposit reason.
    event Deposited(
        address indexed sender,
        address indexed token,
        uint256 amount,
        string _reference
    );

    /// @notice Emitted when a native token deposit has been made to the DAO.
    /// @dev This event is intended to be emitted in the `receive` function and is therefore bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).
    /// @param sender The address of the sender.
    /// @param amount The amount of native tokens deposited.
    event NativeTokenDeposited(address sender, uint256 amount);

    /// @notice Setter for the trusted forwarder verifying the meta transaction.
    /// @param _trustedForwarder The trusted forwarder address.
    function setTrustedForwarder(address _trustedForwarder) external;

    /// @notice Getter for the trusted forwarder verifying the meta transaction.
    /// @return The trusted forwarder address.
    function getTrustedForwarder() external view returns (address);

    /// @notice Emitted when a new TrustedForwarder is set on the DAO.
    /// @param forwarder the new forwarder address.
    event TrustedForwarderSet(address forwarder);

    /// @notice Checks whether a signature is valid for a provided hash according to [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271).
    /// @param _hash The hash of the data to be signed.
    /// @param _signature The signature byte array associated with `_hash`.
    /// @return Returns the `bytes4` magic value `0x1626ba7e` if the signature is valid and `0xffffffff` if not.
    function isValidSignature(bytes32 _hash, bytes memory _signature) external returns (bytes4);

    /// @notice Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.
    /// @param _interfaceId The ID of the interface.
    /// @param _callbackSelector The selector of the callback function.
    /// @param _magicNumber The magic number to be registered for the function signature.
    function registerStandardCallback(
        bytes4 _interfaceId,
        bytes4 _callbackSelector,
        bytes4 _magicNumber
    ) external;

    /// @notice Removed function being left here to not corrupt the IDAO interface ID. Any call will revert.
    /// @dev Introduced in v1.0.0. Removed in v1.4.0.
    function setSignatureValidator(address) external;
}

File 6 of 35 : IExecutor.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

/// @notice The action struct to be consumed by the DAO's `execute` function resulting in an external call.
/// @param to The address to call.
/// @param value The native token value to be sent with the call.
/// @param data The bytes-encoded function selector and calldata for the call.
struct Action {
    address to;
    uint256 value;
    bytes data;
}

/// @title IExecutor
/// @author Aragon X - 2024
/// @notice The interface required for Executors within the Aragon App DAO framework.
/// @custom:security-contact [email protected]
interface IExecutor {
    /// @notice Emitted when a proposal is executed.
    /// @dev The value of `callId` is defined by the component/contract calling the execute function.
    ///      A `Plugin` implementation can use it, for example, as a nonce.
    /// @param actor The address of the caller.
    /// @param callId The ID of the call.
    /// @param actions The array of actions executed.
    /// @param allowFailureMap The allow failure map encoding which actions are allowed to fail.
    /// @param failureMap The failure map encoding which actions have failed.
    /// @param execResults The array with the results of the executed actions.
    event Executed(
        address indexed actor,
        bytes32 callId,
        Action[] actions,
        uint256 allowFailureMap,
        uint256 failureMap,
        bytes[] execResults
    );

    /// @notice Executes a list of actions. If a zero allow-failure map is provided, a failing action reverts the entire execution. If a non-zero allow-failure map is provided, allowed actions can fail without the entire call being reverted.
    /// @param _callId The ID of the call. The definition of the value of `callId` is up to the calling contract and can be used, e.g., as a nonce.
    /// @param _actions The array of actions.
    /// @param _allowFailureMap A bitmap allowing execution to succeed, even if individual actions might revert. If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.
    /// @return The array of results obtained from the executed actions in `bytes`.
    /// @return The resulting failure map containing the actions have actually failed.
    function execute(
        bytes32 _callId,
        Action[] memory _actions,
        uint256 _allowFailureMap
    ) external returns (bytes[] memory, uint256);
}

File 7 of 35 : IPlugin.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

/// @title IPlugin
/// @author Aragon X - 2022-2024
/// @notice An interface defining the traits of a plugin.
/// @custom:security-contact [email protected]
interface IPlugin {
    /// @notice Types of plugin implementations available within OSx.
    enum PluginType {
        UUPS,
        Cloneable,
        Constructable
    }

    /// @notice Specifies the type of operation to perform.
    enum Operation {
        Call,
        DelegateCall
    }

    /// @notice Configuration for the target contract that the plugin will interact with, including the address and operation type.
    /// @dev By default, the plugin typically targets the associated DAO and performs a `Call` operation. However, this
    ///      configuration allows the plugin to specify a custom executor and select either `Call` or `DelegateCall` based on
    ///      the desired execution context.
    /// @param target The address of the target contract, typically the associated DAO but configurable to a custom executor.
    /// @param operation The type of operation (`Call` or `DelegateCall`) to execute on the target, as defined by `Operation`.
    struct TargetConfig {
        address target;
        Operation operation;
    }

    /// @notice Returns the plugin's type
    function pluginType() external view returns (PluginType);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {Action} from "../../../executors/IExecutor.sol";

/// @title IProposal
/// @author Aragon X - 2022-2024
/// @notice An interface to be implemented by DAO plugins that create and execute proposals.
/// @custom:security-contact [email protected]
interface IProposal {
    /// @notice Emitted when a proposal is created.
    /// @param proposalId The ID of the proposal.
    /// @param creator  The creator of the proposal.
    /// @param startDate The start date of the proposal in seconds.
    /// @param endDate The end date of the proposal in seconds.
    /// @param metadata The metadata of the proposal.
    /// @param actions The actions that will be executed if the proposal passes.
    /// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert.
    ///     If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts.
    ///     A failure map value of 0 requires every action to not revert.
    event ProposalCreated(
        uint256 indexed proposalId,
        address indexed creator,
        uint64 startDate,
        uint64 endDate,
        bytes metadata,
        Action[] actions,
        uint256 allowFailureMap
    );

    /// @notice Emitted when a proposal is executed.
    /// @param proposalId The ID of the proposal.
    event ProposalExecuted(uint256 indexed proposalId);

    /// @notice Creates a new proposal.
    /// @param _metadata The metadata of the proposal.
    /// @param _actions The actions that will be executed after the proposal passes.
    /// @param _startDate The start date of the proposal.
    /// @param _endDate The end date of the proposal.
    /// @param _data The additional abi-encoded data to include more necessary fields.
    /// @return proposalId The id of the proposal.
    function createProposal(
        bytes memory _metadata,
        Action[] memory _actions,
        uint64 _startDate,
        uint64 _endDate,
        bytes memory _data
    ) external returns (uint256 proposalId);

    /// @notice Whether proposal succeeded or not.
    /// @dev Note that this must not include time window checks and only make a decision based on the thresholds.
    /// @param _proposalId The id of the proposal.
    /// @return Returns if proposal has been succeeded or not without including time window checks.
    function hasSucceeded(uint256 _proposalId) external view returns (bool);

    /// @notice Executes a proposal.
    /// @param _proposalId The ID of the proposal to be executed.
    function execute(uint256 _proposalId) external;

    /// @notice Checks if a proposal can be executed.
    /// @param _proposalId The ID of the proposal to be checked.
    /// @return True if the proposal can be executed, false otherwise.
    function canExecute(uint256 _proposalId) external view returns (bool);

    /// @notice The human-readable abi format for extra params included in `data` of `createProposal`.
    /// @dev Used for UI to easily detect what extra params the contract expects.
    /// @return ABI of params in `data` of `createProposal`.
    function customProposalParamsABI() external view returns (string memory);

    /// @notice Returns the proposal count which determines the next proposal ID.
    /// @dev This function is deprecated but remains in the interface for backward compatibility.
    ///      It now reverts to prevent ambiguity.
    /// @return The proposal count.
    function proposalCount() external view returns (uint256);
}

File 10 of 35 : SafeCastUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCastUpgradeable {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.28;

/* solhint-disable max-line-length */

import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {SafeCastUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";

import {ProposalUpgradeable} from "@aragon/osx-commons-contracts/src/plugin/extensions/proposal/ProposalUpgradeable.sol";
import {RATIO_BASE, RatioOutOfBounds} from "@aragon/osx-commons-contracts/src/utils/math/Ratio.sol";
import {PluginUUPSUpgradeable} from "../lib/PluginUUPSUpgradeable.sol";
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {IProposal} from "@aragon/osx-commons-contracts/src/plugin/extensions/proposal/IProposal.sol";
import {Action} from "@aragon/osx-commons-contracts/src/executors/IExecutor.sol";
import {MetadataExtensionUpgradeable} from
    "@aragon/osx-commons-contracts/src/utils/metadata/MetadataExtensionUpgradeable.sol";
import {IMajorityVoting} from "../interfaces/IMajorityVoting.sol";

/* solhint-enable max-line-length */

/// @title MajorityVotingBase
/// @author Aragon X - 2022-2025
/// @notice The abstract implementation of majority voting plugins.
///
/// ### Parameterization
///
/// We define 3 parameters:
/// $$\texttt{support} = \frac{N_\text{yes}}{N_\text{yes} + N_\text{no}} \in [0,1]$$
/// $$\texttt{participation} = \frac{N_\text{yes} + N_\text{no} + N_\text{abstain}}{N_\text{total}} \in [0,1],$$
/// where $N_\text{yes}$, $N_\text{no}$, and $N_\text{abstain}$ are the yes, no, and abstain votes that have been
/// cast and $N_\text{total}$ is the total voting power available at proposal creation time.
/// and
/// $$\texttt{approval} = \frac{N_\text{yes}}{N_\text{total}} \in [0,1]$$
///
/// #### Limit Values: Support Threshold & Minimum Participation
///
/// Two limit values are associated with these parameters and decide if a proposal execution should be possible:
/// $\texttt{supportThresholdRatio} \in [0,1)$ and $\texttt{minParticipationRatio} \in [0,1]$.
///
/// For threshold values, $>$ comparison is used. This **does not** include the threshold value.
/// E.g., for $\texttt{supportThresholdRatio} = 50\%$,
/// the criterion is fulfilled if there is at least one more yes than no votes ($N_\text{yes} = N_\text{no} + 1$).
/// For minimum values, $\ge{}$ comparison is used. This **does** include the minimum participation value.
/// E.g., for $\texttt{minParticipationRatio} = 40\%$ and $N_\text{total} = 10$,
/// the criterion is fulfilled if 4 out of 10 votes were casted.
///
/// Majority voting implies that the support threshold is set with
/// $$\texttt{supportThresholdRatio} \ge 50\% .$$
/// However, this is not enforced by the contract code and developers can make unsafe parameters and
/// only the frontend will warn about bad parameter settings.
///
/// ### Execution Criteria
///
/// After the vote is closed, two criteria decide if the proposal passes.
///
/// #### The Support Criterion
///
/// For a proposal to pass, the required ratio of yes and no votes must be met:
/// $$(1- \texttt{supportThresholdRatio}) \cdot N_\text{yes} > \texttt{supportThresholdRatio} \cdot N_\text{no}.$$
/// Note, that the inequality yields the simple majority voting condition for $\texttt{supportThresholdRatio}=\frac{1}{2}$.
///
/// #### The Participation Criterion
///
/// For a proposal to pass, the minimum voting power must have been cast:
/// $$N_\text{yes} + N_\text{no} + N_\text{abstain} \ge \texttt{minVotingPower},$$
/// where $\texttt{minVotingPower} = \texttt{minParticipationRatio} \cdot N_\text{total}$.
///
/// ### Vote Replacement
///
/// The contract allows votes to be replaced. Voters can vote multiple times
/// and only the latest voteOption is tallied.
///
/// @dev This contract implements the `IMajorityVoting` interface.
/// @custom:security-contact [email protected]
abstract contract MajorityVotingBase is
    IMajorityVoting,
    Initializable,
    ERC165Upgradeable,
    MetadataExtensionUpgradeable,
    PluginUUPSUpgradeable,
    ProposalUpgradeable
{
    using SafeCastUpgradeable for uint256;

    /// @notice The different voting modes available.
    /// @param Standard In standard mode, the voting power can be increased but votes cannot be replaced.
    /// @param VoteReplacement In vote replacement mode, voters can change their vote
    ///     multiple times and only the latest vote option is tallied.
    enum VotingMode {
        Standard,
        VoteReplacement
    }

    /// @notice A container for the majority voting settings that will be applied as parameters on proposal creation.
    /// @param votingMode A parameter to select the vote mode.
    ///     In standard mode (0), the voting power can be increased but votes cannot be replaced.
    ///     In vote replacement mode (1), voters can change their vote multiple times
    ///     and only the latest vote option is tallied.
    /// @param supportThresholdRatio The support threshold ratio.
    ///     Its value has to be in the interval [0, 10^6) defined by `RATIO_BASE = 10**6`.
    ///     This is intended as the primary metric for proposals to pass.
    /// @param minParticipationRatio The minimum voting power ratio needed for a proposal to reach the minimum participation.
    ///     Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.
    ///     This is a intended as secondary metric to prevent noise or spam from passing unadvertedly.
    ///     Relatively high ratios are not encouraged.
    /// @param minApprovalRatio Minimum ratio of allocated YES votes.
    ///     Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.
    ///     This is a intended as secondary metric to prevent noise or spam from passing unadvertedly.
    ///     Relatively high ratios are not encouraged.
    /// @param proposalDuration The duration of the proposal vote in seconds.
    /// @param minProposerVotingPower The minimum voting power required to create a proposal.
    struct VotingSettings {
        VotingMode votingMode;
        uint32 supportThresholdRatio;
        uint32 minParticipationRatio;
        uint32 minApprovalRatio;
        uint64 proposalDuration;
        uint256 minProposerVotingPower;
    }

    /// @notice A container for proposal-related information.
    /// @param executed Whether the proposal is executed or not.
    /// @param parameters The proposal parameters at the time of the proposal creation.
    /// @param tally The vote tally of the proposal.
    /// @param votes The voting power cast by each voter.
    /// @param actions The actions to be executed when the proposal passes.
    /// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert.
    ///     If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts.
    ///     A failure map value of 0 requires every action to not revert.
    /// @param targetConfig Configuration for the execution target, specifying the target address and operation type
    ///     (either `Call` or `DelegateCall`). Defined by `TargetConfig` in the `IPlugin` interface,
    ///     part of the `osx-commons-contracts` package, added in build 3.
    struct Proposal {
        bool executed;
        ProposalParameters parameters;
        Tally tally;
        mapping(address => VoteEntry) votes;
        Action[] actions;
        uint256 allowFailureMap;
        TargetConfig targetConfig;
    }

    /// @notice A container for the proposal parameters at the time of proposal creation.
    /// @param votingMode A parameter to select the vote mode.
    /// @param supportThresholdRatio The support threshold ratio.
    ///     Its value has to be in the interval [0, 10^6) defined by `RATIO_BASE = 10**6`.
    ///     This is intended as the primary metric for proposals to pass.
    /// @param startDate The timestamp on which a proposal starts accepting votes. Range: `[startDate, endDate)`
    /// @param endDate The timestamp on which a proposal no longer accepts votes.
    /// @param minParticipationRatio The minimum voting power ratio needed for a proposal to reach the minimum participation.
    ///     Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.
    ///     This is a intended as secondary metric to prevent noise or spam from passing unadvertedly.
    ///     Relatively high ratios are not encouraged.
    /// @param minApprovalRatio Minimum ratio of allocated YES votes.
    ///     Its value has to be in the interval [0, 10^6] defined by `RATIO_BASE = 10**6`.
    ///     This is a intended as secondary metric to prevent noise or spam from passing unadvertedly.
    ///     Relatively high ratios are not encouraged.
    struct ProposalParameters {
        VotingMode votingMode;
        uint32 supportThresholdRatio;
        uint64 startDate;
        uint64 endDate;
        uint256 minParticipationRatio;
        uint256 minApprovalRatio;
    }

    /// @notice A container for the proposal vote tally.
    /// @param abstain The number of abstain votes casted.
    /// @param yes The number of yes votes casted.
    /// @param no The number of no votes casted.
    struct Tally {
        uint256 abstain;
        uint256 yes;
        uint256 no;
    }

    /// @notice The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID of the contract.
    bytes4 internal constant MAJORITY_VOTING_BASE_INTERFACE_ID = this.proposalDuration.selector
        ^ this.minProposerVotingPower.selector ^ this.votingMode.selector ^ this.currentTokenSupply.selector
        ^ this.getProposal.selector ^ this.updateVotingSettings.selector;

    /// @notice The ID of the permission required to call the `updateVotingSettings` function.
    bytes32 public constant UPDATE_SETTINGS_PERMISSION_ID = keccak256("UPDATE_SETTINGS_PERMISSION");

    /// @notice The ID of the permission required to call the `execute` function.
    bytes32 public constant EXECUTE_PROPOSAL_PERMISSION_ID = keccak256("EXECUTE_PROPOSAL_PERMISSION");

    /// @notice A mapping between proposal IDs and proposal information.
    // solhint-disable-next-line named-parameters-mapping
    mapping(uint256 => Proposal) internal proposals;

    /// @notice The struct storing the voting settings.
    VotingSettings private votingSettings;

    /// @notice Thrown when the given DAO address is empty.
    error EmptyDAOAddress();

    /// @notice Thrown if a date is out of bounds.
    /// @param limit The limit value.
    /// @param actual The actual value.
    error DateOutOfBounds(uint64 limit, uint64 actual);

    /// @notice Thrown if the proposal duration value is out of bounds (less than one hour or greater than 1 month).
    /// @param limit The limit value.
    /// @param actual The actual value.
    error ProposalDurationOutOfBounds(uint64 limit, uint64 actual);

    /// @notice Thrown when a sender is not allowed to create a proposal.
    /// @param sender The sender address.
    error ProposalCreationForbidden(address sender);

    /// @notice Thrown when a proposal doesn't exist.
    /// @param proposalId The ID of the proposal which doesn't exist.
    error NonexistentProposal(uint256 proposalId);

    /// @notice Thrown when the address calling vote() is not the LockManager.
    /// @param caller The address calling vote().
    error VoteCallForbidden(address caller);

    /// @notice Thrown if an account is not allowed to cast a vote. This can be because the vote
    /// - has not started,
    /// - has ended,
    /// - was executed, or
    /// - the account doesn't have voting powers.
    /// @param proposalId The ID of the proposal.
    /// @param account The address of the _account.
    error VoteCastForbidden(uint256 proposalId, address account);

    /// @notice Thrown if the proposal execution is forbidden.
    /// @param proposalId The ID of the proposal.
    error ProposalExecutionForbidden(uint256 proposalId);

    /// @notice Thrown if the proposal with same actions and metadata already exists.
    /// @param proposalId The id of the proposal.
    error ProposalAlreadyExists(uint256 proposalId);

    /// @notice Emitted when the voting settings are updated.
    /// @param votingMode A parameter to select the vote mode.
    /// @param supportThresholdRatio The support threshold ratio.
    /// @param minParticipationRatio The minimum participation ratio.
    /// @param minApprovalRatio The minimum ratio of yes votes over the token supply needed for the proposal advance.
    /// @param proposalDuration The duration of the proposal in seconds.
    /// @param minProposerVotingPower The minimum voting power required to create a proposal.
    event VotingSettingsUpdated(
        VotingMode votingMode,
        uint32 supportThresholdRatio,
        uint32 minParticipationRatio,
        uint32 minApprovalRatio,
        uint64 proposalDuration,
        uint256 minProposerVotingPower
    );

    /// @notice Initializes the component to be used by inheriting contracts.
    /// @dev This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822).
    /// @param _dao The IDAO interface of the associated DAO.
    /// @param _votingSettings The voting settings.
    /// @param _targetConfig Configuration for the execution target, specifying the target address and operation type
    ///     (either `Call` or `DelegateCall`). Defined by `TargetConfig` in the `IPlugin` interface,
    ///     part of the `osx-commons-contracts` package, added in build 3.
    /// @param _pluginMetadata The plugin specific information encoded in bytes.
    ///     This can also be an ipfs cid encoded in bytes.
    // solhint-disable-next-line func-name-mixedcase
    function __MajorityVotingBase_init(
        IDAO _dao,
        VotingSettings calldata _votingSettings,
        TargetConfig calldata _targetConfig,
        bytes calldata _pluginMetadata
    ) internal onlyInitializing {
        if (address(_dao) == address(0)) revert EmptyDAOAddress();

        __PluginUUPSUpgradeable_init(_dao);
        _updateVotingSettings(_votingSettings);
        _setTargetConfig(_targetConfig);
        _setMetadata(_pluginMetadata);
    }

    /// @notice Checks if this or the parent contract supports an interface by its ID.
    /// @param _interfaceId The ID of the interface.
    /// @return Returns `true` if the interface is supported.
    function supportsInterface(bytes4 _interfaceId)
        public
        view
        virtual
        override(ERC165Upgradeable, MetadataExtensionUpgradeable, PluginUUPSUpgradeable, ProposalUpgradeable)
        returns (bool)
    {
        return _interfaceId == MAJORITY_VOTING_BASE_INTERFACE_ID || _interfaceId == type(IMajorityVoting).interfaceId
            || super.supportsInterface(_interfaceId);
    }

    /// @inheritdoc IProposal
    /// @dev Requires the `EXECUTE_PROPOSAL_PERMISSION_ID` permission.
    function execute(uint256 _proposalId)
        public
        virtual
        override(IMajorityVoting, IProposal)
        auth(EXECUTE_PROPOSAL_PERMISSION_ID)
    {
        if (!_canExecute(_proposalId)) {
            revert ProposalExecutionForbidden(_proposalId);
        }

        _execute(_proposalId);
    }

    /// @inheritdoc IMajorityVoting
    function getVote(uint256 _proposalId, address _voter) public view virtual returns (VoteEntry memory) {
        return (proposals[_proposalId].votes[_voter]);
    }

    /// @inheritdoc IMajorityVoting
    /// @dev Reverts if the proposal with the given `_proposalId` does not exist.
    function canExecute(uint256 _proposalId) public view virtual override(IMajorityVoting, IProposal) returns (bool) {
        if (!_proposalExists(_proposalId)) {
            revert NonexistentProposal(_proposalId);
        }

        return _canExecute(_proposalId);
    }

    /// @inheritdoc IProposal
    /// @dev Reverts if the proposal with the given `_proposalId` does not exist.
    function hasSucceeded(uint256 _proposalId) public view virtual returns (bool) {
        if (!_proposalExists(_proposalId)) {
            revert NonexistentProposal(_proposalId);
        }

        return _hasSucceeded(_proposalId);
    }

    /// @inheritdoc IMajorityVoting
    function isSupportThresholdReached(uint256 _proposalId) public view virtual returns (bool) {
        Proposal storage proposal_ = proposals[_proposalId];

        // The code below implements the formula of the support criterion explained in the top of this file.
        // `(1 - supportThresholdRatio) * N_yes > supportThresholdRatio *  N_no`
        return (RATIO_BASE - proposal_.parameters.supportThresholdRatio) * proposal_.tally.yes
            > proposal_.parameters.supportThresholdRatio * proposal_.tally.no;
    }

    /// @inheritdoc IMajorityVoting
    function isMinVotingPowerReached(uint256 _proposalId) public view virtual returns (bool) {
        Proposal storage proposal_ = proposals[_proposalId];

        /// @dev Multiplying both sides by RATIO_BASE, instead of dividing and losing precision

        uint256 _minVotingPowerUpscaled = currentTokenSupply() * proposal_.parameters.minParticipationRatio;

        // The code below implements the formula of the participation criterion explained in the top of this file.
        // `N_yes + N_no + N_abstain >= minVotingPower = minParticipationRatio * N_total`
        // `RATIO_BASE * (N_yes + N_no + N_abstain) >= minVotingPowerUpscaled = (minParticipationRatio * N_total) * RATIO_BASE`
        return
            RATIO_BASE * (proposal_.tally.yes + proposal_.tally.no + proposal_.tally.abstain) >= _minVotingPowerUpscaled;
    }

    /// @inheritdoc IMajorityVoting
    function isMinApprovalReached(uint256 _proposalId) public view virtual returns (bool) {
        uint256 _minApprovalPower = currentTokenSupply() * proposals[_proposalId].parameters.minApprovalRatio;
        return RATIO_BASE * proposals[_proposalId].tally.yes >= _minApprovalPower;
    }

    /// @inheritdoc IMajorityVoting
    function supportThresholdRatio() public view virtual returns (uint32) {
        return votingSettings.supportThresholdRatio;
    }

    /// @inheritdoc IMajorityVoting
    function minParticipationRatio() public view virtual returns (uint32) {
        return votingSettings.minParticipationRatio;
    }

    /// @notice Returns the proposal duration parameter stored in the voting settings.
    /// @return The proposal duration in seconds.
    function proposalDuration() public view virtual returns (uint64) {
        return votingSettings.proposalDuration;
    }

    /// @notice Returns the minimum voting power required to create a proposal stored in the voting settings.
    /// @return The minimum voting power required to create a proposal.
    function minProposerVotingPower() public view virtual returns (uint256) {
        return votingSettings.minProposerVotingPower;
    }

    /// @inheritdoc IMajorityVoting
    function minApprovalRatio() public view virtual returns (uint256) {
        return votingSettings.minApprovalRatio;
    }

    /// @notice Returns the vote mode stored in the voting settings.
    /// @return The vote mode parameter.
    function votingMode() public view virtual returns (VotingMode) {
        return votingSettings.votingMode;
    }

    /// @notice Returns the current voting settings.
    /// @return A struct containing the current plugin settings.
    function getVotingSettings() public view virtual returns (VotingSettings memory) {
        return votingSettings;
    }

    /// @notice Returns the current token supply.
    ///         NOTE: It includes any non circulating supply that might be vesting, locked or undistributed.
    /// @return The total token supply.
    function currentTokenSupply() public view virtual returns (uint256);

    /// @notice Returns all information for a proposal by its ID.
    /// @param _proposalId The ID of the proposal.
    /// @return open Whether the proposal is open or not.
    /// @return executed Whether the proposal is executed or not.
    /// @return parameters The parameters of the proposal.
    /// @return tally The current tally of the proposal.
    /// @return actions The actions to be executed to the `target` contract address.
    /// @return allowFailureMap The bit map representations of which actions are allowed to revert so tx still succeeds.
    /// @return targetConfig Execution configuration, applied to the proposal when it was created. Added in build 3.
    function getProposal(uint256 _proposalId)
        public
        view
        virtual
        returns (
            bool open,
            bool executed,
            ProposalParameters memory parameters,
            Tally memory tally,
            Action[] memory actions,
            uint256 allowFailureMap,
            TargetConfig memory targetConfig
        )
    {
        Proposal storage proposal_ = proposals[_proposalId];

        open = _isProposalOpen(proposal_);
        executed = proposal_.executed;
        parameters = proposal_.parameters;
        tally = proposal_.tally;
        actions = proposal_.actions;
        allowFailureMap = proposal_.allowFailureMap;
        targetConfig = proposal_.targetConfig;
    }

    /// @notice Updates the voting settings.
    /// @dev Requires the `UPDATE_SETTINGS_PERMISSION_ID` permission.
    /// @param _votingSettings The new voting settings.
    function updateVotingSettings(VotingSettings calldata _votingSettings)
        external
        virtual
        auth(UPDATE_SETTINGS_PERMISSION_ID)
    {
        _updateVotingSettings(_votingSettings);
    }

    /// @notice Internal function to execute a proposal. It assumes the queried proposal exists.
    /// @param _proposalId The ID of the proposal.
    function _execute(uint256 _proposalId) internal virtual {
        Proposal storage proposal_ = proposals[_proposalId];

        proposal_.executed = true;

        _execute(
            proposal_.targetConfig.target,
            bytes32(_proposalId),
            proposal_.actions,
            proposal_.allowFailureMap,
            proposal_.targetConfig.operation
        );

        emit ProposalExecuted(_proposalId);
    }

    /// @notice An internal function that checks if the proposal succeeded or not.
    /// @param _proposalId The ID of the proposal.
    /// @return Returns `true` if the proposal succeeded depending on the thresholds and voting modes.
    function _hasSucceeded(uint256 _proposalId) internal view virtual returns (bool) {
        Proposal storage proposal_ = proposals[_proposalId];

        if (!_isProposalEnded(proposal_)) {
            // Success cannot be determined until the voting period ends.
            return false;
        } else if (!isSupportThresholdReached(_proposalId)) {
            return false;
        } else if (!isMinVotingPowerReached(_proposalId)) {
            return false;
        } else if (!isMinApprovalReached(_proposalId)) {
            return false;
        }

        return true;
    }

    /// @notice Internal function to check if a proposal can be executed. It assumes the queried proposal exists.
    /// @dev Threshold and minimal values are compared with `>` and `>=` comparators, respectively.
    /// @param _proposalId The ID of the proposal.
    /// @return True if the proposal can be executed, false otherwise.
    function _canExecute(uint256 _proposalId) internal view virtual returns (bool) {
        Proposal storage proposal_ = proposals[_proposalId];

        // Verify that the vote has not been executed already.
        if (proposal_.executed) {
            return false;
        } else if (!_hasSucceeded(_proposalId)) {
            return false;
        }

        return true;
    }

    /// @notice Internal function to check if a proposal is still open.
    /// @param proposal_ The proposal struct.
    /// @return True if the proposal is open, false otherwise.
    function _isProposalOpen(Proposal storage proposal_) internal view virtual returns (bool) {
        uint64 currentTime = block.timestamp.toUint64();

        return proposal_.parameters.startDate <= currentTime && currentTime < proposal_.parameters.endDate
            && !proposal_.executed;
    }

    /// @notice Internal function to check if a proposal ended.
    /// @param proposal_ The proposal struct.
    /// @return True if the proposal is executed or past the endDate, false otherwise. False if it doesn't exist.
    function _isProposalEnded(Proposal storage proposal_) internal view virtual returns (bool) {
        if (proposal_.parameters.endDate == 0) return false;

        uint64 currentTime = block.timestamp.toUint64();
        return currentTime >= proposal_.parameters.endDate || proposal_.executed;
    }

    /// @notice Internal function to update the plugin-wide proposal settings.
    /// @param _votingSettings The voting settings to be validated and updated.
    function _updateVotingSettings(VotingSettings calldata _votingSettings) internal virtual {
        // Require the support threshold value to be in the interval [0, 10^6-1],
        // because `>` comparison is used in the support criterion and >100% could never be reached.
        if (_votingSettings.supportThresholdRatio > RATIO_BASE - 1) {
            revert RatioOutOfBounds({limit: RATIO_BASE - 1, actual: _votingSettings.supportThresholdRatio});
        }
        // Require the minimum participation value to be in the interval [0, 10^6],
        // because `>=` comparison is used in the participation criterion.
        else if (_votingSettings.minParticipationRatio > RATIO_BASE) {
            revert RatioOutOfBounds({limit: RATIO_BASE, actual: _votingSettings.minParticipationRatio});
        } else if (_votingSettings.proposalDuration < 60 minutes) {
            revert ProposalDurationOutOfBounds({limit: 60 minutes, actual: _votingSettings.proposalDuration});
        } else if (_votingSettings.proposalDuration > 31 days) {
            revert ProposalDurationOutOfBounds({limit: 31 days, actual: _votingSettings.proposalDuration});
        }
        // Require the minimum approval value to be in the interval [0, 10^6],
        // because `>=` comparison is used in the participation criterion.
        else if (_votingSettings.minApprovalRatio > RATIO_BASE) {
            revert RatioOutOfBounds({limit: RATIO_BASE, actual: _votingSettings.minApprovalRatio});
        }

        votingSettings = _votingSettings;

        emit VotingSettingsUpdated({
            votingMode: _votingSettings.votingMode,
            supportThresholdRatio: _votingSettings.supportThresholdRatio,
            minParticipationRatio: _votingSettings.minParticipationRatio,
            proposalDuration: _votingSettings.proposalDuration,
            minProposerVotingPower: _votingSettings.minProposerVotingPower,
            minApprovalRatio: _votingSettings.minApprovalRatio
        });
    }

    /// @notice Checks if proposal exists or not.
    /// @param _proposalId The ID of the proposal.
    /// @return Returns `true` if proposal exists, otherwise false.
    function _proposalExists(uint256 _proposalId) internal view returns (bool) {
        return proposals[_proposalId].parameters.startDate != 0;
    }

    /// @notice Validates and returns the proposal dates.
    /// @param _start The start date of the proposal.
    ///     If 0, the current timestamp is used and the vote starts immediately.
    /// @return startDate The validated start date of the proposal.
    /// @return endDate The end date of the proposal.
    function _computeProposalDates(uint64 _start) internal view virtual returns (uint64 startDate, uint64 endDate) {
        uint64 currentTimestamp = block.timestamp.toUint64();

        if (_start == 0) {
            startDate = currentTimestamp;
        } else {
            startDate = _start;

            if (startDate < currentTimestamp) {
                revert DateOutOfBounds({limit: currentTimestamp, actual: startDate});
            }
        }

        // Since `proposalDuration` is limited to 1 month,
        // `startDate + proposalDuration` can only overflow if the `startDate` is after `type(uint64).max - proposalDuration`.
        // In this case, the proposal creation will revert and another date can be picked.
        endDate = startDate + votingSettings.proposalDuration;
    }

    /// @notice This empty reserved space is put in place to allow future versions to add
    /// new variables without shifting down storage in the inheritance chain
    /// (see [OpenZeppelin's guide about storage gaps]
    /// (https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
    uint256[47] private __gap;
}

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.28;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ILockManager} from "./ILockManager.sol";

/// @title ILockToGovernBase
/// @author Aragon X 2024-2025
interface ILockToGovernBase {
    /// @notice Returns the address of the manager contract, which holds the locked balances and the allocated vote balances.
    /// @return The address of the LockManager contract associated with the plugin.
    function lockManager() external view returns (ILockManager);

    /// @notice Returns the address of the token contract used to determine the voting power.
    /// @return The address of the token used for voting.
    function token() external view returns (IERC20);

    /// @notice Returns whether the account has voted for the proposal.
    /// @param proposalId The ID of the proposal.
    /// @param voter The account address to be checked.
    /// @return The amount of balance that has been allocated to the proposal by the given account.
    function usedVotingPower(uint256 proposalId, address voter) external view returns (uint256);

    /// @notice Returns the minimum voting power required to create a proposal stored in the voting settings.
    /// @return The minimum voting power required to create a proposal.
    function minProposerVotingPower() external view returns (uint256);

    /// @notice Returns wether a proposal is open for submitting votes or not.
    /// @param _proposalId The ID of the proposal.
    /// @return True if the proposal is open, false if it hasn't started yet or if it has been already settled.
    function isProposalOpen(uint256 _proposalId) external view returns (bool);

    /// @notice Returns wether a proposal has ended or not.
    /// @param _proposalId The ID of the proposal.
    /// @return True if the proposal is executed or past the endDate, false otherwise. False if it doesn't exist.
    function isProposalEnded(uint256 _proposalId) external view returns (bool);
}

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.28;

/// @title IMajorityVoting
/// @author Aragon X - 2022-2024
/// @notice The interface of majority voting plugin.
/// @custom:security-contact [email protected]
interface IMajorityVoting {
    /// @notice Vote options that a voter can chose from.
    /// @param None The default option state of a voter indicating the absence from the vote.
    ///     This option neither influences support nor participation.
    /// @param Abstain This option does not influence the support but counts towards participation.
    /// @param Yes This option increases the support and counts towards participation.
    /// @param No This option decreases the support and counts towards participation.
    enum VoteOption {
        None,
        Abstain,
        Yes,
        No
    }

    /// @notice Emitted when a vote is cast by a voter.
    /// @param proposalId The ID of the proposal.
    /// @param voter The voter casting the vote.
    /// @param voteOption The casted vote option.
    /// @param votingPower The voting power behind this vote.
    event VoteCast(uint256 indexed proposalId, address indexed voter, VoteOption voteOption, uint256 votingPower);

    /// @notice Holds the state of an account's vote
    /// @param voteOption 1 -> abstain, 2 -> yes, 3 -> no
    /// @param votingPower How many tokens the account has allocated to `voteOption`
    struct VoteEntry {
        VoteOption voteOption;
        uint256 votingPower;
    }

    /// @notice Returns the support threshold parameter stored in the voting settings.
    /// @return The support threshold parameter.
    function supportThresholdRatio() external view returns (uint32);

    /// @notice Returns the minimum participation parameter stored in the voting settings.
    /// @return The minimum participation parameter.
    function minParticipationRatio() external view returns (uint32);

    /// @notice Returns the configured minimum approval ratio.
    /// @return The minimal approval ratio.
    function minApprovalRatio() external view returns (uint256);

    /// @notice Checks if the support value defined as:
    ///     $$\texttt{support} = \frac{N_\text{yes}}{N_\text{yes}+N_\text{no}}$$
    ///     for a proposal is greater than the support threshold.
    /// @param _proposalId The ID of the proposal.
    /// @return Returns `true` if the  support is greater than the support threshold and `false` otherwise.
    function isSupportThresholdReached(uint256 _proposalId) external view returns (bool);

    /// @notice Checks if the participation value defined as:
    ///     $$\texttt{participation} = \frac{N_\text{yes}+N_\text{no}+N_\text{abstain}}{N_\text{total}}$$
    ///     for a proposal is greater or equal than the minimum participation value.
    /// @param _proposalId The ID of the proposal.
    /// @return Returns `true` if the participation is greater or equal than the minimum participation,
    ///     and `false` otherwise.
    function isMinVotingPowerReached(uint256 _proposalId) external view returns (bool);

    /// @notice Checks if the min approval value defined as:
    ///     $$\texttt{minApprovalRatio} = \frac{N_\text{yes}}{N_\text{total}}$$
    ///     for a proposal is greater or equal than the minimum approval value.
    /// @param _proposalId The ID of the proposal.
    /// @return Returns `true` if the approvals is greater or equal than the minimum approval and `false` otherwise.
    function isMinApprovalReached(uint256 _proposalId) external view returns (bool);

    /// @notice Checks if a proposal can be executed.
    /// @param _proposalId The ID of the proposal to be checked.
    /// @return True if the proposal can be executed, false otherwise.
    function canExecute(uint256 _proposalId) external view returns (bool);

    /// @notice Executes a proposal.
    /// @param _proposalId The ID of the proposal to be executed.
    function execute(uint256 _proposalId) external;

    /// @notice Returns whether the account has voted for the proposal.
    /// @dev May return `none` if the `_proposalId` does not exist,
    ///      or the `_account` does not have voting power.
    /// @param _proposalId The ID of the proposal.
    /// @param _account The account address to be checked.
    /// @return The vote option cast by a voter for a certain proposal.
    function getVote(uint256 _proposalId, address _account) external view returns (VoteEntry memory);
}

// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

/// @title IMembership
/// @author Aragon X - 2022-2023
/// @notice An interface to be implemented by DAO plugins that define membership.
/// @custom:security-contact [email protected]
interface IMembership {
    /// @notice Emitted when members are added to the DAO plugin.
    /// @param members The list of new members being added.
    event MembersAdded(address[] members);

    /// @notice Emitted when members are removed from the DAO plugin.
    /// @param members The list of existing members being removed.
    event MembersRemoved(address[] members);

    /// @notice Emitted to announce the membership being defined by a contract.
    /// @param definingContract The contract defining the membership.
    event MembershipContractAnnounced(address indexed definingContract);

    /// @notice Checks if an account is a member of the DAO.
    /// @param _account The address of the account to be checked.
    /// @return Whether the account is a member or not.
    /// @dev This function must be implemented in the plugin contract that introduces the members to the DAO.
    function isMember(address _account) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @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 Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _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 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _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() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @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 {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

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

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

// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {CountersUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";

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

/// @title ProposalUpgradeable
/// @author Aragon X - 2022-2024
/// @notice An abstract contract containing the traits and internal functionality to create and execute proposals
///         that can be inherited by upgradeable DAO plugins.
/// @custom:security-contact [email protected]
abstract contract ProposalUpgradeable is IProposal, ERC165Upgradeable {
    using CountersUpgradeable for CountersUpgradeable.Counter;

    error FunctionDeprecated();

    /// @notice The incremental ID for proposals and executions.
    CountersUpgradeable.Counter private proposalCounter;

    /// @inheritdoc IProposal
    function proposalCount() public view virtual override returns (uint256) {
        revert FunctionDeprecated();
    }

    /// @notice Creates a proposal Id.
    /// @dev Uses block number and chain id to ensure more probability of uniqueness.
    /// @param _salt The extra salt to help with uniqueness.
    /// @return The id of the proposal.
    function _createProposalId(bytes32 _salt) internal view virtual returns (uint256) {
        return uint256(keccak256(abi.encode(block.chainid, block.number, address(this), _salt)));
    }

    /// @notice Checks if this or the parent contract supports an interface by its ID.
    /// @dev In addition to the current interfaceId, also support previous version of the interfaceId
    ///      that did not include the following functions:
    ///      `createProposal`, `hasSucceeded`, `execute`, `canExecute`, `customProposalParamsABI`.
    /// @param _interfaceId The ID of the interface.
    /// @return Returns `true` if the interface is supported.
    function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {
        return
            _interfaceId ==
            type(IProposal).interfaceId ^
                IProposal.createProposal.selector ^
                IProposal.hasSucceeded.selector ^
                IProposal.execute.selector ^
                IProposal.canExecute.selector ^
                IProposal.customProposalParamsABI.selector ||
            _interfaceId == type(IProposal).interfaceId ||
            super.supportsInterface(_interfaceId);
    }

    /// @notice This empty reserved space is put in place to allow future versions to add new variables
    ///         without shifting down storage in the inheritance chain
    ///         (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
    uint256[49] private __gap;
}

File 18 of 35 : Ratio.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

// The base value to encode real-valued ratios on the interval `[0,1]` as integers on the interval `[0, 10**6]`.
uint256 constant RATIO_BASE = 10 ** 6;

/// @notice Thrown if a ratio value exceeds the maximal value of `10**6`.
/// @param limit The maximal value.
/// @param actual The actual value.
error RatioOutOfBounds(uint256 limit, uint256 actual);

/// @notice Applies a ratio to a value and ceils the remainder.
/// @param _value The value to which the ratio is applied.
/// @param _ratio The ratio that must be in the interval `[0, 10**6]`.
/// @return result The resulting value.
/// @custom:security-contact [email protected]
function _applyRatioCeiled(uint256 _value, uint256 _ratio) pure returns (uint256 result) {
    if (_ratio > RATIO_BASE) {
        revert RatioOutOfBounds({limit: RATIO_BASE, actual: _ratio});
    }

    _value = _value * _ratio;
    uint256 remainder = _value % RATIO_BASE;
    result = _value / RATIO_BASE;

    // Check if ceiling is needed
    if (remainder != 0) {
        ++result;
    }
}

// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {IERC1822ProxiableUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol";
import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import {ERC165CheckerUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol";

import {IProtocolVersion} from "@aragon/osx-commons-contracts/src/utils/versioning/IProtocolVersion.sol";
import {ProtocolVersion} from "@aragon/osx-commons-contracts/src/utils/versioning/ProtocolVersion.sol";
import {DaoAuthorizableUpgradeable} from "@aragon/osx-commons-contracts/src/permission/auth/DaoAuthorizableUpgradeable.sol";
import {IPlugin} from "@aragon/osx-commons-contracts/src/plugin/IPlugin.sol";
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {IExecutor, Action} from "@aragon/osx-commons-contracts/src/executors/IExecutor.sol";

/// @title PluginUUPSUpgradeable
/// @author Aragon X - 2022-2024
/// @notice An abstract, upgradeable contract to inherit from when creating a plugin being deployed via the UUPS pattern (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
/// @custom:security-contact [email protected]
abstract contract PluginUUPSUpgradeable is
    IPlugin,
    ERC165Upgradeable,
    UUPSUpgradeable,
    DaoAuthorizableUpgradeable,
    ProtocolVersion
{
    using ERC165CheckerUpgradeable for address;

    // NOTE: When adding new state variables to the contract, the size of `_gap` has to be adapted below as well.

    /// @notice Stores the current target configuration, defining the target contract and operation type for a plugin.
    TargetConfig private currentTargetConfig;

    /// @notice Thrown when target is of type 'IDAO', but operation is `delegateCall`.
    /// @param targetConfig The target config to update it to.
    error InvalidTargetConfig(TargetConfig targetConfig);

    /// @notice Thrown when `delegatecall` fails.
    error DelegateCallFailed();

    /// @notice Thrown when initialize is called after it has already been executed.
    error AlreadyInitialized();

    /// @notice Emitted each time the TargetConfig is set.
    event TargetSet(TargetConfig newTargetConfig);

    /// @notice The ID of the permission required to call the `setTargetConfig` function.
    bytes32 public constant SET_TARGET_CONFIG_PERMISSION_ID =
        keccak256("SET_TARGET_CONFIG_PERMISSION");

    /// @notice The ID of the permission required to call the `_authorizeUpgrade` function.
    bytes32 public constant UPGRADE_PLUGIN_PERMISSION_ID = keccak256("UPGRADE_PLUGIN_PERMISSION");

    /// @notice Disables the initializers on the implementation contract to prevent it from being left uninitialized.
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    /// @notice This ensures that the initialize function cannot be called during the upgrade process.
    modifier onlyCallAtInitialization() {
        if (_getInitializedVersion() != 0) {
            revert AlreadyInitialized();
        }

        _;
    }

    /// @inheritdoc IPlugin
    function pluginType() public pure override returns (PluginType) {
        return PluginType.UUPS;
    }

    /// @notice Returns the currently set target contract.
    /// @return TargetConfig The currently set target.
    function getCurrentTargetConfig() public view virtual returns (TargetConfig memory) {
        return currentTargetConfig;
    }

    /// @notice A convenient function to get current target config only if its target is not address(0), otherwise dao().
    /// @return TargetConfig The current target config if its target is not address(0), otherwise returns dao()."
    function getTargetConfig() public view virtual returns (TargetConfig memory) {
        TargetConfig memory targetConfig = currentTargetConfig;

        if (targetConfig.target == address(0)) {
            targetConfig = TargetConfig({target: address(dao()), operation: Operation.Call});
        }

        return targetConfig;
    }

    /// @notice Initializes the plugin by storing the associated DAO.
    /// @param _dao The DAO contract.
    // solhint-disable-next-line func-name-mixedcase
    function __PluginUUPSUpgradeable_init(IDAO _dao) internal virtual onlyInitializing {
        __DaoAuthorizableUpgradeable_init(_dao);
    }

    /// @dev Sets the target to a new target (`newTarget`).
    ///      The caller must have the `SET_TARGET_CONFIG_PERMISSION_ID` permission.
    /// @param _targetConfig The target Config containing the address and operation type.
    function setTargetConfig(
        TargetConfig calldata _targetConfig
    ) public virtual auth(SET_TARGET_CONFIG_PERMISSION_ID) {
        _setTargetConfig(_targetConfig);
    }

    /// @notice Checks if an interface is supported by this or its parent contract.
    /// @param _interfaceId The ID of the interface.
    /// @return Returns `true` if the interface is supported.
    function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {
        return
            _interfaceId == type(IPlugin).interfaceId ||
            _interfaceId == type(IProtocolVersion).interfaceId ||
            _interfaceId == type(IERC1822ProxiableUpgradeable).interfaceId ||
            _interfaceId ==
            this.setTargetConfig.selector ^
                this.getTargetConfig.selector ^
                this.getCurrentTargetConfig.selector ||
            super.supportsInterface(_interfaceId);
    }

    /// @notice Returns the address of the implementation contract in the [proxy storage slot](https://eips.ethereum.org/EIPS/eip-1967) slot the [UUPS proxy](https://eips.ethereum.org/EIPS/eip-1822) is pointing to.
    /// @return The address of the implementation contract.
    function implementation() public view returns (address) {
        return _getImplementation();
    }

    /// @notice Sets the target to a new target (`newTarget`).
    /// @param _targetConfig The target Config containing the address and operation type.
    function _setTargetConfig(TargetConfig memory _targetConfig) internal virtual {
        // safety check to avoid setting dao as `target` with `delegatecall` operation
        // as this would not work and cause the plugin to be bricked.
        if (
            _targetConfig.target.supportsInterface(type(IDAO).interfaceId) &&
            _targetConfig.operation == Operation.DelegateCall
        ) {
            revert InvalidTargetConfig(_targetConfig);
        }

        currentTargetConfig = _targetConfig;

        emit TargetSet(_targetConfig);
    }

    /// @notice Forwards the actions to the currently set `target` for the execution.
    /// @dev If target is not set, passes actions to the dao.
    /// @param _callId Identifier for this execution.
    /// @param _actions actions that will be eventually called.
    /// @param _allowFailureMap Bitmap-encoded number.
    /// @return execResults address of the implementation contract.
    /// @return failureMap address of the implementation contract.
    function _execute(
        bytes32 _callId,
        Action[] memory _actions,
        uint256 _allowFailureMap
    ) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
        TargetConfig memory targetConfig = getTargetConfig();

        return
            _execute(
                targetConfig.target,
                _callId,
                _actions,
                _allowFailureMap,
                targetConfig.operation
            );
    }

    /// @notice Forwards the actions to the `target` for the execution.
    /// @param _target The address of the target contract.
    /// @param _callId Identifier for this execution.
    /// @param _actions actions that will be eventually called.
    /// @param _allowFailureMap A bitmap allowing the execution to succeed, even if individual actions might revert.
    ///     If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts.
    ///     A failure map value of 0 requires every action to not revert.
    /// @param _op The type of operation (`Call` or `DelegateCall`) to be used for the execution.
    /// @return execResults address of the implementation contract.
    /// @return failureMap address of the implementation contract.
    function _execute(
        address _target,
        bytes32 _callId,
        Action[] memory _actions,
        uint256 _allowFailureMap,
        Operation _op
    ) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
        if (_op == Operation.DelegateCall) {
            bool success;
            bytes memory data;

            // solhint-disable-next-line avoid-low-level-calls
            (success, data) = _target.delegatecall(
                abi.encodeCall(IExecutor.execute, (_callId, _actions, _allowFailureMap))
            );

            if (!success) {
                if (data.length > 0) {
                    // solhint-disable-next-line no-inline-assembly
                    assembly {
                        let returndata_size := mload(data)
                        revert(add(32, data), returndata_size)
                    }
                } else {
                    revert DelegateCallFailed();
                }
            }
            (execResults, failureMap) = abi.decode(data, (bytes[], uint256));
        } else {
            (execResults, failureMap) = IExecutor(_target).execute(
                _callId,
                _actions,
                _allowFailureMap
            );
        }
    }

    /// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
    /// @dev The caller must have the `UPGRADE_PLUGIN_PERMISSION_ID` permission.
    function _authorizeUpgrade(
        address
    )
        internal
        virtual
        override
        auth(UPGRADE_PLUGIN_PERMISSION_ID)
    // solhint-disable-next-line no-empty-blocks
    {

    }

    /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
    uint256[49] private __gap;
}

// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";

import {DaoAuthorizableUpgradeable} from "../../permission/auth/DaoAuthorizableUpgradeable.sol";

/// @title MetadataExtensionUpgradeable
/// @author Aragon X - 2024
/// @notice An abstract, upgradeable contract for managing and retrieving metadata associated with a plugin.
/// @dev Due to the requirements that already existing upgradeable plugins need to start inheritting from this,
///      we're required to use hardcoded/specific slots for storage instead of sequential slots with gaps.
/// @custom:security-contact [email protected]
abstract contract MetadataExtensionUpgradeable is ERC165Upgradeable, DaoAuthorizableUpgradeable {
    /// @notice The ID of the permission required to call the `setMetadata` function.
    bytes32 public constant SET_METADATA_PERMISSION_ID = keccak256("SET_METADATA_PERMISSION");

    // keccak256(abi.encode(uint256(keccak256("osx-commons.storage.MetadataExtension")) - 1)) & ~bytes32(uint256(0xff))
    // solhint-disable-next-line  const-name-snakecase
    bytes32 private constant MetadataExtensionStorageLocation =
        0x47ff9796f72d439c6e5c30a24b9fad985a00c85a9f2258074c400a94f8746b00;

    /// @notice Emitted when metadata is updated.
    event MetadataSet(bytes metadata);

    struct MetadataExtensionStorage {
        bytes metadata;
    }

    function _getMetadataExtensionStorage()
        private
        pure
        returns (MetadataExtensionStorage storage $)
    {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            $.slot := MetadataExtensionStorageLocation
        }
    }

    /// @notice Checks if this or the parent contract supports an interface by its ID.
    /// @param _interfaceId The ID of the interface.
    /// @return Returns `true` if the interface is supported.
    function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {
        return
            _interfaceId == this.setMetadata.selector ^ this.getMetadata.selector ||
            super.supportsInterface(_interfaceId);
    }

    /// @notice Allows to update only the metadata.
    /// @param _metadata The utf8 bytes of a content addressing cid that stores plugin's information.
    function setMetadata(bytes calldata _metadata) public virtual auth(SET_METADATA_PERMISSION_ID) {
        _setMetadata(_metadata);
    }

    /// @notice Returns the metadata currently applied.
    /// @return The The utf8 bytes of a content addressing cid.
    function getMetadata() public view returns (bytes memory) {
        MetadataExtensionStorage storage $ = _getMetadataExtensionStorage();
        return $.metadata;
    }

    /// @notice Internal function to update metadata.
    /// @param _metadata The utf8 bytes of a content addressing cid that stores contract's information.
    function _setMetadata(bytes memory _metadata) internal virtual {
        MetadataExtensionStorage storage $ = _getMetadataExtensionStorage();
        $.metadata = _metadata;

        emit MetadataSet(_metadata);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @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: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.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.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @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 ERC1967) 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 ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @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() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Implementation of the ERC1822 {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 override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeTo(address newImplementation) public virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @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, true);
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 25 of 35 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165CheckerUpgradeable {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface.
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            supportsERC165InterfaceUnchecked(account, type(IERC165Upgradeable).interfaceId) &&
            !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(
        address account,
        bytes4[] memory interfaceIds
    ) internal view returns (bool[] memory) {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     *
     * Some precompiled contracts will falsely indicate support for a given interface, so caution
     * should be exercised when using this function.
     *
     * Interface identification is specified in ERC-165.
     */
    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
        // prepare call
        bytes memory encodedParams = abi.encodeWithSelector(IERC165Upgradeable.supportsInterface.selector, interfaceId);

        // perform static call
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly {
            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0x00)
        }

        return success && returnSize >= 0x20 && returnValue > 0;
    }
}

File 27 of 35 : IProtocolVersion.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

/// @title IProtocolVersion
/// @author Aragon X - 2022-2023
/// @notice An interface defining the semantic Aragon OSx protocol version number.
/// @custom:security-contact [email protected]
interface IProtocolVersion {
    /// @notice Returns the semantic Aragon OSx protocol version number that the implementing contract is associated with.
    /// @return _version Returns the semantic Aragon OSx protocol version number.
    /// @dev This version number is not to be confused with the `release` and `build` numbers found in the `Version.Tag` struct inside the `PluginRepo` contract being used to version plugin setup and associated plugin implementation contracts.
    function protocolVersion() external view returns (uint8[3] memory _version);
}

File 28 of 35 : ProtocolVersion.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

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

/// @title ProtocolVersion
/// @author Aragon X - 2023
/// @notice An abstract, stateless, non-upgradeable contract providing the current Aragon OSx protocol version number.
/// @dev Do not add any new variables to this contract that would shift down storage in the inheritance chain.
/// @custom:security-contact [email protected]
abstract contract ProtocolVersion is IProtocolVersion {
    // IMPORTANT: Do not add any storage variable, see the above notice.

    /// @inheritdoc IProtocolVersion
    function protocolVersion() public pure returns (uint8[3] memory) {
        return [1, 4, 0];
    }
}

File 29 of 35 : DaoAuthorizableUpgradeable.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

import {IDAO} from "../../dao/IDAO.sol";
import {_auth} from "./auth.sol";

/// @title DaoAuthorizableUpgradeable
/// @author Aragon X - 2022-2023
/// @notice An abstract contract providing a meta-transaction compatible modifier for upgradeable or cloneable contracts to authorize function calls through an associated DAO.
/// @dev Make sure to call `__DaoAuthorizableUpgradeable_init` during initialization of the inheriting contract.
/// @custom:security-contact [email protected]
abstract contract DaoAuthorizableUpgradeable is ContextUpgradeable {
    /// @notice The associated DAO managing the permissions of inheriting contracts.
    IDAO private dao_;

    /// @notice Initializes the contract by setting the associated DAO.
    /// @param _dao The associated DAO address.
    // solhint-disable-next-line func-name-mixedcase
    function __DaoAuthorizableUpgradeable_init(IDAO _dao) internal onlyInitializing {
        dao_ = _dao;
    }

    /// @notice Returns the DAO contract.
    /// @return The DAO contract.
    function dao() public view returns (IDAO) {
        return dao_;
    }

    /// @notice A modifier to make functions on inheriting contracts authorized. Permissions to call the function are checked through the associated DAO's permission manager.
    /// @param _permissionId The permission identifier required to call the method this modifier is applied to.
    modifier auth(bytes32 _permissionId) {
        _auth(dao_, address(this), _msgSender(), _permissionId, _msgData());
        _;
    }

    /// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
    uint256[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/IERC1967Upgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import {Initializable} from "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

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

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;
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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 32 of 35 : auth.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {IDAO} from "../../dao/IDAO.sol";

/// @title DAO Authorization Utilities
/// @author Aragon X - 2022-2024
/// @notice Provides utility functions for verifying if a caller has specific permissions in an associated DAO.
/// @custom:security-contact [email protected]

/// @notice Thrown if a call is unauthorized in the associated DAO.
/// @param dao The associated DAO.
/// @param where The context in which the authorization reverted.
/// @param who The address (EOA or contract) missing the permission.
/// @param permissionId The permission identifier.
error DaoUnauthorized(address dao, address where, address who, bytes32 permissionId);

/// @notice A free function checking if a caller is granted permissions on a target contract via a permission identifier that redirects the approval to a `PermissionCondition` if this was specified in the setup.
/// @param _where The address of the target contract for which `who` receives permission.
/// @param _who The address (EOA or contract) owning the permission.
/// @param _permissionId The permission identifier.
/// @param _data The optional data passed to the `PermissionCondition` registered.
function _auth(
    IDAO _dao,
    address _where,
    address _who,
    bytes32 _permissionId,
    bytes calldata _data
) view {
    if (!_dao.hasPermission(_where, _who, _permissionId, _data))
        revert DaoUnauthorized({
            dao: address(_dao),
            where: _where,
            who: _who,
            permissionId: _permissionId
        });
}

File 33 of 35 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 34 of 35 : IERC1967Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 *
 * _Available since v4.8.3._
 */
interface IERC1967Upgradeable {
    /**
     * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@aragon/osx/=lib/osx/packages/contracts/",
    "@aragon/osx-commons-contracts/=lib/osx-commons/contracts/",
    "@ensdomains/ens-contracts/=lib/ens-contracts/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
    "ens-contracts/=lib/ens-contracts/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "osx-commons/=lib/osx-commons/",
    "osx/=lib/osx/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[{"internalType":"address","name":"dao","type":"address"},{"internalType":"address","name":"where","type":"address"},{"internalType":"address","name":"who","type":"address"},{"internalType":"bytes32","name":"permissionId","type":"bytes32"}],"name":"DaoUnauthorized","type":"error"},{"inputs":[{"internalType":"uint64","name":"limit","type":"uint64"},{"internalType":"uint64","name":"actual","type":"uint64"}],"name":"DateOutOfBounds","type":"error"},{"inputs":[],"name":"DelegateCallFailed","type":"error"},{"inputs":[],"name":"EmptyDAOAddress","type":"error"},{"inputs":[],"name":"FunctionDeprecated","type":"error"},{"inputs":[{"internalType":"uint256","name":"actionIdx","type":"uint256"},{"internalType":"address","name":"target","type":"address"}],"name":"InvalidActionTarget","type":"error"},{"inputs":[],"name":"InvalidTargetAddress","type":"error"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IPlugin.Operation","name":"operation","type":"uint8"}],"internalType":"struct IPlugin.TargetConfig","name":"targetConfig","type":"tuple"}],"name":"InvalidTargetConfig","type":"error"},{"inputs":[],"name":"LockManagerAlreadyDefined","type":"error"},{"inputs":[],"name":"NoVotingPower","type":"error"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"NonexistentProposal","type":"error"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"ProposalAlreadyExists","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ProposalCreationForbidden","type":"error"},{"inputs":[{"internalType":"uint64","name":"limit","type":"uint64"},{"internalType":"uint64","name":"actual","type":"uint64"}],"name":"ProposalDurationOutOfBounds","type":"error"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"ProposalExecutionForbidden","type":"error"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"RatioOutOfBounds","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"VoteCallForbidden","type":"error"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"VoteCastForbidden","type":"error"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"voter","type":"address"}],"name":"VoteRemovalForbidden","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"VoteRemovalUnauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract ILockManager","name":"lockManager","type":"address"}],"name":"LockManagerDefined","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"members","type":"address[]"}],"name":"MembersAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"members","type":"address[]"}],"name":"MembersRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"definingContract","type":"address"}],"name":"MembershipContractAnnounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"metadata","type":"bytes"}],"name":"MetadataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"uint64","name":"startDate","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"endDate","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"metadata","type":"bytes"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct Action[]","name":"actions","type":"tuple[]"},{"indexed":false,"internalType":"uint256","name":"allowFailureMap","type":"uint256"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IPlugin.Operation","name":"operation","type":"uint8"}],"indexed":false,"internalType":"struct IPlugin.TargetConfig","name":"newTargetConfig","type":"tuple"}],"name":"TargetSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"enum IMajorityVoting.VoteOption","name":"voteOption","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"votingPower","type":"uint256"}],"name":"VoteCast","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":true,"internalType":"address","name":"voter","type":"address"}],"name":"VoteCleared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum MajorityVotingBase.VotingMode","name":"votingMode","type":"uint8"},{"indexed":false,"internalType":"uint32","name":"supportThresholdRatio","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"minParticipationRatio","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"minApprovalRatio","type":"uint32"},{"indexed":false,"internalType":"uint64","name":"proposalDuration","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"minProposerVotingPower","type":"uint256"}],"name":"VotingSettingsUpdated","type":"event"},{"inputs":[],"name":"CREATE_PROPOSAL_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXECUTE_PROPOSAL_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCK_MANAGER_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SET_METADATA_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SET_TARGET_CONFIG_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATE_SETTINGS_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_PLUGIN_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"canExecute","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"enum IMajorityVoting.VoteOption","name":"_voteOption","type":"uint8"}],"name":"canVote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"},{"internalType":"address","name":"_voter","type":"address"}],"name":"clearVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_metadata","type":"bytes"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Action[]","name":"_actions","type":"tuple[]"},{"internalType":"uint64","name":"_startDate","type":"uint64"},{"internalType":"uint64","name":"_endDate","type":"uint64"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"createProposal","outputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentTokenSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"customProposalParamsABI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"contract IDAO","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentTargetConfig","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IPlugin.Operation","name":"operation","type":"uint8"}],"internalType":"struct IPlugin.TargetConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMetadata","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"getProposal","outputs":[{"internalType":"bool","name":"open","type":"bool"},{"internalType":"bool","name":"executed","type":"bool"},{"components":[{"internalType":"enum MajorityVotingBase.VotingMode","name":"votingMode","type":"uint8"},{"internalType":"uint32","name":"supportThresholdRatio","type":"uint32"},{"internalType":"uint64","name":"startDate","type":"uint64"},{"internalType":"uint64","name":"endDate","type":"uint64"},{"internalType":"uint256","name":"minParticipationRatio","type":"uint256"},{"internalType":"uint256","name":"minApprovalRatio","type":"uint256"}],"internalType":"struct MajorityVotingBase.ProposalParameters","name":"parameters","type":"tuple"},{"components":[{"internalType":"uint256","name":"abstain","type":"uint256"},{"internalType":"uint256","name":"yes","type":"uint256"},{"internalType":"uint256","name":"no","type":"uint256"}],"internalType":"struct MajorityVotingBase.Tally","name":"tally","type":"tuple"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct Action[]","name":"actions","type":"tuple[]"},{"internalType":"uint256","name":"allowFailureMap","type":"uint256"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IPlugin.Operation","name":"operation","type":"uint8"}],"internalType":"struct IPlugin.TargetConfig","name":"targetConfig","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTargetConfig","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IPlugin.Operation","name":"operation","type":"uint8"}],"internalType":"struct IPlugin.TargetConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"},{"internalType":"address","name":"_voter","type":"address"}],"name":"getVote","outputs":[{"components":[{"internalType":"enum IMajorityVoting.VoteOption","name":"voteOption","type":"uint8"},{"internalType":"uint256","name":"votingPower","type":"uint256"}],"internalType":"struct IMajorityVoting.VoteEntry","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVotingSettings","outputs":[{"components":[{"internalType":"enum MajorityVotingBase.VotingMode","name":"votingMode","type":"uint8"},{"internalType":"uint32","name":"supportThresholdRatio","type":"uint32"},{"internalType":"uint32","name":"minParticipationRatio","type":"uint32"},{"internalType":"uint32","name":"minApprovalRatio","type":"uint32"},{"internalType":"uint64","name":"proposalDuration","type":"uint64"},{"internalType":"uint256","name":"minProposerVotingPower","type":"uint256"}],"internalType":"struct MajorityVotingBase.VotingSettings","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"hasSucceeded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDAO","name":"_dao","type":"address"},{"internalType":"contract ILockManager","name":"_lockManager","type":"address"},{"components":[{"internalType":"enum MajorityVotingBase.VotingMode","name":"votingMode","type":"uint8"},{"internalType":"uint32","name":"supportThresholdRatio","type":"uint32"},{"internalType":"uint32","name":"minParticipationRatio","type":"uint32"},{"internalType":"uint32","name":"minApprovalRatio","type":"uint32"},{"internalType":"uint64","name":"proposalDuration","type":"uint64"},{"internalType":"uint256","name":"minProposerVotingPower","type":"uint256"}],"internalType":"struct MajorityVotingBase.VotingSettings","name":"_votingSettings","type":"tuple"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IPlugin.Operation","name":"operation","type":"uint8"}],"internalType":"struct IPlugin.TargetConfig","name":"_targetConfig","type":"tuple"},{"internalType":"bytes","name":"_pluginMetadata","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isMember","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"isMinApprovalReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"isMinVotingPowerReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"isProposalEnded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"isProposalOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"}],"name":"isSupportThresholdReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockManager","outputs":[{"internalType":"contract ILockManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minApprovalRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minParticipationRatio","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minProposerVotingPower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pluginType","outputs":[{"internalType":"enum IPlugin.PluginType","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"proposalCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposalDuration","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolVersion","outputs":[{"internalType":"uint8[3]","name":"","type":"uint8[3]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_metadata","type":"bytes"}],"name":"setMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"enum IPlugin.Operation","name":"operation","type":"uint8"}],"internalType":"struct IPlugin.TargetConfig","name":"_targetConfig","type":"tuple"}],"name":"setTargetConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supportThresholdRatio","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"enum MajorityVotingBase.VotingMode","name":"votingMode","type":"uint8"},{"internalType":"uint32","name":"supportThresholdRatio","type":"uint32"},{"internalType":"uint32","name":"minParticipationRatio","type":"uint32"},{"internalType":"uint32","name":"minApprovalRatio","type":"uint32"},{"internalType":"uint64","name":"proposalDuration","type":"uint64"},{"internalType":"uint256","name":"minProposerVotingPower","type":"uint256"}],"internalType":"struct MajorityVotingBase.VotingSettings","name":"_votingSettings","type":"tuple"}],"name":"updateVotingSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"},{"internalType":"address","name":"_voter","type":"address"}],"name":"usedVotingPower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"enum IMajorityVoting.VoteOption","name":"_voteOption","type":"uint8"},{"internalType":"uint256","name":"_newVotingPower","type":"uint256"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"votingMode","outputs":[{"internalType":"enum MajorityVotingBase.VotingMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]

60a060405230608052348015610013575f5ffd5b5061001c610021565b6100dd565b5f54610100900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff908116146100db575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051614a706101115f395f8181610dab01528181610deb015281816113d00152818161141001526114870152614a705ff3fe6080604052600436106102bf575f3560e01c8063b9835a171161016f578063d9779fbe116100d8578063eff759a811610092578063f68326431161006d578063f683264314610952578063f822de1d14610973578063fc0c546a146109a6578063fe0d94c1146109ba575f5ffd5b8063eff759a8146108d6578063f3dfd5591461091f578063f60046b21461093e575f5ffd5b8063d9779fbe14610829578063da35c6641461083d578063dd63c06f14610851578063e306bee714610865578063ea65ab8214610898578063ee57e36f146108b7575f5ffd5b8063c9c4bfca11610129578063c9c4bfca14610747578063cc4b00701461077a578063cc63604a14610799578063cf131149146107b8578063cfceb588146107d7578063cfd40b841461080a575f5ffd5b8063b9835a1714610668578063bb225da21461068a578063bc3f931f146106a9578063c218c132146106d5578063c7f758a8146106f4578063c98425ee14610726575f5ffd5b80633f8b32d91161022b5780635c60da1b116101e55780637a5b4f59116101c05780637a5b4f59146105e25780638cb75059146105f6578063a230c52414610629578063acca30a214610648575f5ffd5b80635c60da1b1461057c5780636ff44abd14610590578063780e19c1146105c3575f5ffd5b80633f8b32d9146104cc5780634162169f146104eb57806341de68301461051c578063483f50f8146105365780634f1ef2861461055557806352d1902d14610568575f5ffd5b80632ae9c6001161027c5780632ae9c600146103b65780632e747051146103d757806330109962146104085780633659cfe61461044057806336fa95891461045f5780633d3f4b1b1461047e575f5ffd5b806301ffc9a7146102c35780630e04be90146102f757806311ce24381461032357806317d1b404146103565780632098be151461037557806323d0718814610396575b5f5ffd5b3480156102ce575f5ffd5b506102e26102dd366004613a54565b6109d9565b60405190151581526020015b60405180910390f35b348015610302575f5ffd5b5061016054600160481b900463ffffffff165b6040519081526020016102ee565b34801561032e575f5ffd5b506103157f8c433a4cd6b51969eca37f974940894297b9fcf4b282a213fea5cd8f85289c9081565b348015610361575f5ffd5b506102e2610370366004613a9d565b610a1e565b348015610380575f5ffd5b5061039461038f366004613ad8565b610af9565b005b3480156103a1575f5ffd5b506101605460ff166040516102ee9190613b2a565b3480156103c1575f5ffd5b506103ca610d78565b6040516102ee9190613b3d565b3480156103e2575f5ffd5b5061016054610100900463ffffffff165b60405163ffffffff90911681526020016102ee565b348015610413575f5ffd5b5061016054600160681b90046001600160401b03166040516001600160401b0390911681526020016102ee565b34801561044b575f5ffd5b5061039461045a366004613b70565b610da1565b34801561046a575f5ffd5b506102e2610479366004613b8b565b610e68565b348015610489575f5ffd5b5060408051808201909152601981527f2875696e7432353620616c6c6f774661696c7572654d6170290000000000000060208201525b6040516102ee9190613bd0565b3480156104d7575f5ffd5b506103946104e6366004613bf8565b610ebb565b3480156104f6575f5ffd5b5060c9546001600160a01b03165b6040516001600160a01b0390911681526020016102ee565b348015610527575f5ffd5b505f6040516102ee9190613c12565b348015610541575f5ffd5b50610394610550366004613c26565b610f05565b610394610563366004613d4d565b6113c6565b348015610573575f5ffd5b5061031561147b565b348015610587575f5ffd5b5061050461152c565b34801561059b575f5ffd5b506103157f371f7eb46741163a91bb271e73a2a58ae7a0b6bc80c10a8c7e03ae2e4bc0e42581565b3480156105ce575f5ffd5b506102e26105dd366004613b8b565b61153a565b3480156105ed575f5ffd5b506104bf611558565b348015610601575f5ffd5b506103157f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f781565b348015610634575f5ffd5b506102e2610643366004613b70565b61160c565b348015610653575f5ffd5b5061019154610504906001600160a01b031681565b348015610673575f5ffd5b5061016054600160281b900463ffffffff166103f3565b348015610695575f5ffd5b506103946106a4366004613da9565b611726565b3480156106b4575f5ffd5b506106c86106c3366004613ad8565b6117d7565b6040516102ee9190613dd7565b3480156106e0575f5ffd5b506102e26106ef366004613b8b565b611855565b3480156106ff575f5ffd5b5061071361070e366004613b8b565b6118a0565b6040516102ee9796959493929190613ea1565b348015610731575f5ffd5b5061073a611b5b565b6040516102ee9190613f67565b348015610752575f5ffd5b506103157f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f581565b348015610785575f5ffd5b50610394610794366004613fb9565b611bc1565b3480156107a4575f5ffd5b506102e26107b3366004613b8b565b611d6d565b3480156107c3575f5ffd5b506102e26107d2366004613b8b565b611db8565b3480156107e2575f5ffd5b506103157ff281525e53675515a6ba7cc7bea8a81e649b3608423ee2d73be1752cea88788981565b348015610815575f5ffd5b506102e2610824366004613b8b565b611e19565b348015610834575f5ffd5b50610315611e7f565b348015610848575f5ffd5b50610315611f4a565b34801561085c575f5ffd5b5061073a611f64565b348015610870575f5ffd5b506103157f4707e94b25cfce1a7c363508fbb838c35864388ad77284b248282b9746982b9b81565b3480156108a3575f5ffd5b506103156108b2366004614083565b612011565b3480156108c2575f5ffd5b506103946108d136600461420e565b6124ad565b3480156108e1575f5ffd5b506103156108f0366004613ad8565b5f82815261015f602090815260408083206001600160a01b038516845260070190915290206001015492915050565b34801561092a575f5ffd5b506102e2610939366004613b8b565b612529565b348015610949575f5ffd5b50610315612540565b34801561095d575f5ffd5b5061096661254b565b6040516102ee919061424c565b34801561097e575f5ffd5b506103157f28959d3c8d9c85fe68b3927a0425322ccc2f64692cea992da81e150c4735301781565b3480156109b1575f5ffd5b5061050461260a565b3480156109c5575f5ffd5b506103946109d4366004613b8b565b612676565b5f6001600160e01b031982166301c65ed360e41b1480610a0957506001600160e01b03198216637f765ae960e01b145b80610a185750610a18826126e1565b92915050565b5f83815261015f6020526040812060010154600160281b90046001600160401b0316610a6557604051630853c2a360e41b8152600481018590526024015b60405180910390fd5b5f84815261015f60205260409081902061019154915163c408689360e01b81526001600160a01b0380871660048301529192610af092849288928892169063c408689390602401602060405180830381865afa158015610ac7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aeb91906142b3565b612720565b95945050505050565b610191546001600160a01b03163314610b2757604051635f94384d60e11b8152336004820152602401610a5c565b5f82815261015f60205260409020610b3e816128b1565b610b6d57604051630581f38360e31b8152600481018490526001600160a01b0383166024820152604401610a5c565b60018181015460ff1681811115610b8657610b86613b06565b14610bb657604051630581f38360e31b8152600481018490526001600160a01b0383166024820152604401610a5c565b6001600160a01b0382165f9081526007820160205260408120600101549003610bde57505050565b60026001600160a01b0383165f90815260078301602052604090205460ff166003811115610c0e57610c0e613b06565b03610c50576001600160a01b0382165f90815260078201602052604081206001015460058301805491929091610c459084906142de565b90915550610d249050565b60036001600160a01b0383165f90815260078301602052604090205460ff166003811115610c8057610c80613b06565b03610cb7576001600160a01b0382165f90815260078201602052604081206001015460068301805491929091610c459084906142de565b60016001600160a01b0383165f90815260078301602052604090205460ff166003811115610ce757610ce7613b06565b03610d24576001600160a01b0382165f90815260078201602052604081206001015460048301805491929091610d1e9084906142de565b90915550505b6001600160a01b0382165f81815260078301602052604080822060018101839055805460ff191690555185917fd1a5aed33a9da545d840ad891ad7eb68540d3d9e75eb80c5ac2051345839e3ad91a3505050565b610d80613a36565b506040805160608101825260018152600460208201525f9181019190915290565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610de95760405162461bcd60e51b8152600401610a5c906142f1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610e1b612910565b6001600160a01b031614610e415760405162461bcd60e51b8152600401610a5c9061433d565b610e4a8161292b565b604080515f80825260208201909252610e6591839190612964565b50565b5f81815261015f60205260408120600301548190610e84611e7f565b610e8e9190614389565b5f84815261015f60205260409020600501549091508190610eb290620f4240614389565b10159392505050565b60c9547f371f7eb46741163a91bb271e73a2a58ae7a0b6bc80c10a8c7e03ae2e4bc0e42590610ef8906001600160a01b031630335b845f36612ace565b610f0182612b88565b5050565b60c9547f28959d3c8d9c85fe68b3927a0425322ccc2f64692cea992da81e150c4735301790610f3e906001600160a01b03163033610ef0565b610191546001600160a01b03163314610f7a57610191546040516339ca713160e01b81526001600160a01b039091166004820152602401610a5c565b5f85815261015f6020526040902060010154600160281b90046001600160401b0316610fbc57604051630853c2a360e41b815260048101869052602401610a5c565b5f85815261015f60205260409020610fd681868686612720565b61100557604051634ad7c31760e11b8152600481018790526001600160a01b0386166024820152604401610a5c565b6001600160a01b0385165f90815260078201602052604090205460ff16600381111561103357611033613b06565b84600381111561104557611045613b06565b03611167576001600160a01b0385165f908152600782016020526040902060010154830361107357506113bf565b6001600160a01b0385165f90815260078201602052604081206001015461109a90856142de565b6001600160a01b0387165f9081526007840160205260409020600181018690555490915060029060ff1660038111156110d5576110d5613b06565b036110fb5780826004016001015f8282546110f091906143a0565b909155506111619050565b60036001600160a01b0387165f90815260078401602052604090205460ff16600381111561112b5761112b613b06565b036111465780826004016002015f8282546110f091906143a0565b80826004015f015f82825461115b91906143a0565b90915550505b50611379565b6001600160a01b0385165f9081526007820160205260409020600101541561129a5760026001600160a01b0386165f90815260078301602052604090205460ff1660038111156111b9576111b9613b06565b036111fb576001600160a01b0385165f908152600782016020526040812060010154600583018054919290916111f09084906142de565b9091555061129a9050565b60036001600160a01b0386165f90815260078301602052604090205460ff16600381111561122b5761122b613b06565b03611262576001600160a01b0385165f908152600782016020526040812060010154600683018054919290916111f09084906142de565b6001600160a01b0385165f908152600782016020526040812060010154600483018054919290916112949084906142de565b90915550505b60028460038111156112ae576112ae613b06565b036112d45782816004016001015f8282546112c991906143a0565b9091555061131e9050565b60038460038111156112e8576112e8613b06565b036113035782816004016002015f8282546112c991906143a0565b82816004015f015f82825461131891906143a0565b90915550505b6001600160a01b0385165f9081526007820160205260409020805485919060ff1916600183600381111561135457611354613b06565b02179055506001600160a01b0385165f90815260078201602052604090206001018390555b846001600160a01b0316867fb83d25c6a5d258561330739951487acb4bd09ba5190b5d32c4f261817d90679286866040516113b59291906143b3565b60405180910390a3505b5050505050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361140e5760405162461bcd60e51b8152600401610a5c906142f1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611440612910565b6001600160a01b0316146114665760405162461bcd60e51b8152600401610a5c9061433d565b61146f8261292b565b610f0182826001612964565b5f306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461151a5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610a5c565b505f5160206149f45f395f51905f5290565b5f611535612910565b905090565b5f81815261015f60205260408120611551816128b1565b9392505050565b7f47ff9796f72d439c6e5c30a24b9fad985a00c85a9f2258074c400a94f8746b00805460609190819061158a906143ce565b80601f01602080910402602001604051908101604052809291908181526020018280546115b6906143ce565b80156116015780601f106115d857610100808354040283529160200191611601565b820191905f5260205f20905b8154815290600101906020018083116115e457829003601f168201915b505050505091505090565b6101915460405163c408689360e01b81526001600160a01b0383811660048301525f92839291169063c408689390602401602060405180830381865afa158015611658573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061167c91906142b3565b111561168a57506001919050565b5f61169361260a565b90506001600160a01b0381161561171e576040516370a0823160e01b81526001600160a01b0384811660048301525f91908316906370a0823190602401602060405180830381865afa1580156116eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061170f91906142b3565b111561171e5750600192915050565b505f92915050565b60c9547f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f79061175f906001600160a01b03163033610ef0565b3061176d6020840184613b70565b6001600160a01b031614806117a25750610191546001600160a01b03166117976020840184613b70565b6001600160a01b0316145b156117c057604051633c6924b360e21b815260040160405180910390fd5b610f016117d23684900384018461440c565b612d99565b6040805180820182525f808252602080830182905285825261015f81528382206001600160a01b0386168352600701905282902082518084019093528054919291829060ff16600381111561182e5761182e613b06565b600381111561183f5761183f613b06565b8152602001600182015481525050905092915050565b5f81815261015f6020526040812060010154600160281b90046001600160401b031661189757604051630853c2a360e41b815260048101839052602401610a5c565b610a1882612e7a565b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905281906118f360405180606001604052805f81526020015f81526020015f81525090565b60605f61190f604080518082019091525f808252602082015290565b5f88815261015f60205260409020611926816128b1565b81546040805160c0810190915260018085018054949c5060ff9384169b50919391928492169081111561195b5761195b613b06565b600181111561196c5761196c613b06565b8152815463ffffffff6101008204166020808401919091526001600160401b03600160281b83048116604080860191909152600160681b909304166060808501919091526001850154608085015260029094015460a0909301929092528051928301815260048501548352600585015483830152600685015483820152600885018054825181850281018501909352808352949a5092985092905f9084015b82821015611aec575f848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191611a5d906143ce565b80601f0160208091040260200160405190810160405280929190818152602001828054611a89906143ce565b8015611ad45780601f10611aab57610100808354040283529160200191611ad4565b820191905f5260205f20905b815481529060010190602001808311611ab757829003601f168201915b50505050508152505081526020019060010190611a0b565b50505050600982015460408051808201909152600a840180546001600160a01b0381168352939750919550916020830190600160a01b900460ff166001811115611b3857611b38613b06565b6001811115611b4957611b49613b06565b81525050915050919395979092949650565b604080518082019091525f80825260208201526040805180820190915260fb80546001600160a01b03811683526020830190600160a01b900460ff166001811115611ba857611ba8613b06565b6001811115611bb957611bb9613b06565b905250919050565b5f5460ff1615611be35760405162dc149f60e41b815260040160405180910390fd5b5f54600190610100900460ff16158015611c0357505f5460ff8083169116105b611c665760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a5c565b5f805461ffff191660ff831617610100179055611c868786868686612ee5565b611c8f86612f93565b856001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ccb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cef919061446a565b6001600160a01b03167f3f1ec22954d444cb99f80a1989ac8f631616b8a575a89379e514c0f7f748c93360405160405180910390a25f805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050505050565b5f81815261015f6020526040812060010154600160281b90046001600160401b0316611daf57604051630853c2a360e41b815260048101839052602401610a5c565b610a1882612fc2565b5f81815261015f6020526040812060068101546001820154611de59190610100900463ffffffff16614389565b60058201546001830154611e0790610100900463ffffffff16620f42406142de565b611e119190614389565b119392505050565b5f81815261015f6020526040812060028101548290611e36611e7f565b611e409190614389565b6004830154600684015460058501549293508392611e5e91906143a0565b611e6891906143a0565b611e7590620f4240614389565b1015949350505050565b6101915460408051637e062a3560e11b815290515f926001600160a01b03169163fc0c546a9160048083019260209291908290030181865afa158015611ec7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611eeb919061446a565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f26573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061153591906142b3565b5f604051631bebc11560e01b815260040160405180910390fd5b604080518082019091525f80825260208201526040805180820190915260fb80546001600160a01b03811683525f9291906020830190600160a01b900460ff166001811115611fb557611fb5613b06565b6001811115611fc657611fc6613b06565b90525080519091506001600160a01b031661200c576040518060400160405280611ff860c9546001600160a01b031690565b6001600160a01b031681526020015f905290505b919050565b60c9545f907f8c433a4cd6b51969eca37f974940894297b9fcf4b282a213fea5cd8f85289c909061204c906001600160a01b03163033610ef0565b5f83515f1461206c578380602001905181019061206991906142b3565b90505b612074611e7f565b5f0361209357604051631f05dadd60e21b815260040160405180910390fd5b61209c86612feb565b6040519197509550612105906120ba9089908c908c906020016144ad565b60408051601f198184030181528282528051602091820120468483015243848401523060608501526080808501919091528251808503909101815260a0909301909152815191012090565b9250612132835f90815261015f6020526040902060010154600160281b90046001600160401b0316151590565b15612153576040516312dba68f60e01b815260048101849052602401610a5c565b5f83815261015f602052604090206101605460ff1660018083018054909160ff1990911690838181111561218957612189613b06565b021790555061016054610100900463ffffffff166001820180546cffffffffffffffffffffffff00191661010063ffffffff938416026cffffffffffffffff0000000000191617600160281b6001600160401b038b811682029290921767ffffffffffffffff60681b1916600160681b928b16929092029190911790915561016054041663ffffffff908116600283015561016054600160481b9004166003820155612233611f64565b8051600a830180546001600160a01b031981166001600160a01b0390931692831782556020840151919283916001600160a81b03191617600160a01b83600181111561228157612281613b06565b0217905550508215905061229757600981018290555b5f5b88518110156123e5575f6001600160a01b03168982815181106122be576122be6144d2565b60200260200101515f01516001600160a01b0316148061231357506101915489516001600160a01b03909116908a90839081106122fd576122fd6144d2565b60200260200101515f01516001600160a01b0316145b15612363578089828151811061232b5761232b6144d2565b60200260200101515f015160405163de4e8a3760e01b8152600401610a5c9291909182526001600160a01b0316602082015260400190565b81600801898281518110612379576123796144d2565b6020908102919091018101518254600180820185555f94855293839020825160039092020180546001600160a01b0319166001600160a01b039092169190911781559181015192820192909255604082015160028201906123da908261452a565b505050600101612299565b50336001600160a01b0316847fa6c1f8f4276dc3f243459e13b557c84e8f4e90b2e09070bad5f6909cee687c9289898e8e8e8960405161242a969594939291906145e4565b60405180910390a3610191546001600160a01b0316636c39396585336040516001600160e01b031960e085901b16815260048101929092526001600160a01b031660248201526044015f604051808303815f87803b15801561248a575f5ffd5b505af115801561249c573d5f5f3e3d5ffd5b505050505050509695505050505050565b60c9547f4707e94b25cfce1a7c363508fbb838c35864388ad77284b248282b9746982b9b906124e6906001600160a01b03163033610ef0565b61252483838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061308092505050565b505050565b5f81815261015f60205260408120611551816130e8565b5f6115356101615490565b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a08101919091526040805160c081019091526101608054829060ff1660018111156125a2576125a2613b06565b60018111156125b3576125b3613b06565b8152815463ffffffff610100820481166020840152600160281b820481166040840152600160481b82041660608301526001600160401b03600160681b90910416608082015260019091015460a090910152919050565b6101915460408051637e062a3560e11b815290515f926001600160a01b03169163fc0c546a9160048083019260209291908290030181865afa158015612652573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611535919061446a565b60c9547ff281525e53675515a6ba7cc7bea8a81e649b3608423ee2d73be1752cea887889906126af906001600160a01b03163033610ef0565b6126b882612fc2565b6126d857604051639fefd0f160e01b815260048101839052602401610a5c565b610f0182613146565b5f6001600160e01b031982166361705ba560e11b148061271157506001600160e01b0319821663288c314960e21b145b80610a185750610a18826131a5565b6001600160a01b0383165f908152600785016020526040812060010154612746866128b1565b612753575f9150506128a9565b5f84600381111561276657612766613b06565b03612774575f9150506128a9565b60018681015460ff168181111561278d5761278d613b06565b1461282f578083116127a2575f9150506128a9565b6001600160a01b0385165f90815260078701602052604081205460ff1660038111156127d0576127d0613b06565b1415801561281c57506001600160a01b0385165f90815260078701602052604090205460ff16600381111561280757612807613b06565b84600381111561281957612819613b06565b14155b1561282a575f9150506128a9565b6128a3565b82158061283b57508083105b15612849575f9150506128a9565b808314801561289557506001600160a01b0385165f90815260078701602052604090205460ff16600381111561288157612881613b06565b84600381111561289357612893613b06565b145b156128a3575f9150506128a9565b60019150505b949350505050565b5f5f6128bc426131e4565b60018401549091506001600160401b03808316600160281b90920416118015906128fd575060018301546001600160401b03600160681b9091048116908216105b8015611551575050905460ff1615919050565b5f5160206149f45f395f51905f52546001600160a01b031690565b60c9547f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f590610f01906001600160a01b03163033610ef0565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612997576125248361324f565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156129f1575060408051601f3d908101601f191682019092526129ee918101906142b3565b60015b612a545760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610a5c565b5f5160206149f45f395f51905f528114612ac25760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610a5c565b506125248383836132ea565b604051637ef7c88360e11b81526001600160a01b0387169063fdef910690612b02908890889088908890889060040161463b565b602060405180830381865afa158015612b1d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b41919061466e565b612b8057604051630cb6f8ed60e21b81526001600160a01b03808816600483015280871660248301528516604482015260648101849052608401610a5c565b505050505050565b612b966001620f42406142de565b612ba6604083016020840161469e565b63ffffffff161115612bf857612bc06001620f42406142de565b612bd0604083016020840161469e565b60405163cc80c19560e01b8152600481019290925263ffffffff166024820152604401610a5c565b620f4240612c0c606083016040840161469e565b63ffffffff161115612c2c57620f4240612bd0606083016040840161469e565b610e10612c3f60a08301608084016146b9565b6001600160401b03161015612c8d57610e10612c6160a08301608084016146b9565b604051633887442560e21b81526001600160401b03928316600482015291166024820152604401610a5c565b6228de80612ca160a08301608084016146b9565b6001600160401b03161115612cc4576228de80612c6160a08301608084016146b9565b620f4240612cd8608083016060840161469e565b63ffffffff161115612cf857620f4240612bd0608083016060840161469e565b80610160612d0682826146ec565b507f7216f428cdab36e9f92cfca819d8a27e681d4dd741b076ff3ae0df1140902c999050612d3760208301836147f2565b612d47604084016020850161469e565b612d57606085016040860161469e565b612d67608086016060870161469e565b612d7760a08701608088016146b9565b8660a00135604051612d8e9695949392919061480d565b60405180910390a150565b8051612db5906001600160a01b0316632a4f53ad60e11b613314565b8015612dd65750600181602001516001811115612dd457612dd4613b06565b145b15612df6578060405163266d0fb960e01b8152600401610a5c9190613f67565b805160fb80546001600160a01b039092166001600160a01b031983168117825560208401518493909183916001600160a81b03191617600160a01b836001811115612e4357612e43613b06565b02179055509050507f88e879ae0d71faf3aa708f2978daccb99b95243615dc104835b8c5a21c884ae681604051612d8e9190613f67565b5f81815261015f60205260408120612e91816130e8565b612e9d57505f92915050565b612ea683611db8565b612eb257505f92915050565b612ebb83611e19565b612ec757505f92915050565b612ed083610e68565b612edc57505f92915050565b50600192915050565b5f54610100900460ff16612f0b5760405162461bcd60e51b8152600401610a5c90614852565b6001600160a01b038516612f3157604051620bd73360e81b815260040160405180910390fd5b612f3a8561332f565b612f4384612b88565b612f556117d23685900385018561440c565b6113bf82828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061308092505050565b5f54610100900460ff16612fb95760405162461bcd60e51b8152600401610a5c90614852565b610e658161335e565b5f81815261015f60205260408120805460ff1615612fe257505f92915050565b612ed083612e7a565b5f5f5f612ff7426131e4565b9050836001600160401b03165f036130115780925061305a565b839250806001600160401b0316836001600160401b0316101561305a57604051631332703d60e21b81526001600160401b03808316600483015284166024820152604401610a5c565b6101605461307890600160681b90046001600160401b03168461489d565b915050915091565b7f47ff9796f72d439c6e5c30a24b9fad985a00c85a9f2258074c400a94f8746b00806130ac838261452a565b507fbb39ebb37e60fb5d606ffdb749d2336e56b88e6c88c4bd6513b308f643186eed826040516130dc9190613bd0565b60405180910390a15050565b60018101545f90600160681b90046001600160401b0316810361310c57505f919050565b5f613116426131e4565b60018401549091506001600160401b03600160681b9091048116908216101580611551575050905460ff16919050565b61314f816133d3565b61019154604051636689ef0f60e01b8152600481018390526001600160a01b0390911690636689ef0f906024015f604051808303815f87803b158015613193575f5ffd5b505af11580156113bf573d5f5f3e3d5ffd5b5f6001600160e01b0319821663c4cb5b9760e01b14806131d557506001600160e01b031982166310cfbe0360e11b145b80610a185750610a1882613553565b5f6001600160401b0382111561324b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610a5c565b5090565b6001600160a01b0381163b6132bc5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a5c565b5f5160206149f45f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b6132f383613592565b5f825111806132ff5750805b156125245761330e83836135d1565b50505050565b5f61331e836135f6565b801561155157506115518383613628565b5f54610100900460ff166133555760405162461bcd60e51b8152600401610a5c90614852565b610e65816136ae565b610191546001600160a01b03161561338957604051631741fa1560e01b815260040160405180910390fd5b61019180546001600160a01b0319166001600160a01b0383169081179091556040517fece83492b401b79221e354db5ab4a83a8db8c10dc6e20fc5bb7f4e802c3c255b905f90a250565b5f81815261015f60209081526040808320805460ff19166001178155600a8101546008820180548451818702810187019095528085529295613523956001600160a01b03909316948894909390919084015b82821015613506575f848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191613477906143ce565b80601f01602080910402602001604051908101604052809291908181526020018280546134a3906143ce565b80156134ee5780601f106134c5576101008083540402835291602001916134ee565b820191905f5260205f20905b8154815290600101906020018083116134d157829003601f168201915b50505050508152505081526020019060010190613425565b505050506009850154600a860154600160a01b900460ff166136f6565b505060405182907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f905f90a25050565b5f6001600160e01b0319821663368d719960e21b148061358357506001600160e01b03198216633f4644d160e21b145b80610a185750610a188261387d565b61359b8161324f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b60606115518383604051806060016040528060278152602001614a14602791396138f1565b5f613608826301ffc9a760e01b613628565b8015610a185750613621826001600160e01b0319613628565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b17815282515f9392849283928392918391908a617530fa92503d91505f519050828015613698575060208210155b80156136a357505f81115b979650505050505050565b5f54610100900460ff166136d45760405162461bcd60e51b8152600401610a5c90614852565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b60605f600183600181111561370d5761370d613b06565b036137fb575f6060886001600160a01b0316888888604051602401613734939291906148bc565b60408051601f198184030181529181526020820180516001600160e01b03166331c6fcc960e21b1790525161376991906148e4565b5f60405180830381855af49150503d805f81146137a1576040519150601f19603f3d011682016040523d82523d5f602084013e6137a6565b606091505b509092509050816137da578051156137c15780518082602001fd5b6040516318cecad560e01b815260040160405180910390fd5b808060200190518101906137ee91906148fa565b9094509250613873915050565b6040516331c6fcc960e21b81526001600160a01b0388169063c71bf3249061382b908990899089906004016148bc565b5f604051808303815f875af1158015613846573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261386d91908101906148fa565b90925090505b9550959350505050565b5f6001600160e01b0319821663041de68360e41b14806138ac57506001600160e01b03198216621574e360e91b145b806138c757506001600160e01b031982166352d1902d60e01b145b806138e257506001600160e01b0319821663afc5b82360e01b145b80610a185750610a1882613965565b60605f5f856001600160a01b03168560405161390d91906148e4565b5f60405180830381855af49150503d805f8114613945576040519150601f19603f3d011682016040523d82523d5f602084013e61394a565b606091505b509150915061395b86838387613999565b9695505050505050565b5f6001600160e01b03198216634a06561b60e11b1480610a1857506301ffc9a760e01b6001600160e01b0319831614610a18565b60608315613a075782515f03613a00576001600160a01b0385163b613a005760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a5c565b50816128a9565b6128a98383815115613a1c5781518083602001fd5b8060405162461bcd60e51b8152600401610a5c9190613bd0565b60405180606001604052806003906020820280368337509192915050565b5f60208284031215613a64575f5ffd5b81356001600160e01b031981168114611551575f5ffd5b6001600160a01b0381168114610e65575f5ffd5b80356004811061200c575f5ffd5b5f5f5f60608486031215613aaf575f5ffd5b833592506020840135613ac181613a7b565b9150613acf60408501613a8f565b90509250925092565b5f5f60408385031215613ae9575f5ffd5b823591506020830135613afb81613a7b565b809150509250929050565b634e487b7160e01b5f52602160045260245ffd5b60028110610e6557610e65613b06565b60208101613b3783613b1a565b91905290565b6060810181835f5b6003811015613b6757815160ff16835260209283019290910190600101613b45565b50505092915050565b5f60208284031215613b80575f5ffd5b813561155181613a7b565b5f60208284031215613b9b575f5ffd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6115516020830184613ba2565b5f60c08284031215613bf2575f5ffd5b50919050565b5f60c08284031215613c08575f5ffd5b6115518383613be2565b6020810160038310613b3757613b37613b06565b5f5f5f5f60808587031215613c39575f5ffd5b843593506020850135613c4b81613a7b565b9250613c5960408601613a8f565b9396929550929360600135925050565b634e487b7160e01b5f52604160045260245ffd5b604051606081016001600160401b0381118282101715613c9f57613c9f613c69565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613ccd57613ccd613c69565b604052919050565b5f6001600160401b03821115613ced57613ced613c69565b50601f01601f191660200190565b5f82601f830112613d0a575f5ffd5b8135613d1d613d1882613cd5565b613ca5565b818152846020838601011115613d31575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215613d5e575f5ffd5b8235613d6981613a7b565b915060208301356001600160401b03811115613d83575f5ffd5b613d8f85828601613cfb565b9150509250929050565b5f60408284031215613bf2575f5ffd5b5f60408284031215613db9575f5ffd5b6115518383613d99565b60048110613dd357613dd3613b06565b9052565b5f604082019050613de9828451613dc3565b602092830151919092015290565b5f82825180855260208501945060208160051b830101602085015f5b83811015613e6f57848303601f19018852815180516001600160a01b0316845260208082015190850152604090810151606091850182905290613e5890850182613ba2565b6020998a0199909450929092019150600101613e13565b50909695505050505050565b80516001600160a01b031682526020810151613e9681613b1a565b806020840152505050565b871515815286151560208201525f8651613eba81613b1a565b8060408401525063ffffffff60208801511660608301526001600160401b0360408801511660808301526001600160401b0360608801511660a0830152608087015160c083015260a087015160e0830152613f2d6101008301878051825260208082015190830152604090810151910152565b6101e0610160830152613f446101e0830186613df7565b905083610180830152613f5b6101a0830184613e7b565b98975050505050505050565b60408101610a188284613e7b565b5f5f83601f840112613f85575f5ffd5b5081356001600160401b03811115613f9b575f5ffd5b602083019150836020828501011115613fb2575f5ffd5b9250929050565b5f5f5f5f5f5f6101608789031215613fcf575f5ffd5b8635613fda81613a7b565b95506020870135613fea81613a7b565b9450613ff98860408901613be2565b9350614009886101008901613d99565b92506101408701356001600160401b03811115614024575f5ffd5b61403089828a01613f75565b979a9699509497509295939492505050565b5f6001600160401b0382111561405a5761405a613c69565b5060051b60200190565b6001600160401b0381168114610e65575f5ffd5b803561200c81614064565b5f5f5f5f5f5f60a08789031215614098575f5ffd5b6001600160401b03873511156140ac575f5ffd5b6140b98888358901613f75565b90965094506001600160401b03602088013511156140d5575f5ffd5b6020870135870188601f8201126140ea575f5ffd5b6140f7613d188235614042565b81358082526020808301929160051b8401018b1015614114575f5ffd5b602083015b6020843560051b8501018110156141b9576001600160401b038135111561413e575f5ffd5b803584016060818e03601f19011215614155575f5ffd5b61415d613c7d565b61416a6020830135613a7b565b60208281013582526040830135908201526001600160401b0360608301351115614192575f5ffd5b6141a58e60206060850135850101613cfb565b604082015284525060209283019201614119565b5095506141cb91505060408801614078565b92506141d960608801614078565b91506001600160401b03608088013511156141f2575f5ffd5b6142028860808901358901613cfb565b90509295509295509295565b5f5f6020838503121561421f575f5ffd5b82356001600160401b03811115614234575f5ffd5b61424085828601613f75565b90969095509350505050565b815160c082019061425c81613b1a565b8083525063ffffffff602084015116602083015263ffffffff604084015116604083015263ffffffff60608401511660608301526001600160401b03608084015116608083015260a083015160a083015292915050565b5f602082840312156142c3575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610a1857610a186142ca565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082028115828204841417610a1857610a186142ca565b80820180821115610a1857610a186142ca565b604081016143c18285613dc3565b8260208301529392505050565b600181811c908216806143e257607f821691505b602082108103613bf257634e487b7160e01b5f52602260045260245ffd5b60028110610e65575f5ffd5b5f604082840312801561441d575f5ffd5b50604080519081016001600160401b038111828210171561444057614440613c69565b604052823561444e81613a7b565b8152602083013561445e81614400565b60208201529392505050565b5f6020828403121561447a575f5ffd5b815161155181613a7b565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b604081525f6144bf6040830186613df7565b828103602084015261395b818587614485565b634e487b7160e01b5f52603260045260245ffd5b601f82111561252457805f5260205f20601f840160051c8101602085101561450b5750805b601f840160051c820191505b818110156113bf575f8155600101614517565b81516001600160401b0381111561454357614543613c69565b6145578161455184546143ce565b846144e6565b6020601f821160018114614589575f83156145725750848201515b5f19600385901b1c1916600184901b1784556113bf565b5f84815260208120601f198516915b828110156145b85787850151825560209485019460019092019101614598565b50848210156145d557868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b6001600160401b03871681526001600160401b038616602082015260a060408201525f61461560a083018688614485565b82810360608401526146278186613df7565b915050826080830152979650505050505050565b6001600160a01b03868116825285166020820152604081018490526080606082018190525f906136a39083018486614485565b5f6020828403121561467e575f5ffd5b81518015158114611551575f5ffd5b63ffffffff81168114610e65575f5ffd5b5f602082840312156146ae575f5ffd5b81356115518161468d565b5f602082840312156146c9575f5ffd5b813561155181614064565b5f8135610a188161468d565b5f8135610a1881614064565b81356146f781614400565b61470081613b1a565b815460ff821691508160ff198216178355602084013561471f8161468d565b64ffffffff008160081b168364ffffffffff198416171784555050505f604083013561474a8161468d565b825468ffffffff0000000000191660289190911b68ffffffff000000000016178255506147a861477c606084016146d4565b82546cffffffff000000000000000000191660489190911b6cffffffff00000000000000000016178255565b6147e36147b7608084016146e0565b82805467ffffffffffffffff60681b191660689290921b67ffffffffffffffff60681b16919091179055565b60a09190910135600190910155565b5f60208284031215614802575f5ffd5b813561155181614400565b60c0810161481a88613b1a565b96815263ffffffff958616602082015293851660408501529190931660608301526001600160401b03909216608082015260a0015290565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160401b038181168382160190811115610a1857610a186142ca565b838152606060208201525f6148d46060830185613df7565b9050826040830152949350505050565b5f82518060208501845e5f920191825250919050565b5f5f6040838503121561490b575f5ffd5b82516001600160401b03811115614920575f5ffd5b8301601f81018513614930575f5ffd5b805161493e613d1882614042565b8082825260208201915060208360051b85010192508783111561495f575f5ffd5b602084015b838110156149df5780516001600160401b03811115614981575f5ffd5b8501603f81018a13614991575f5ffd5b60208101516149a2613d1882613cd5565b8181526040838301018c10156149b6575f5ffd5b8160408401602083015e5f60208383010152808652505050602083019250602081019050614964565b50602096909601519597959650505050505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220db05efa538f266e08bec7f3a5ae2426d9d502b9abb4d50740fb7f4c66704bf7d64736f6c634300081c0033

Deployed Bytecode

0x6080604052600436106102bf575f3560e01c8063b9835a171161016f578063d9779fbe116100d8578063eff759a811610092578063f68326431161006d578063f683264314610952578063f822de1d14610973578063fc0c546a146109a6578063fe0d94c1146109ba575f5ffd5b8063eff759a8146108d6578063f3dfd5591461091f578063f60046b21461093e575f5ffd5b8063d9779fbe14610829578063da35c6641461083d578063dd63c06f14610851578063e306bee714610865578063ea65ab8214610898578063ee57e36f146108b7575f5ffd5b8063c9c4bfca11610129578063c9c4bfca14610747578063cc4b00701461077a578063cc63604a14610799578063cf131149146107b8578063cfceb588146107d7578063cfd40b841461080a575f5ffd5b8063b9835a1714610668578063bb225da21461068a578063bc3f931f146106a9578063c218c132146106d5578063c7f758a8146106f4578063c98425ee14610726575f5ffd5b80633f8b32d91161022b5780635c60da1b116101e55780637a5b4f59116101c05780637a5b4f59146105e25780638cb75059146105f6578063a230c52414610629578063acca30a214610648575f5ffd5b80635c60da1b1461057c5780636ff44abd14610590578063780e19c1146105c3575f5ffd5b80633f8b32d9146104cc5780634162169f146104eb57806341de68301461051c578063483f50f8146105365780634f1ef2861461055557806352d1902d14610568575f5ffd5b80632ae9c6001161027c5780632ae9c600146103b65780632e747051146103d757806330109962146104085780633659cfe61461044057806336fa95891461045f5780633d3f4b1b1461047e575f5ffd5b806301ffc9a7146102c35780630e04be90146102f757806311ce24381461032357806317d1b404146103565780632098be151461037557806323d0718814610396575b5f5ffd5b3480156102ce575f5ffd5b506102e26102dd366004613a54565b6109d9565b60405190151581526020015b60405180910390f35b348015610302575f5ffd5b5061016054600160481b900463ffffffff165b6040519081526020016102ee565b34801561032e575f5ffd5b506103157f8c433a4cd6b51969eca37f974940894297b9fcf4b282a213fea5cd8f85289c9081565b348015610361575f5ffd5b506102e2610370366004613a9d565b610a1e565b348015610380575f5ffd5b5061039461038f366004613ad8565b610af9565b005b3480156103a1575f5ffd5b506101605460ff166040516102ee9190613b2a565b3480156103c1575f5ffd5b506103ca610d78565b6040516102ee9190613b3d565b3480156103e2575f5ffd5b5061016054610100900463ffffffff165b60405163ffffffff90911681526020016102ee565b348015610413575f5ffd5b5061016054600160681b90046001600160401b03166040516001600160401b0390911681526020016102ee565b34801561044b575f5ffd5b5061039461045a366004613b70565b610da1565b34801561046a575f5ffd5b506102e2610479366004613b8b565b610e68565b348015610489575f5ffd5b5060408051808201909152601981527f2875696e7432353620616c6c6f774661696c7572654d6170290000000000000060208201525b6040516102ee9190613bd0565b3480156104d7575f5ffd5b506103946104e6366004613bf8565b610ebb565b3480156104f6575f5ffd5b5060c9546001600160a01b03165b6040516001600160a01b0390911681526020016102ee565b348015610527575f5ffd5b505f6040516102ee9190613c12565b348015610541575f5ffd5b50610394610550366004613c26565b610f05565b610394610563366004613d4d565b6113c6565b348015610573575f5ffd5b5061031561147b565b348015610587575f5ffd5b5061050461152c565b34801561059b575f5ffd5b506103157f371f7eb46741163a91bb271e73a2a58ae7a0b6bc80c10a8c7e03ae2e4bc0e42581565b3480156105ce575f5ffd5b506102e26105dd366004613b8b565b61153a565b3480156105ed575f5ffd5b506104bf611558565b348015610601575f5ffd5b506103157f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f781565b348015610634575f5ffd5b506102e2610643366004613b70565b61160c565b348015610653575f5ffd5b5061019154610504906001600160a01b031681565b348015610673575f5ffd5b5061016054600160281b900463ffffffff166103f3565b348015610695575f5ffd5b506103946106a4366004613da9565b611726565b3480156106b4575f5ffd5b506106c86106c3366004613ad8565b6117d7565b6040516102ee9190613dd7565b3480156106e0575f5ffd5b506102e26106ef366004613b8b565b611855565b3480156106ff575f5ffd5b5061071361070e366004613b8b565b6118a0565b6040516102ee9796959493929190613ea1565b348015610731575f5ffd5b5061073a611b5b565b6040516102ee9190613f67565b348015610752575f5ffd5b506103157f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f581565b348015610785575f5ffd5b50610394610794366004613fb9565b611bc1565b3480156107a4575f5ffd5b506102e26107b3366004613b8b565b611d6d565b3480156107c3575f5ffd5b506102e26107d2366004613b8b565b611db8565b3480156107e2575f5ffd5b506103157ff281525e53675515a6ba7cc7bea8a81e649b3608423ee2d73be1752cea88788981565b348015610815575f5ffd5b506102e2610824366004613b8b565b611e19565b348015610834575f5ffd5b50610315611e7f565b348015610848575f5ffd5b50610315611f4a565b34801561085c575f5ffd5b5061073a611f64565b348015610870575f5ffd5b506103157f4707e94b25cfce1a7c363508fbb838c35864388ad77284b248282b9746982b9b81565b3480156108a3575f5ffd5b506103156108b2366004614083565b612011565b3480156108c2575f5ffd5b506103946108d136600461420e565b6124ad565b3480156108e1575f5ffd5b506103156108f0366004613ad8565b5f82815261015f602090815260408083206001600160a01b038516845260070190915290206001015492915050565b34801561092a575f5ffd5b506102e2610939366004613b8b565b612529565b348015610949575f5ffd5b50610315612540565b34801561095d575f5ffd5b5061096661254b565b6040516102ee919061424c565b34801561097e575f5ffd5b506103157f28959d3c8d9c85fe68b3927a0425322ccc2f64692cea992da81e150c4735301781565b3480156109b1575f5ffd5b5061050461260a565b3480156109c5575f5ffd5b506103946109d4366004613b8b565b612676565b5f6001600160e01b031982166301c65ed360e41b1480610a0957506001600160e01b03198216637f765ae960e01b145b80610a185750610a18826126e1565b92915050565b5f83815261015f6020526040812060010154600160281b90046001600160401b0316610a6557604051630853c2a360e41b8152600481018590526024015b60405180910390fd5b5f84815261015f60205260409081902061019154915163c408689360e01b81526001600160a01b0380871660048301529192610af092849288928892169063c408689390602401602060405180830381865afa158015610ac7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aeb91906142b3565b612720565b95945050505050565b610191546001600160a01b03163314610b2757604051635f94384d60e11b8152336004820152602401610a5c565b5f82815261015f60205260409020610b3e816128b1565b610b6d57604051630581f38360e31b8152600481018490526001600160a01b0383166024820152604401610a5c565b60018181015460ff1681811115610b8657610b86613b06565b14610bb657604051630581f38360e31b8152600481018490526001600160a01b0383166024820152604401610a5c565b6001600160a01b0382165f9081526007820160205260408120600101549003610bde57505050565b60026001600160a01b0383165f90815260078301602052604090205460ff166003811115610c0e57610c0e613b06565b03610c50576001600160a01b0382165f90815260078201602052604081206001015460058301805491929091610c459084906142de565b90915550610d249050565b60036001600160a01b0383165f90815260078301602052604090205460ff166003811115610c8057610c80613b06565b03610cb7576001600160a01b0382165f90815260078201602052604081206001015460068301805491929091610c459084906142de565b60016001600160a01b0383165f90815260078301602052604090205460ff166003811115610ce757610ce7613b06565b03610d24576001600160a01b0382165f90815260078201602052604081206001015460048301805491929091610d1e9084906142de565b90915550505b6001600160a01b0382165f81815260078301602052604080822060018101839055805460ff191690555185917fd1a5aed33a9da545d840ad891ad7eb68540d3d9e75eb80c5ac2051345839e3ad91a3505050565b610d80613a36565b506040805160608101825260018152600460208201525f9181019190915290565b6001600160a01b037f000000000000000000000000f807611bef9c52d893d7f3d63d2f254e684112a3163003610de95760405162461bcd60e51b8152600401610a5c906142f1565b7f000000000000000000000000f807611bef9c52d893d7f3d63d2f254e684112a36001600160a01b0316610e1b612910565b6001600160a01b031614610e415760405162461bcd60e51b8152600401610a5c9061433d565b610e4a8161292b565b604080515f80825260208201909252610e6591839190612964565b50565b5f81815261015f60205260408120600301548190610e84611e7f565b610e8e9190614389565b5f84815261015f60205260409020600501549091508190610eb290620f4240614389565b10159392505050565b60c9547f371f7eb46741163a91bb271e73a2a58ae7a0b6bc80c10a8c7e03ae2e4bc0e42590610ef8906001600160a01b031630335b845f36612ace565b610f0182612b88565b5050565b60c9547f28959d3c8d9c85fe68b3927a0425322ccc2f64692cea992da81e150c4735301790610f3e906001600160a01b03163033610ef0565b610191546001600160a01b03163314610f7a57610191546040516339ca713160e01b81526001600160a01b039091166004820152602401610a5c565b5f85815261015f6020526040902060010154600160281b90046001600160401b0316610fbc57604051630853c2a360e41b815260048101869052602401610a5c565b5f85815261015f60205260409020610fd681868686612720565b61100557604051634ad7c31760e11b8152600481018790526001600160a01b0386166024820152604401610a5c565b6001600160a01b0385165f90815260078201602052604090205460ff16600381111561103357611033613b06565b84600381111561104557611045613b06565b03611167576001600160a01b0385165f908152600782016020526040902060010154830361107357506113bf565b6001600160a01b0385165f90815260078201602052604081206001015461109a90856142de565b6001600160a01b0387165f9081526007840160205260409020600181018690555490915060029060ff1660038111156110d5576110d5613b06565b036110fb5780826004016001015f8282546110f091906143a0565b909155506111619050565b60036001600160a01b0387165f90815260078401602052604090205460ff16600381111561112b5761112b613b06565b036111465780826004016002015f8282546110f091906143a0565b80826004015f015f82825461115b91906143a0565b90915550505b50611379565b6001600160a01b0385165f9081526007820160205260409020600101541561129a5760026001600160a01b0386165f90815260078301602052604090205460ff1660038111156111b9576111b9613b06565b036111fb576001600160a01b0385165f908152600782016020526040812060010154600583018054919290916111f09084906142de565b9091555061129a9050565b60036001600160a01b0386165f90815260078301602052604090205460ff16600381111561122b5761122b613b06565b03611262576001600160a01b0385165f908152600782016020526040812060010154600683018054919290916111f09084906142de565b6001600160a01b0385165f908152600782016020526040812060010154600483018054919290916112949084906142de565b90915550505b60028460038111156112ae576112ae613b06565b036112d45782816004016001015f8282546112c991906143a0565b9091555061131e9050565b60038460038111156112e8576112e8613b06565b036113035782816004016002015f8282546112c991906143a0565b82816004015f015f82825461131891906143a0565b90915550505b6001600160a01b0385165f9081526007820160205260409020805485919060ff1916600183600381111561135457611354613b06565b02179055506001600160a01b0385165f90815260078201602052604090206001018390555b846001600160a01b0316867fb83d25c6a5d258561330739951487acb4bd09ba5190b5d32c4f261817d90679286866040516113b59291906143b3565b60405180910390a3505b5050505050565b6001600160a01b037f000000000000000000000000f807611bef9c52d893d7f3d63d2f254e684112a316300361140e5760405162461bcd60e51b8152600401610a5c906142f1565b7f000000000000000000000000f807611bef9c52d893d7f3d63d2f254e684112a36001600160a01b0316611440612910565b6001600160a01b0316146114665760405162461bcd60e51b8152600401610a5c9061433d565b61146f8261292b565b610f0182826001612964565b5f306001600160a01b037f000000000000000000000000f807611bef9c52d893d7f3d63d2f254e684112a3161461151a5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610a5c565b505f5160206149f45f395f51905f5290565b5f611535612910565b905090565b5f81815261015f60205260408120611551816128b1565b9392505050565b7f47ff9796f72d439c6e5c30a24b9fad985a00c85a9f2258074c400a94f8746b00805460609190819061158a906143ce565b80601f01602080910402602001604051908101604052809291908181526020018280546115b6906143ce565b80156116015780601f106115d857610100808354040283529160200191611601565b820191905f5260205f20905b8154815290600101906020018083116115e457829003601f168201915b505050505091505090565b6101915460405163c408689360e01b81526001600160a01b0383811660048301525f92839291169063c408689390602401602060405180830381865afa158015611658573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061167c91906142b3565b111561168a57506001919050565b5f61169361260a565b90506001600160a01b0381161561171e576040516370a0823160e01b81526001600160a01b0384811660048301525f91908316906370a0823190602401602060405180830381865afa1580156116eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061170f91906142b3565b111561171e5750600192915050565b505f92915050565b60c9547f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f79061175f906001600160a01b03163033610ef0565b3061176d6020840184613b70565b6001600160a01b031614806117a25750610191546001600160a01b03166117976020840184613b70565b6001600160a01b0316145b156117c057604051633c6924b360e21b815260040160405180910390fd5b610f016117d23684900384018461440c565b612d99565b6040805180820182525f808252602080830182905285825261015f81528382206001600160a01b0386168352600701905282902082518084019093528054919291829060ff16600381111561182e5761182e613b06565b600381111561183f5761183f613b06565b8152602001600182015481525050905092915050565b5f81815261015f6020526040812060010154600160281b90046001600160401b031661189757604051630853c2a360e41b815260048101839052602401610a5c565b610a1882612e7a565b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905281906118f360405180606001604052805f81526020015f81526020015f81525090565b60605f61190f604080518082019091525f808252602082015290565b5f88815261015f60205260409020611926816128b1565b81546040805160c0810190915260018085018054949c5060ff9384169b50919391928492169081111561195b5761195b613b06565b600181111561196c5761196c613b06565b8152815463ffffffff6101008204166020808401919091526001600160401b03600160281b83048116604080860191909152600160681b909304166060808501919091526001850154608085015260029094015460a0909301929092528051928301815260048501548352600585015483830152600685015483820152600885018054825181850281018501909352808352949a5092985092905f9084015b82821015611aec575f848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191611a5d906143ce565b80601f0160208091040260200160405190810160405280929190818152602001828054611a89906143ce565b8015611ad45780601f10611aab57610100808354040283529160200191611ad4565b820191905f5260205f20905b815481529060010190602001808311611ab757829003601f168201915b50505050508152505081526020019060010190611a0b565b50505050600982015460408051808201909152600a840180546001600160a01b0381168352939750919550916020830190600160a01b900460ff166001811115611b3857611b38613b06565b6001811115611b4957611b49613b06565b81525050915050919395979092949650565b604080518082019091525f80825260208201526040805180820190915260fb80546001600160a01b03811683526020830190600160a01b900460ff166001811115611ba857611ba8613b06565b6001811115611bb957611bb9613b06565b905250919050565b5f5460ff1615611be35760405162dc149f60e41b815260040160405180910390fd5b5f54600190610100900460ff16158015611c0357505f5460ff8083169116105b611c665760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610a5c565b5f805461ffff191660ff831617610100179055611c868786868686612ee5565b611c8f86612f93565b856001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ccb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cef919061446a565b6001600160a01b03167f3f1ec22954d444cb99f80a1989ac8f631616b8a575a89379e514c0f7f748c93360405160405180910390a25f805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050505050565b5f81815261015f6020526040812060010154600160281b90046001600160401b0316611daf57604051630853c2a360e41b815260048101839052602401610a5c565b610a1882612fc2565b5f81815261015f6020526040812060068101546001820154611de59190610100900463ffffffff16614389565b60058201546001830154611e0790610100900463ffffffff16620f42406142de565b611e119190614389565b119392505050565b5f81815261015f6020526040812060028101548290611e36611e7f565b611e409190614389565b6004830154600684015460058501549293508392611e5e91906143a0565b611e6891906143a0565b611e7590620f4240614389565b1015949350505050565b6101915460408051637e062a3560e11b815290515f926001600160a01b03169163fc0c546a9160048083019260209291908290030181865afa158015611ec7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611eeb919061446a565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f26573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061153591906142b3565b5f604051631bebc11560e01b815260040160405180910390fd5b604080518082019091525f80825260208201526040805180820190915260fb80546001600160a01b03811683525f9291906020830190600160a01b900460ff166001811115611fb557611fb5613b06565b6001811115611fc657611fc6613b06565b90525080519091506001600160a01b031661200c576040518060400160405280611ff860c9546001600160a01b031690565b6001600160a01b031681526020015f905290505b919050565b60c9545f907f8c433a4cd6b51969eca37f974940894297b9fcf4b282a213fea5cd8f85289c909061204c906001600160a01b03163033610ef0565b5f83515f1461206c578380602001905181019061206991906142b3565b90505b612074611e7f565b5f0361209357604051631f05dadd60e21b815260040160405180910390fd5b61209c86612feb565b6040519197509550612105906120ba9089908c908c906020016144ad565b60408051601f198184030181528282528051602091820120468483015243848401523060608501526080808501919091528251808503909101815260a0909301909152815191012090565b9250612132835f90815261015f6020526040902060010154600160281b90046001600160401b0316151590565b15612153576040516312dba68f60e01b815260048101849052602401610a5c565b5f83815261015f602052604090206101605460ff1660018083018054909160ff1990911690838181111561218957612189613b06565b021790555061016054610100900463ffffffff166001820180546cffffffffffffffffffffffff00191661010063ffffffff938416026cffffffffffffffff0000000000191617600160281b6001600160401b038b811682029290921767ffffffffffffffff60681b1916600160681b928b16929092029190911790915561016054041663ffffffff908116600283015561016054600160481b9004166003820155612233611f64565b8051600a830180546001600160a01b031981166001600160a01b0390931692831782556020840151919283916001600160a81b03191617600160a01b83600181111561228157612281613b06565b0217905550508215905061229757600981018290555b5f5b88518110156123e5575f6001600160a01b03168982815181106122be576122be6144d2565b60200260200101515f01516001600160a01b0316148061231357506101915489516001600160a01b03909116908a90839081106122fd576122fd6144d2565b60200260200101515f01516001600160a01b0316145b15612363578089828151811061232b5761232b6144d2565b60200260200101515f015160405163de4e8a3760e01b8152600401610a5c9291909182526001600160a01b0316602082015260400190565b81600801898281518110612379576123796144d2565b6020908102919091018101518254600180820185555f94855293839020825160039092020180546001600160a01b0319166001600160a01b039092169190911781559181015192820192909255604082015160028201906123da908261452a565b505050600101612299565b50336001600160a01b0316847fa6c1f8f4276dc3f243459e13b557c84e8f4e90b2e09070bad5f6909cee687c9289898e8e8e8960405161242a969594939291906145e4565b60405180910390a3610191546001600160a01b0316636c39396585336040516001600160e01b031960e085901b16815260048101929092526001600160a01b031660248201526044015f604051808303815f87803b15801561248a575f5ffd5b505af115801561249c573d5f5f3e3d5ffd5b505050505050509695505050505050565b60c9547f4707e94b25cfce1a7c363508fbb838c35864388ad77284b248282b9746982b9b906124e6906001600160a01b03163033610ef0565b61252483838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061308092505050565b505050565b5f81815261015f60205260408120611551816130e8565b5f6115356101615490565b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a08101919091526040805160c081019091526101608054829060ff1660018111156125a2576125a2613b06565b60018111156125b3576125b3613b06565b8152815463ffffffff610100820481166020840152600160281b820481166040840152600160481b82041660608301526001600160401b03600160681b90910416608082015260019091015460a090910152919050565b6101915460408051637e062a3560e11b815290515f926001600160a01b03169163fc0c546a9160048083019260209291908290030181865afa158015612652573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611535919061446a565b60c9547ff281525e53675515a6ba7cc7bea8a81e649b3608423ee2d73be1752cea887889906126af906001600160a01b03163033610ef0565b6126b882612fc2565b6126d857604051639fefd0f160e01b815260048101839052602401610a5c565b610f0182613146565b5f6001600160e01b031982166361705ba560e11b148061271157506001600160e01b0319821663288c314960e21b145b80610a185750610a18826131a5565b6001600160a01b0383165f908152600785016020526040812060010154612746866128b1565b612753575f9150506128a9565b5f84600381111561276657612766613b06565b03612774575f9150506128a9565b60018681015460ff168181111561278d5761278d613b06565b1461282f578083116127a2575f9150506128a9565b6001600160a01b0385165f90815260078701602052604081205460ff1660038111156127d0576127d0613b06565b1415801561281c57506001600160a01b0385165f90815260078701602052604090205460ff16600381111561280757612807613b06565b84600381111561281957612819613b06565b14155b1561282a575f9150506128a9565b6128a3565b82158061283b57508083105b15612849575f9150506128a9565b808314801561289557506001600160a01b0385165f90815260078701602052604090205460ff16600381111561288157612881613b06565b84600381111561289357612893613b06565b145b156128a3575f9150506128a9565b60019150505b949350505050565b5f5f6128bc426131e4565b60018401549091506001600160401b03808316600160281b90920416118015906128fd575060018301546001600160401b03600160681b9091048116908216105b8015611551575050905460ff1615919050565b5f5160206149f45f395f51905f52546001600160a01b031690565b60c9547f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f590610f01906001600160a01b03163033610ef0565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612997576125248361324f565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156129f1575060408051601f3d908101601f191682019092526129ee918101906142b3565b60015b612a545760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610a5c565b5f5160206149f45f395f51905f528114612ac25760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610a5c565b506125248383836132ea565b604051637ef7c88360e11b81526001600160a01b0387169063fdef910690612b02908890889088908890889060040161463b565b602060405180830381865afa158015612b1d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b41919061466e565b612b8057604051630cb6f8ed60e21b81526001600160a01b03808816600483015280871660248301528516604482015260648101849052608401610a5c565b505050505050565b612b966001620f42406142de565b612ba6604083016020840161469e565b63ffffffff161115612bf857612bc06001620f42406142de565b612bd0604083016020840161469e565b60405163cc80c19560e01b8152600481019290925263ffffffff166024820152604401610a5c565b620f4240612c0c606083016040840161469e565b63ffffffff161115612c2c57620f4240612bd0606083016040840161469e565b610e10612c3f60a08301608084016146b9565b6001600160401b03161015612c8d57610e10612c6160a08301608084016146b9565b604051633887442560e21b81526001600160401b03928316600482015291166024820152604401610a5c565b6228de80612ca160a08301608084016146b9565b6001600160401b03161115612cc4576228de80612c6160a08301608084016146b9565b620f4240612cd8608083016060840161469e565b63ffffffff161115612cf857620f4240612bd0608083016060840161469e565b80610160612d0682826146ec565b507f7216f428cdab36e9f92cfca819d8a27e681d4dd741b076ff3ae0df1140902c999050612d3760208301836147f2565b612d47604084016020850161469e565b612d57606085016040860161469e565b612d67608086016060870161469e565b612d7760a08701608088016146b9565b8660a00135604051612d8e9695949392919061480d565b60405180910390a150565b8051612db5906001600160a01b0316632a4f53ad60e11b613314565b8015612dd65750600181602001516001811115612dd457612dd4613b06565b145b15612df6578060405163266d0fb960e01b8152600401610a5c9190613f67565b805160fb80546001600160a01b039092166001600160a01b031983168117825560208401518493909183916001600160a81b03191617600160a01b836001811115612e4357612e43613b06565b02179055509050507f88e879ae0d71faf3aa708f2978daccb99b95243615dc104835b8c5a21c884ae681604051612d8e9190613f67565b5f81815261015f60205260408120612e91816130e8565b612e9d57505f92915050565b612ea683611db8565b612eb257505f92915050565b612ebb83611e19565b612ec757505f92915050565b612ed083610e68565b612edc57505f92915050565b50600192915050565b5f54610100900460ff16612f0b5760405162461bcd60e51b8152600401610a5c90614852565b6001600160a01b038516612f3157604051620bd73360e81b815260040160405180910390fd5b612f3a8561332f565b612f4384612b88565b612f556117d23685900385018561440c565b6113bf82828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061308092505050565b5f54610100900460ff16612fb95760405162461bcd60e51b8152600401610a5c90614852565b610e658161335e565b5f81815261015f60205260408120805460ff1615612fe257505f92915050565b612ed083612e7a565b5f5f5f612ff7426131e4565b9050836001600160401b03165f036130115780925061305a565b839250806001600160401b0316836001600160401b0316101561305a57604051631332703d60e21b81526001600160401b03808316600483015284166024820152604401610a5c565b6101605461307890600160681b90046001600160401b03168461489d565b915050915091565b7f47ff9796f72d439c6e5c30a24b9fad985a00c85a9f2258074c400a94f8746b00806130ac838261452a565b507fbb39ebb37e60fb5d606ffdb749d2336e56b88e6c88c4bd6513b308f643186eed826040516130dc9190613bd0565b60405180910390a15050565b60018101545f90600160681b90046001600160401b0316810361310c57505f919050565b5f613116426131e4565b60018401549091506001600160401b03600160681b9091048116908216101580611551575050905460ff16919050565b61314f816133d3565b61019154604051636689ef0f60e01b8152600481018390526001600160a01b0390911690636689ef0f906024015f604051808303815f87803b158015613193575f5ffd5b505af11580156113bf573d5f5f3e3d5ffd5b5f6001600160e01b0319821663c4cb5b9760e01b14806131d557506001600160e01b031982166310cfbe0360e11b145b80610a185750610a1882613553565b5f6001600160401b0382111561324b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201526534206269747360d01b6064820152608401610a5c565b5090565b6001600160a01b0381163b6132bc5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610a5c565b5f5160206149f45f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b6132f383613592565b5f825111806132ff5750805b156125245761330e83836135d1565b50505050565b5f61331e836135f6565b801561155157506115518383613628565b5f54610100900460ff166133555760405162461bcd60e51b8152600401610a5c90614852565b610e65816136ae565b610191546001600160a01b03161561338957604051631741fa1560e01b815260040160405180910390fd5b61019180546001600160a01b0319166001600160a01b0383169081179091556040517fece83492b401b79221e354db5ab4a83a8db8c10dc6e20fc5bb7f4e802c3c255b905f90a250565b5f81815261015f60209081526040808320805460ff19166001178155600a8101546008820180548451818702810187019095528085529295613523956001600160a01b03909316948894909390919084015b82821015613506575f848152602090819020604080516060810182526003860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191613477906143ce565b80601f01602080910402602001604051908101604052809291908181526020018280546134a3906143ce565b80156134ee5780601f106134c5576101008083540402835291602001916134ee565b820191905f5260205f20905b8154815290600101906020018083116134d157829003601f168201915b50505050508152505081526020019060010190613425565b505050506009850154600a860154600160a01b900460ff166136f6565b505060405182907f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f905f90a25050565b5f6001600160e01b0319821663368d719960e21b148061358357506001600160e01b03198216633f4644d160e21b145b80610a185750610a188261387d565b61359b8161324f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b60606115518383604051806060016040528060278152602001614a14602791396138f1565b5f613608826301ffc9a760e01b613628565b8015610a185750613621826001600160e01b0319613628565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180516001600160e01b03166301ffc9a760e01b17815282515f9392849283928392918391908a617530fa92503d91505f519050828015613698575060208210155b80156136a357505f81115b979650505050505050565b5f54610100900460ff166136d45760405162461bcd60e51b8152600401610a5c90614852565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b60605f600183600181111561370d5761370d613b06565b036137fb575f6060886001600160a01b0316888888604051602401613734939291906148bc565b60408051601f198184030181529181526020820180516001600160e01b03166331c6fcc960e21b1790525161376991906148e4565b5f60405180830381855af49150503d805f81146137a1576040519150601f19603f3d011682016040523d82523d5f602084013e6137a6565b606091505b509092509050816137da578051156137c15780518082602001fd5b6040516318cecad560e01b815260040160405180910390fd5b808060200190518101906137ee91906148fa565b9094509250613873915050565b6040516331c6fcc960e21b81526001600160a01b0388169063c71bf3249061382b908990899089906004016148bc565b5f604051808303815f875af1158015613846573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261386d91908101906148fa565b90925090505b9550959350505050565b5f6001600160e01b0319821663041de68360e41b14806138ac57506001600160e01b03198216621574e360e91b145b806138c757506001600160e01b031982166352d1902d60e01b145b806138e257506001600160e01b0319821663afc5b82360e01b145b80610a185750610a1882613965565b60605f5f856001600160a01b03168560405161390d91906148e4565b5f60405180830381855af49150503d805f8114613945576040519150601f19603f3d011682016040523d82523d5f602084013e61394a565b606091505b509150915061395b86838387613999565b9695505050505050565b5f6001600160e01b03198216634a06561b60e11b1480610a1857506301ffc9a760e01b6001600160e01b0319831614610a18565b60608315613a075782515f03613a00576001600160a01b0385163b613a005760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a5c565b50816128a9565b6128a98383815115613a1c5781518083602001fd5b8060405162461bcd60e51b8152600401610a5c9190613bd0565b60405180606001604052806003906020820280368337509192915050565b5f60208284031215613a64575f5ffd5b81356001600160e01b031981168114611551575f5ffd5b6001600160a01b0381168114610e65575f5ffd5b80356004811061200c575f5ffd5b5f5f5f60608486031215613aaf575f5ffd5b833592506020840135613ac181613a7b565b9150613acf60408501613a8f565b90509250925092565b5f5f60408385031215613ae9575f5ffd5b823591506020830135613afb81613a7b565b809150509250929050565b634e487b7160e01b5f52602160045260245ffd5b60028110610e6557610e65613b06565b60208101613b3783613b1a565b91905290565b6060810181835f5b6003811015613b6757815160ff16835260209283019290910190600101613b45565b50505092915050565b5f60208284031215613b80575f5ffd5b813561155181613a7b565b5f60208284031215613b9b575f5ffd5b5035919050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f6115516020830184613ba2565b5f60c08284031215613bf2575f5ffd5b50919050565b5f60c08284031215613c08575f5ffd5b6115518383613be2565b6020810160038310613b3757613b37613b06565b5f5f5f5f60808587031215613c39575f5ffd5b843593506020850135613c4b81613a7b565b9250613c5960408601613a8f565b9396929550929360600135925050565b634e487b7160e01b5f52604160045260245ffd5b604051606081016001600160401b0381118282101715613c9f57613c9f613c69565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613ccd57613ccd613c69565b604052919050565b5f6001600160401b03821115613ced57613ced613c69565b50601f01601f191660200190565b5f82601f830112613d0a575f5ffd5b8135613d1d613d1882613cd5565b613ca5565b818152846020838601011115613d31575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215613d5e575f5ffd5b8235613d6981613a7b565b915060208301356001600160401b03811115613d83575f5ffd5b613d8f85828601613cfb565b9150509250929050565b5f60408284031215613bf2575f5ffd5b5f60408284031215613db9575f5ffd5b6115518383613d99565b60048110613dd357613dd3613b06565b9052565b5f604082019050613de9828451613dc3565b602092830151919092015290565b5f82825180855260208501945060208160051b830101602085015f5b83811015613e6f57848303601f19018852815180516001600160a01b0316845260208082015190850152604090810151606091850182905290613e5890850182613ba2565b6020998a0199909450929092019150600101613e13565b50909695505050505050565b80516001600160a01b031682526020810151613e9681613b1a565b806020840152505050565b871515815286151560208201525f8651613eba81613b1a565b8060408401525063ffffffff60208801511660608301526001600160401b0360408801511660808301526001600160401b0360608801511660a0830152608087015160c083015260a087015160e0830152613f2d6101008301878051825260208082015190830152604090810151910152565b6101e0610160830152613f446101e0830186613df7565b905083610180830152613f5b6101a0830184613e7b565b98975050505050505050565b60408101610a188284613e7b565b5f5f83601f840112613f85575f5ffd5b5081356001600160401b03811115613f9b575f5ffd5b602083019150836020828501011115613fb2575f5ffd5b9250929050565b5f5f5f5f5f5f6101608789031215613fcf575f5ffd5b8635613fda81613a7b565b95506020870135613fea81613a7b565b9450613ff98860408901613be2565b9350614009886101008901613d99565b92506101408701356001600160401b03811115614024575f5ffd5b61403089828a01613f75565b979a9699509497509295939492505050565b5f6001600160401b0382111561405a5761405a613c69565b5060051b60200190565b6001600160401b0381168114610e65575f5ffd5b803561200c81614064565b5f5f5f5f5f5f60a08789031215614098575f5ffd5b6001600160401b03873511156140ac575f5ffd5b6140b98888358901613f75565b90965094506001600160401b03602088013511156140d5575f5ffd5b6020870135870188601f8201126140ea575f5ffd5b6140f7613d188235614042565b81358082526020808301929160051b8401018b1015614114575f5ffd5b602083015b6020843560051b8501018110156141b9576001600160401b038135111561413e575f5ffd5b803584016060818e03601f19011215614155575f5ffd5b61415d613c7d565b61416a6020830135613a7b565b60208281013582526040830135908201526001600160401b0360608301351115614192575f5ffd5b6141a58e60206060850135850101613cfb565b604082015284525060209283019201614119565b5095506141cb91505060408801614078565b92506141d960608801614078565b91506001600160401b03608088013511156141f2575f5ffd5b6142028860808901358901613cfb565b90509295509295509295565b5f5f6020838503121561421f575f5ffd5b82356001600160401b03811115614234575f5ffd5b61424085828601613f75565b90969095509350505050565b815160c082019061425c81613b1a565b8083525063ffffffff602084015116602083015263ffffffff604084015116604083015263ffffffff60608401511660608301526001600160401b03608084015116608083015260a083015160a083015292915050565b5f602082840312156142c3575f5ffd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610a1857610a186142ca565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082028115828204841417610a1857610a186142ca565b80820180821115610a1857610a186142ca565b604081016143c18285613dc3565b8260208301529392505050565b600181811c908216806143e257607f821691505b602082108103613bf257634e487b7160e01b5f52602260045260245ffd5b60028110610e65575f5ffd5b5f604082840312801561441d575f5ffd5b50604080519081016001600160401b038111828210171561444057614440613c69565b604052823561444e81613a7b565b8152602083013561445e81614400565b60208201529392505050565b5f6020828403121561447a575f5ffd5b815161155181613a7b565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b604081525f6144bf6040830186613df7565b828103602084015261395b818587614485565b634e487b7160e01b5f52603260045260245ffd5b601f82111561252457805f5260205f20601f840160051c8101602085101561450b5750805b601f840160051c820191505b818110156113bf575f8155600101614517565b81516001600160401b0381111561454357614543613c69565b6145578161455184546143ce565b846144e6565b6020601f821160018114614589575f83156145725750848201515b5f19600385901b1c1916600184901b1784556113bf565b5f84815260208120601f198516915b828110156145b85787850151825560209485019460019092019101614598565b50848210156145d557868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b6001600160401b03871681526001600160401b038616602082015260a060408201525f61461560a083018688614485565b82810360608401526146278186613df7565b915050826080830152979650505050505050565b6001600160a01b03868116825285166020820152604081018490526080606082018190525f906136a39083018486614485565b5f6020828403121561467e575f5ffd5b81518015158114611551575f5ffd5b63ffffffff81168114610e65575f5ffd5b5f602082840312156146ae575f5ffd5b81356115518161468d565b5f602082840312156146c9575f5ffd5b813561155181614064565b5f8135610a188161468d565b5f8135610a1881614064565b81356146f781614400565b61470081613b1a565b815460ff821691508160ff198216178355602084013561471f8161468d565b64ffffffff008160081b168364ffffffffff198416171784555050505f604083013561474a8161468d565b825468ffffffff0000000000191660289190911b68ffffffff000000000016178255506147a861477c606084016146d4565b82546cffffffff000000000000000000191660489190911b6cffffffff00000000000000000016178255565b6147e36147b7608084016146e0565b82805467ffffffffffffffff60681b191660689290921b67ffffffffffffffff60681b16919091179055565b60a09190910135600190910155565b5f60208284031215614802575f5ffd5b813561155181614400565b60c0810161481a88613b1a565b96815263ffffffff958616602082015293851660408501529190931660608301526001600160401b03909216608082015260a0015290565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160401b038181168382160190811115610a1857610a186142ca565b838152606060208201525f6148d46060830185613df7565b9050826040830152949350505050565b5f82518060208501845e5f920191825250919050565b5f5f6040838503121561490b575f5ffd5b82516001600160401b03811115614920575f5ffd5b8301601f81018513614930575f5ffd5b805161493e613d1882614042565b8082825260208201915060208360051b85010192508783111561495f575f5ffd5b602084015b838110156149df5780516001600160401b03811115614981575f5ffd5b8501603f81018a13614991575f5ffd5b60208101516149a2613d1882613cd5565b8181526040838301018c10156149b6575f5ffd5b8160408401602083015e5f60208383010152808652505050602083019250602081019050614964565b50602096909601519597959650505050505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220db05efa538f266e08bec7f3a5ae2426d9d502b9abb4d50740fb7f4c66704bf7d64736f6c634300081c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.