ETH Price: $3,854.48 (+1.32%)

Contract

0x195F5A775c366Fbf89E6F95E1465d3c713b1fC55

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AddressGaugeVoter

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 2000 runs

Other Settings:
cancun EvmVersion
File 1 of 28 : AddressGaugeVoter.sol
/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {IClockUser, IClockV1_2_0 as IClock} from "@clock/IClock_v1_2_0.sol";
import {IAddressGaugeVoter} from "./IAddressGaugeVoter.sol";

import {ReentrancyGuardUpgradeable as ReentrancyGuard} from
    "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {PausableUpgradeable as Pausable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {IVotesUpgradeable as IVotes} from "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol";
import {PluginUUPSUpgradeable} from "@aragon/osx-commons-contracts/src/plugin/PluginUUPSUpgradeable.sol";

contract AddressGaugeVoter is IAddressGaugeVoter, IClockUser, ReentrancyGuard, Pausable, PluginUUPSUpgradeable {
    /// @notice The Gauge admin can can create and manage voting gauges for token holders
    bytes32 public constant GAUGE_ADMIN_ROLE = keccak256("GAUGE_ADMIN");

    /// @notice Address of the voting escrow contract that will track voting power
    address public escrow;

    /// @notice Clock contract for epoch duration
    address public clock;

    /// @notice epoch => The total votes that have accumulated in this contract
    mapping(uint256 => uint256) public epochTotalVotingPowerCast;

    /// @notice enumerable list of all gauges that can be voted on
    address[] public gaugeList;

    /// @notice address => gauge data
    mapping(address => Gauge) public gauges;

    /// @notice epoch => gauge => total votes (global)
    mapping(uint256 => mapping(address => uint256)) public epochGaugeVotes;

    /// @dev epoch => address => AddressVoteData
    mapping(uint256 => mapping(address => AddressVoteData)) internal epochVoteData;

    /// @notice Delegation mapper contract
    address public ivotesAdapter;

    /// @notice Activate updateVotingPower hook
    /// @dev This is used to update the voting power of the sender and receiver
    ///      when the delegation mapper is set.
    ///      If the delegation mapper is not set, or the hook is not activated,
    ///      then the voting power will not be updated automatically.
    bool public enableUpdateVotingPowerHook;

    /*///////////////////////////////////////////////////////////////
                            Initialization
    //////////////////////////////////////////////////////////////*/

    constructor() {
        _disableInitializers();
    }

    function initialize(
        address _dao,
        address _escrow,
        bool _startPaused,
        address _clock,
        address _ivotesAdapter,
        bool _enableUpdateVotingPowerHook
    ) external initializer {
        __PluginUUPSUpgradeable_init(IDAO(_dao));
        __ReentrancyGuard_init();
        __Pausable_init();
        escrow = _escrow;
        clock = _clock;
        ivotesAdapter = _ivotesAdapter;
        enableUpdateVotingPowerHook = _enableUpdateVotingPowerHook;
        if (_startPaused) _pause();
    }

    /*///////////////////////////////////////////////////////////////
                            Modifiers
    //////////////////////////////////////////////////////////////*/

    function pause() external auth(GAUGE_ADMIN_ROLE) {
        _pause();
    }

    function unpause() external auth(GAUGE_ADMIN_ROLE) {
        _unpause();
    }

    modifier whenVotingActive() {
        if (!votingActive()) revert VotingInactive();
        _;
    }

    modifier onlyEscrow() {
        if (msg.sender != escrow) revert OnlyEscrow();
        _;
    }

    /*///////////////////////////////////////////////////////////////
                               Voting
    //////////////////////////////////////////////////////////////*/

    function vote(GaugeVote[] calldata _votes) public nonReentrant whenNotPaused whenVotingActive {
        address account = msg.sender;
        _vote(account, _votes);
    }

    /**
     * @dev If `enableUpdateVotingPowerHook` is false, It's assumed that token contract does/can NOT call
     * `updateVotingPower` during transfers This can happen if the token is already deployed and non-upgradeable,
     * or for other design limitations. In such cases, relying on `getVotes(_account)` (which reflects live balance)
     * instead of `getPastVotes(...)` (which snapshots voting power at a fixed time) can lead
     * to critical vulnerabilities, including double voting.
     *
     * Example of the issue:
     * - Ts 100: Epoch begins, voting window opens.
     * - Ts 110: Alice has 1000 votes.
     * - Ts 120: Alice votes for Gauge A with all 1000.
     * - Ts 130: Alice transfers tokens to Bob, but `updateVotingPower` is NOT triggered.
     * - Ts 140: Bob now votes for Gauge B using the same 1000 tokens.
     *
     * Result: The same 1000 tokens were used to vote for *two* gauges in the same epoch — a double spend.
     *
     * To prevent this, we use `getPastVotes(_account, currentEpochStart())`, which ensures voting power is fixed at epoch start.
     * Even if a transfer happens mid-epoch, the recipient (e.g., Bob) cannot vote in that epoch because their `getPastVotes(...)`
     * will return 0.
     *
     * Note: Once a new epoch starts, Bob *can* vote with the transferred tokens, but this is safe.
     * Since gauge vote tracking is scoped per-epoch, votes from Alice in epoch 11 and from Bob in epoch 12 are kept separate.
     * Querying Gauge A’s votes in epoch 12 will correctly return 1000, not 2000 — avoiding any vote inflation.
     */
    function _vote(address _account, GaugeVote[] memory _votes) internal {
        uint256 votingPower = enableUpdateVotingPowerHook
            ? IVotes(ivotesAdapter).getVotes(_account)
            : IVotes(ivotesAdapter).getPastVotes(_account, currentEpochStart());

        if (votingPower == 0) revert NoVotingPower();

        uint256 numVotes = _votes.length;
        if (numVotes == 0) revert NoVotes();

        // clear any existing votes
        if (isVoting(_account)) _reset(_account);

        uint256 epoch = getWriteEpochId();

        // voting power continues to increase over the voting epoch.
        // this means you can revote later in the epoch to increase votes.
        // while not a huge problem, it's worth noting that when rewards are fully
        // on chain, this could be a vector for gaming.
        AddressVoteData storage voteData = epochVoteData[epoch][_account];
        uint256 totalWeight = _getTotalWeight(_votes);

        // this is technically redundant as checks below will revert div by zero
        // but it's clearer to the caller if we revert here
        if (totalWeight == 0) revert NoVotes();

        // iterate over votes and distribute weight
        for (uint256 i = 0; i < numVotes; i++) {
            GaugeVote memory currentVote = _votes[i];
            _safeCastVote(currentVote, epoch, _account, votingPower, totalWeight, voteData);
        }

        voteData.usedVotingPower = votingPower;
        // setting the last voted also has the second-order effect of indicating the user has voted
        voteData.lastVoted = block.timestamp;
    }

    function _safeCastVote(
        GaugeVote memory _currentVote,
        uint256 _epoch,
        address _account,
        uint256 _votingPower,
        uint256 _totalWeights,
        AddressVoteData storage _voteData
    ) internal returns (uint256) {
        // the gauge must exist and be active,
        // it also can't have any votes or we haven't reset properly
        if (!gaugeExists(_currentVote.gauge)) revert GaugeDoesNotExist(_currentVote.gauge);
        if (!isActive(_currentVote.gauge)) revert GaugeInactive(_currentVote.gauge);

        // prevent double voting
        if (_voteData.voteWeights[_currentVote.gauge] != 0) revert DoubleVote();

        // calculate the weight for this gauge
        // No votes can happen with extreme weight discrepancies and/or small
        // voting power, in which case caller should adjust weights accordingly
        uint256 normWeight = _normalizedWeight(_currentVote.weight, _totalWeights);
        if (normWeight == 0) revert NoVotes();

        return _castVote(_currentVote.gauge, _epoch, _account, _votingPower, normWeight, _voteData);
    }

    /// @notice Cast the vote of an tokenId to a specific gauge
    /// @dev This function doesn't do any safety checks and it's up to caller to do validations.
    ///      If you wish to have validations, see `_safeCastVote`.
    /// @dev _voteWeight must be normalized to 1e36 precision.
    function _castVote(
        address _gauge,
        uint256 _epoch,
        address _account,
        uint256 _votingPower,
        uint256 _voteWeight,
        AddressVoteData storage _voteData
    ) internal returns (uint256) {
        uint256 _votes = _votesForGauge(_voteWeight, _votingPower);

        // record the vote for the token
        _voteData.gaugesVotedFor.push(_gauge);
        _voteData.voteWeights[_gauge] += _voteWeight;

        // update the total weights accruing to this gauge
        epochGaugeVotes[_epoch][_gauge] += _votes;
        epochTotalVotingPowerCast[_epoch] += _votes;

        emit Voted({
            voter: _account,
            gauge: _gauge,
            epoch: epochId(),
            votingPowerCastForGauge: _votes,
            totalVotingPowerInGauge: epochGaugeVotes[_epoch][_gauge],
            totalVotingPowerInContract: epochTotalVotingPowerCast[_epoch],
            timestamp: block.timestamp
        });

        return _votes;
    }

    function reset() external nonReentrant whenNotPaused whenVotingActive {
        if (!isVoting(msg.sender)) revert NotCurrentlyVoting();
        _reset(msg.sender);
    }

    function _reset(address _account) internal {
        uint256 epoch = getWriteEpochId();
        AddressVoteData storage voteData = epochVoteData[epoch][_account];
        address[] storage pastVotes = voteData.gaugesVotedFor;

        // iterate over all the gauges voted for and reset the votes
        for (uint256 i = 0; i < pastVotes.length; i++) {
            address gauge = pastVotes[i];
            uint256 _voteWeight = voteData.voteWeights[gauge];
            uint256 _votes = _votesForGauge(_voteWeight, voteData.usedVotingPower);

            // remove from the total globals
            epochGaugeVotes[epoch][gauge] -= _votes;
            epochTotalVotingPowerCast[epoch] -= _votes;

            delete voteData.voteWeights[gauge];

            emit Reset({
                voter: _account,
                gauge: gauge,
                epoch: epochId(),
                votingPowerRemovedFromGauge: _votes,
                totalVotingPowerInGauge: epochGaugeVotes[epoch][gauge],
                totalVotingPowerInContract: epochTotalVotingPowerCast[epoch],
                timestamp: block.timestamp
            });
        }

        // reset the global state variables we don't need
        voteData.usedVotingPower = 0;
        voteData.lastVoted = 0;
        voteData.gaugesVotedFor = new address[](0);
    }

    function _updateVotingPower(address _account) internal {
        if (!enableUpdateVotingPowerHook) revert UpdateVotingPowerHookNotEnabled();
        // Skip as `_account` hasn't voted so no need to update it.
        if (!isVoting(_account)) return;

        uint256 epoch = getWriteEpochId();
        AddressVoteData storage voteData = epochVoteData[epoch][_account];

        // In case no pastVotes exist for an account,
        // skip as there's nothing to update.
        address[] storage pastVotes = voteData.gaugesVotedFor;
        if (pastVotes.length == 0) return;

        uint256 votingPower = IVotes(ivotesAdapter).getVotes(_account);

        // After the voting window closes, votes shouldn't be auto-recast via _updateVotingPower.
        // But if a user loses voting power (e.g., had 100, now 0),
        // gauges must reflect this drop to avoid overstated voting power.
        // If a user's voting power increases (e.g., 100 → 150),
        // we *don't* auto-recast—doing so would inflate gauge power post-window.
        // So: decrease → auto-adjust gauges; increase → ignored
        // unless user manually votes when window reopens.
        if (voteData.usedVotingPower < votingPower) return;

        GaugeVote[] memory newVoteData = new GaugeVote[](pastVotes.length);

        // cast new votes again.
        for (uint256 i = 0; i < pastVotes.length; i++) {
            address gauge = pastVotes[i];
            uint256 _votes = voteData.voteWeights[gauge];
            newVoteData[i] = GaugeVote(_votes, gauge);
        }

        // Note that even if votingPower is 0, this still records.
        uint256 totalWeight = _getTotalWeight(newVoteData);

        // Reset all votes of `_account` to zero.
        _reset(_account);

        // Re-cast the votes with the new voting power.
        for (uint256 i = 0; i < newVoteData.length; i++) {
            _castVote(
                newVoteData[i].gauge,
                epoch,
                _account,
                votingPower,
                _normalizedWeight(newVoteData[i].weight, totalWeight),
                voteData
            );
        }

        voteData.usedVotingPower = votingPower;
        voteData.lastVoted = block.timestamp;
    }

    function updateVotingPower(address _from, address _to) external onlyEscrow {
        // update the voting power of the sender
        _updateVotingPower(_from);

        // This means that account's delegate is itself,
        // so it's enough to only update votes once.
        if (_from == _to) return;

        // update the voting power of the receiver
        _updateVotingPower(_to);
    }

    function _getTotalWeight(GaugeVote[] memory _votes) internal view virtual returns (uint256) {
        uint256 total = 0;

        for (uint256 i = 0; i < _votes.length; i++) {
            total += _votes[i].weight;
        }

        return total;
    }

    /// @dev Scales weights as percentage of total weight and then to 1e36 precision
    function _normalizedWeight(uint256 _weight, uint256 _totalWeight) internal view virtual returns (uint256) {
        return (_weight * 1e36) / _totalWeight;
    }

    /// @dev Calculates the votes for a gauge based on weight and voting power.
    ///      We assume the weight is already normalized to 1e36 precision.
    function _votesForGauge(uint256 _weight, uint256 _votingPower) internal view virtual returns (uint256) {
        return (_weight * _votingPower) / 1e36;
    }

    /// @notice This function is used to get the epoch id in the case of delegation mapper
    /// does not exist or the hook is not activated.
    function getWriteEpochId() public view returns (uint256) {
        return enableUpdateVotingPowerHook ? 0 : epochId();
    }

    /*///////////////////////////////////////////////////////////////
                            Gauge Management
    //////////////////////////////////////////////////////////////*/

    function gaugeExists(address _gauge) public view returns (bool) {
        // this doesn't revert if you create multiple gauges at genesis
        // but that's not a practical concern
        return gauges[_gauge].created > 0;
    }

    function isActive(address _gauge) public view returns (bool) {
        return gauges[_gauge].active;
    }

    function createGauge(address _gauge, string calldata _metadataURI) external nonReentrant returns (address gauge) {
        if (_gauge == address(0)) revert ZeroGauge();
        if (gaugeExists(_gauge)) revert GaugeExists();

        gauges[_gauge] = Gauge(true, block.timestamp, _metadataURI);
        gaugeList.push(_gauge);

        emit GaugeCreated(_gauge, msg.sender, _metadataURI);
        return _gauge;
    }

    function deactivateGauge(address _gauge) external auth(GAUGE_ADMIN_ROLE) {
        if (!gaugeExists(_gauge)) revert GaugeDoesNotExist(_gauge);
        if (!isActive(_gauge)) revert GaugeActivationUnchanged();
        gauges[_gauge].active = false;
        emit GaugeDeactivated(_gauge);
    }

    function activateGauge(address _gauge) external auth(GAUGE_ADMIN_ROLE) {
        if (!gaugeExists(_gauge)) revert GaugeDoesNotExist(_gauge);
        if (isActive(_gauge)) revert GaugeActivationUnchanged();
        gauges[_gauge].active = true;
        emit GaugeActivated(_gauge);
    }

    function updateGaugeMetadata(address _gauge, string calldata _metadataURI) external auth(GAUGE_ADMIN_ROLE) {
        if (!gaugeExists(_gauge)) revert GaugeDoesNotExist(_gauge);
        gauges[_gauge].metadataURI = _metadataURI;
        emit GaugeMetadataUpdated(_gauge, _metadataURI);
    }

    /*///////////////////////////////////////////////////////////////
                                Setters
    //////////////////////////////////////////////////////////////*/

    function setEnableUpdateVotingPowerHook(bool _enableUpdateVotingPowerHook) external auth(GAUGE_ADMIN_ROLE) {
        enableUpdateVotingPowerHook = _enableUpdateVotingPowerHook;
    }

    function setIVotesAdapter(address _ivotesAdapter) external {
        ivotesAdapter = _ivotesAdapter;
    }

    /*///////////////////////////////////////////////////////////////
                          Getters: Epochs & Time
    //////////////////////////////////////////////////////////////*/

    /// @notice autogenerated epoch id based on elapsed time
    function epochId() public view returns (uint256) {
        return IClock(clock).currentEpoch();
    }

    /// @notice whether voting is active in the current epoch
    function votingActive() public view returns (bool) {
        return IClock(clock).votingActive();
    }

    /// @notice timestamp of the start of the next epoch
    function currentEpochStart() public view returns (uint256) {
        return IClock(clock).epochStartTs() - IClock(clock).epochDuration();
    }

    /// @notice timestamp of the start of the next epoch
    function epochStart() external view returns (uint256) {
        return IClock(clock).epochStartTs();
    }

    /// @notice timestamp of the start of the next voting period
    function epochVoteStart() external view returns (uint256) {
        return IClock(clock).epochVoteStartTs();
    }

    /// @notice timestamp of the end of the current voting period
    function epochVoteEnd() external view returns (uint256) {
        return IClock(clock).epochVoteEndTs();
    }

    /*///////////////////////////////////////////////////////////////
                            Getters: Mappings
    //////////////////////////////////////////////////////////////*/

    function getGauge(address _gauge) external view returns (Gauge memory) {
        return gauges[_gauge];
    }

    function getAllGauges() external view returns (address[] memory) {
        return gaugeList;
    }

    function isVoting(address _address) public view returns (bool) {
        uint256 epoch = getWriteEpochId();
        return epochVoteData[epoch][_address].lastVoted > 0;
    }

    function votes(address _address, address _gauge) external view returns (uint256) {
        uint256 epoch = getWriteEpochId();
        return _votesForGauge(
            epochVoteData[epoch][_address].voteWeights[_gauge], epochVoteData[epoch][_address].usedVotingPower
        );
    }

    function gaugesVotedFor(address _address) external view returns (address[] memory) {
        uint256 epoch = getWriteEpochId();
        return epochVoteData[epoch][_address].gaugesVotedFor;
    }

    function usedVotingPower(address _address) external view returns (uint256) {
        uint256 epoch = getWriteEpochId();
        return epochVoteData[epoch][_address].usedVotingPower;
    }

    function totalVotingPowerCast() public view returns (uint256) {
        uint256 epoch = getWriteEpochId();
        return epochTotalVotingPowerCast[epoch];
    }

    function gaugeVotes(address _address) public view returns (uint256) {
        uint256 epoch = getWriteEpochId();
        return epochGaugeVotes[epoch][_address];
    }

    /// @dev Consumer's responsibility to ensure that `_epoch` exists.
    function gaugeVotes(uint256 _epoch, address _address) public view returns (uint256) {
        return epochGaugeVotes[_epoch][_address];
    }

    /// @dev Reserved storage space to allow for layout changes in the future.
    uint256[42] private __gap;
}

// 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;
}

/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IClock.sol";

interface IClockV1_2_0 is IClock {
    function epochPrevCheckpointTs() external view returns (uint256);

    function resolveEpochPrevCheckpointTs(uint256 timestamp) external pure returns (uint256);
}

/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IGaugeVoter.sol";

interface IAddressGaugeVote {
    /// @param votes gauge => votes cast at that time
    /// @param gaugesVotedFor array of gauges we have active votes for
    /// @param usedVotingPower total voting power used at the time of the vote
    /// @dev this changes so we need an historic snapshot
    /// @param lastVoted is the last time the user voted
    struct AddressVoteData {
        mapping(address => uint256) voteWeights;
        address[] gaugesVotedFor;
        uint256 usedVotingPower;
        uint256 lastVoted;
    }

    /// @param weight proportion of voting power the address will allocate to the gauge. Will be normalised.
    /// @param gauge address of the gauge to vote for
    struct GaugeVote {
        uint256 weight;
        address gauge;
    }
}

/*///////////////////////////////////////////////////////////////
                            Gauge Voter
//////////////////////////////////////////////////////////////*/

interface IAddressGaugeVoterEvents {
    /// @param votingPowerCastForGauge votes cast by this address for this gauge in this vote
    /// @param totalVotingPowerInGauge total voting power in the gauge at the time of the vote, after applying the vote
    /// @param totalVotingPowerInContract total voting power in the contract at the time of the vote, after applying the vote
    event Voted(
        address indexed voter,
        address indexed gauge,
        uint256 indexed epoch,
        uint256 votingPowerCastForGauge,
        uint256 totalVotingPowerInGauge,
        uint256 totalVotingPowerInContract,
        uint256 timestamp
    );

    /// @param votingPowerRemovedFromGauge votes removed by this address for this gauge, at the time of this rest
    /// @param totalVotingPowerInGauge total voting power in the gauge at the time of the reset, after applying the reset
    /// @param totalVotingPowerInContract total voting power in the contract at the time of the reset, after applying the reset
    event Reset(
        address indexed voter,
        address indexed gauge,
        uint256 indexed epoch,
        uint256 votingPowerRemovedFromGauge,
        uint256 totalVotingPowerInGauge,
        uint256 totalVotingPowerInContract,
        uint256 timestamp
    );
}

interface IAddressGaugeVoterErrors {
    error VotingInactive();
    error NotApprovedOrOwner();
    error GaugeDoesNotExist(address _pool);
    error GaugeInactive(address _gauge);
    error DoubleVote();
    error NoVotes();
    error NoVotingPower();
    error NotCurrentlyVoting();
    error OnlyEscrow();
    error UpdateVotingPowerHookNotEnabled();
    error AlreadyVoted(address _address);
}

interface IAddressGaugeVoter is
    IAddressGaugeVoterEvents,
    IAddressGaugeVoterErrors,
    IAddressGaugeVote,
    IGaugeManager,
    IGauge
{
    /// @notice Called by users to vote for pools. Votes distributed proportionally based on weights.
    /// @param _votes       Array of votes to be cast, contains gauge address and weight.
    function vote(GaugeVote[] memory _votes) external;

    /// @notice Called by users to reset voting state. Required when withdrawing or transferring veNFT.
    function reset() external;

    /// @notice Can be called to check if an address is currently voting
    function isVoting(address _address) external view returns (bool);

    function updateVotingPower(address _from, address _to) external;
}

/*///////////////////////////////////////////////////////////////
                      Address Gauge Voter
//////////////////////////////////////////////////////////////*/

interface IAddressGaugeVoterStorageEventsErrors is
    IGaugeManagerEvents,
    IGaugeManagerErrors,
    IAddressGaugeVoterEvents,
    IAddressGaugeVoterErrors
{

}

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

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

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }

    /**
     * @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[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

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

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

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @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[49] private __gap;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/IVotes.sol)
pragma solidity ^0.8.0;

/**
 * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
 *
 * _Available since v4.5._
 */
interface IVotesUpgradeable {
    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);

    /**
     * @dev Returns the current amount of votes that `account` has.
     */
    function getVotes(address account) external view returns (uint256);

    /**
     * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     */
    function getPastVotes(address account, uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     *
     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
     * Votes that have not been delegated are still part of total supply, even though they would not participate in a
     * vote.
     */
    function getPastTotalSupply(uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the delegate that `account` has chosen.
     */
    function delegates(address account) external view returns (address);

    /**
     * @dev Delegates votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) external;

    /**
     * @dev Delegates votes from signer to `delegatee`.
     */
    function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
}

// 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 "../utils/versioning/IProtocolVersion.sol";
import {ProtocolVersion} from "../utils/versioning/ProtocolVersion.sol";
import {DaoAuthorizableUpgradeable} from "../permission/auth/DaoAuthorizableUpgradeable.sol";
import {IPlugin} from "./IPlugin.sol";
import {IDAO} from "../dao/IDAO.sol";
import {IExecutor, Action} from "../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 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: MIT
pragma solidity ^0.8.0;

interface IClockUser {
    function clock() external view returns (address);
}

interface IClock {
    function epochDuration() external pure returns (uint256);

    function checkpointInterval() external pure returns (uint256);

    function voteDuration() external pure returns (uint256);

    function voteWindowBuffer() external pure returns (uint256);

    function currentEpoch() external view returns (uint256);

    function resolveEpoch(uint256 timestamp) external pure returns (uint256);

    function elapsedInEpoch() external view returns (uint256);

    function resolveElapsedInEpoch(uint256 timestamp) external pure returns (uint256);

    function epochStartsIn() external view returns (uint256);

    function resolveEpochStartsIn(uint256 timestamp) external pure returns (uint256);

    function epochStartTs() external view returns (uint256);

    function resolveEpochStartTs(uint256 timestamp) external pure returns (uint256);

    function votingActive() external view returns (bool);

    function resolveVotingActive(uint256 timestamp) external pure returns (bool);

    function epochVoteStartsIn() external view returns (uint256);

    function resolveEpochVoteStartsIn(uint256 timestamp) external pure returns (uint256);

    function epochVoteStartTs() external view returns (uint256);

    function resolveEpochVoteStartTs(uint256 timestamp) external pure returns (uint256);

    function epochVoteEndsIn() external view returns (uint256);

    function resolveEpochVoteEndsIn(uint256 timestamp) external pure returns (uint256);

    function epochVoteEndTs() external view returns (uint256);

    function resolveEpochVoteEndTs(uint256 timestamp) external pure returns (uint256);

    function epochNextCheckpointIn() external view returns (uint256);

    function resolveEpochNextCheckpointIn(uint256 timestamp) external pure returns (uint256);

    function epochNextCheckpointTs() external view returns (uint256);

    function resolveEpochNextCheckpointTs(uint256 timestamp) external pure returns (uint256);
}

/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IGauge {
    /// @param metadataURI URI for the metadata of the gauge
    struct Gauge {
        bool active;
        uint256 created; // timestamp or epoch
        string metadataURI;
        // more space for data as this is a struct in a mapping
    }
}

/*///////////////////////////////////////////////////////////////
                            Gauge Manager
//////////////////////////////////////////////////////////////*/

interface IGaugeManagerEvents {
    event GaugeCreated(address indexed gauge, address indexed creator, string metadataURI);
    event GaugeDeactivated(address indexed gauge);
    event GaugeActivated(address indexed gauge);
    event GaugeMetadataUpdated(address indexed gauge, string metadataURI);
}

interface IGaugeManagerErrors {
    error ZeroGauge();
    error GaugeActivationUnchanged();
    error GaugeExists();
}

interface IGaugeManager is IGaugeManagerEvents, IGaugeManagerErrors {
    function isActive(address gauge) external view returns (bool);

    function createGauge(address _gauge, string calldata _metadata) external returns (address);

    function deactivateGauge(address _gauge) external;

    function activateGauge(address _gauge) external;

    function updateGaugeMetadata(address _gauge, string calldata _metadata) external;
}

// 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: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../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;
    }

    /**
     * @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/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./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 {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @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");
        _;
    }

    /**
     * @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 14 of 28 : 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 v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../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) (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 17 of 28 : 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 18 of 28 : 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 19 of 28 : 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;
}

File 20 of 28 : 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);
}

File 21 of 28 : 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);
}

// 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 (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 "../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 {
    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // 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;

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

File 25 of 28 : 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 26 of 28 : 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 27 of 28 : 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": [
    "@clock/=lib/ve-governance/src/clock/",
    "@curve/=lib/ve-governance/src/curve/",
    "@delegation/=lib/ve-governance/src/delegation/",
    "@escrow-interfaces/=lib/ve-governance/src/escrow/increasing/interfaces/",
    "@escrow/=lib/ve-governance/src/escrow/",
    "@factory/=lib/ve-governance/src/factory/",
    "@foundry-upgrades/=lib/ve-governance/lib/openzeppelin-foundry-upgrades/src/",
    "@helpers/=lib/ve-governance/test/helpers/",
    "@interfaces/=lib/ve-governance/src/interfaces/",
    "@libs/=lib/ve-governance/src/libs/",
    "@lock/=lib/ve-governance/src/lock/",
    "@mocks/=lib/ve-governance/test/mocks/",
    "@openzeppelin/contracts-upgradeable/=lib/ve-governance/lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/ve-governance/lib/openzeppelin-contracts/contracts/",
    "@queue/=lib/ve-governance/src/queue/",
    "@setup/=lib/ve-governance/src/setup/",
    "@solmate/=lib/ve-governance/lib/solmate/src/",
    "@utils/=lib/ve-governance/src/utils/",
    "@voting/=lib/ve-governance/src/voting/",
    "@ve/=lib/ve-governance/src/",
    "@aragon/protocol-factory/=lib/protocol-factory/",
    "@openzeppelin/openzeppelin-foundry-upgrades/=lib/staged-proposal-processor-plugin/node_modules/@openzeppelin/openzeppelin-foundry-upgrades/src/",
    "@ensdomains/buffer/=lib/protocol-factory/lib/buffer/",
    "@ensdomains/ens-contracts/=lib/protocol-factory/lib/ens-contracts/",
    "@merkl/=lib/merkl/contracts/",
    "@aragon/osx-commons-contracts/=lib/osx-commons/contracts/",
    "@aragon/osx/=lib/ve-governance/lib/osx/packages/contracts/src/",
    "@aragon/multisig-plugin/=lib/protocol-factory/lib/multisig-plugin/packages/contracts/src/",
    "@aragon/admin-plugin/=lib/protocol-factory/lib/admin-plugin/packages/contracts/src/",
    "@aragon/admin/=lib/ve-governance/lib/osx/packages/contracts/src/plugins/governance/admin/",
    "@aragon/multisig/=lib/ve-governance/lib/multisig-plugin/packages/contracts/",
    "@aragon/staged-proposal-processor-plugin/=lib/protocol-factory/lib/staged-proposal-processor-plugin/src/",
    "@aragon/token-voting-plugin/=lib/protocol-factory/lib/token-voting-plugin/src/",
    "@test/=lib/ve-governance/test/",
    "admin-plugin/=lib/protocol-factory/lib/admin-plugin/",
    "buffer/=lib/protocol-factory/lib/buffer/contracts/",
    "ds-test/=lib/ve-governance/lib/ds-test/src/",
    "ens-contracts/=lib/ve-governance/lib/ens-contracts/contracts/",
    "erc4626-tests/=lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
    "merkl/=lib/merkl/",
    "multisig-plugin/=lib/ve-governance/lib/multisig-plugin/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/ve-governance/lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/ve-governance/lib/openzeppelin-contracts-upgradeable/contracts/",
    "osx-commons/=lib/osx-commons/",
    "osx/=lib/osx/",
    "oz/=lib/merkl/node_modules/@openzeppelin/contracts/",
    "plugin-version-1.3/=lib/protocol-factory/lib/token-voting-plugin/lib/plugin-version-1.3/",
    "protocol-factory/=lib/protocol-factory/",
    "solidity-stringutils/=lib/protocol-factory/lib/staged-proposal-processor-plugin/node_modules/solidity-stringutils/",
    "solmate/=lib/ve-governance/lib/solmate/src/",
    "staged-proposal-processor-plugin/=lib/protocol-factory/lib/staged-proposal-processor-plugin/src/",
    "token-voting-plugin/=lib/protocol-factory/lib/token-voting-plugin/",
    "utils/=lib/ve-governance/test/utils/",
    "ve-governance/=lib/ve-governance/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 2000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "none",
    "appendCBOR": false
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"AlreadyVoted","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":[],"name":"DelegateCallFailed","type":"error"},{"inputs":[],"name":"DoubleVote","type":"error"},{"inputs":[],"name":"GaugeActivationUnchanged","type":"error"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"GaugeDoesNotExist","type":"error"},{"inputs":[],"name":"GaugeExists","type":"error"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"GaugeInactive","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":"NoVotes","type":"error"},{"inputs":[],"name":"NoVotingPower","type":"error"},{"inputs":[],"name":"NotApprovedOrOwner","type":"error"},{"inputs":[],"name":"NotCurrentlyVoting","type":"error"},{"inputs":[],"name":"OnlyEscrow","type":"error"},{"inputs":[],"name":"UpdateVotingPowerHookNotEnabled","type":"error"},{"inputs":[],"name":"VotingInactive","type":"error"},{"inputs":[],"name":"ZeroGauge","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":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"string","name":"metadataURI","type":"string"}],"name":"GaugeCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"}],"name":"GaugeDeactivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":false,"internalType":"string","name":"metadataURI","type":"string"}],"name":"GaugeMetadataUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"votingPowerRemovedFromGauge","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalVotingPowerInGauge","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalVotingPowerInContract","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Reset","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"address","name":"gauge","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"votingPowerCastForGauge","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalVotingPowerInGauge","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalVotingPowerInContract","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"Voted","type":"event"},{"inputs":[],"name":"GAUGE_ADMIN_ROLE","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":"UPGRADE_PLUGIN_PERMISSION_ID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"activateGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"clock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"string","name":"_metadataURI","type":"string"}],"name":"createGauge","outputs":[{"internalType":"address","name":"gauge","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentEpochStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"contract IDAO","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"deactivateGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableUpdateVotingPowerHook","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"epochGaugeVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"epochTotalVotingPowerCast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochVoteEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochVoteStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"escrow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"gaugeExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gaugeList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epoch","type":"uint256"},{"internalType":"address","name":"_address","type":"address"}],"name":"gaugeVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"gaugeVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gauges","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"created","type":"uint256"},{"internalType":"string","name":"metadataURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"gaugesVotedFor","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllGauges","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","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":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"getGauge","outputs":[{"components":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"created","type":"uint256"},{"internalType":"string","name":"metadataURI","type":"string"}],"internalType":"struct IGauge.Gauge","name":"","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":[],"name":"getWriteEpochId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_dao","type":"address"},{"internalType":"address","name":"_escrow","type":"address"},{"internalType":"bool","name":"_startPaused","type":"bool"},{"internalType":"address","name":"_clock","type":"address"},{"internalType":"address","name":"_ivotesAdapter","type":"address"},{"internalType":"bool","name":"_enableUpdateVotingPowerHook","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isVoting","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ivotesAdapter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pluginType","outputs":[{"internalType":"enum IPlugin.PluginType","name":"","type":"uint8"}],"stateMutability":"pure","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":[],"name":"reset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enableUpdateVotingPowerHook","type":"bool"}],"name":"setEnableUpdateVotingPowerHook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ivotesAdapter","type":"address"}],"name":"setIVotesAdapter","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":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVotingPowerCast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"string","name":"_metadataURI","type":"string"}],"name":"updateGaugeMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"updateVotingPower","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":"address","name":"_address","type":"address"}],"name":"usedVotingPower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"address","name":"gauge","type":"address"}],"internalType":"struct IAddressGaugeVote.GaugeVote[]","name":"_votes","type":"tuple[]"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"address","name":"_gauge","type":"address"}],"name":"votes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

60a06040523060805234801562000014575f80fd5b506200001f6200002f565b620000296200002f565b620000ed565b5f54610100900460ff16156200009b5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff90811614620000eb575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516140aa620001225f395f8181610fba015281816110500152818161127e01528181611314015261140a01526140aa5ff3fe60806040526004361061033a575f3560e01c806391ddadf4116101b2578063bda46ea9116100f2578063dd63c06f11610092578063e79e5a231161006d578063e79e5a23146109c2578063ecc44a38146109f5578063f0363ae414610a09578063fdd644d814610a1d575f80fd5b8063dd63c06f1461096f578063e284b4ee14610983578063e2fdcc17146109a2575f80fd5b8063c9c4bfca116100cd578063c9c4bfca146108dd578063cad1b90614610910578063d19d5ac71461092f578063d826f88f1461095b575f80fd5b8063bda46ea914610861578063c946c5cc1461089b578063c98425ee146108bc575f80fd5b8063abdb84e71161015d578063b4b1013c11610138578063b4b1013c146107d6578063b6a212ab146107f5578063b9a09fd514610814578063bb225da214610842575f80fd5b8063abdb84e714610741578063ad288fe81461078b578063b1c6f0e9146107aa575f80fd5b80639ef13a411161018d5780639ef13a41146106d65780639f8a13d7146106f5578063aa9bbc0c1461072d575f80fd5b806391ddadf41461065f5780639490895d1461067f5780639593c7ef1461069f575f80fd5b806341de68301161027d5780635f8dd6491161022857806367ebd57c1161020357806367ebd57c146105b757806382bbad24146105f95780638456cb59146106185780638cb750591461062c575f80fd5b80635f8dd6491461056557806361a8c8c41461058457806366dcecf314610598575f80fd5b806352d1902d1161025857806352d1902d146105265780635c60da1b1461053a5780635c975abb1461054e575f80fd5b806341de6830146104e55780634cea22f1146104ff5780634f1ef28614610513575f80fd5b806323303c6f116102e85780633659cfe6116102c35780633659cfe6146104805780633f4ba83a1461049f578063408e2727146104b35780634162169f146104c7575f80fd5b806323303c6f146104215780632a63061a146104405780632ae9c6001461045f575f80fd5b8063118f14c711610318578063118f14c7146103ca57806315e5a1e5146103eb57806317125b3b1461040d575f80fd5b806301ffc9a71461033e578063071d2171146103725780630a29e4c0146103a9575b5f80fd5b348015610349575f80fd5b5061035d6103583660046137ea565b610a3c565b60405190151581526020015b60405180910390f35b34801561037d575f80fd5b5061039161038c366004613827565b610b27565b6040516001600160a01b039091168152602001610369565b3480156103b4575f80fd5b506103c86103c33660046138a3565b610d07565b005b3480156103d5575f80fd5b506101985461035d90600160a01b900460ff1681565b3480156103f6575f80fd5b506103ff610d7c565b604051908152602001610369565b348015610418575f80fd5b506103ff610e06565b34801561042c575f80fd5b506103c861043b3660046138d4565b610e27565b34801561044b575f80fd5b506103ff61045a3660046138d4565b610f4e565b34801561046a575f80fd5b50610473610f87565b60405161036991906138ed565b34801561048b575f80fd5b506103c861049a3660046138d4565b610fb0565b3480156104aa575f80fd5b506103c861114c565b3480156104be575f80fd5b5061035d61118e565b3480156104d2575f80fd5b5061012d546001600160a01b0316610391565b3480156104f0575f80fd5b505f6040516103699190613934565b34801561050a575f80fd5b506103ff611213565b6103c86105213660046139bc565b611274565b348015610531575f80fd5b506103ff6113fe565b348015610545575f80fd5b506103916114c2565b348015610559575f80fd5b5060fb5460ff1661035d565b348015610570575f80fd5b5061035d61057f3660046138d4565b6114f4565b34801561058f575f80fd5b506103ff61152f565b3480156105a3575f80fd5b506103c86105b2366004613a69565b611633565b3480156105c2575f80fd5b506103ff6105d1366004613adf565b5f918252610196602090815260408084206001600160a01b0393909316845291905290205490565b348015610604575f80fd5b506103c86106133660046138d4565b6117ec565b348015610623575f80fd5b506103c8611906565b348015610637575f80fd5b506103ff7f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f781565b34801561066a575f80fd5b5061019254610391906001600160a01b031681565b34801561068a575f80fd5b5061019854610391906001600160a01b031681565b3480156106aa575f80fd5b506103ff6106b9366004613adf565b61019660209081525f928352604080842090915290825290205481565b3480156106e1575f80fd5b506103ff6106f03660046138d4565b611948565b348015610700575f80fd5b5061035d61070f3660046138d4565b6001600160a01b03165f908152610195602052604090205460ff1690565b348015610738575f80fd5b506103ff61197e565b34801561074c575f80fd5b506103c861075b3660046138d4565b610198805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b348015610796575f80fd5b506103c86107a5366004613827565b6119df565b3480156107b5575f80fd5b506107c96107c43660046138d4565b611acd565b6040516103699190613b4d565b3480156107e1575f80fd5b506103916107f0366004613b7d565b611bba565b348015610800575f80fd5b506103c861080f366004613b94565b611be3565b34801561081f575f80fd5b5061083361082e3660046138d4565b611c9a565b60405161036993929190613c03565b34801561084d575f80fd5b506103c861085c366004613c2c565b611d47565b34801561086c575f80fd5b5061035d61087b3660046138d4565b6001600160a01b03165f9081526101956020526040902060010154151590565b3480156108a6575f80fd5b506108af611d98565b6040516103699190613c42565b3480156108c7575f80fd5b506108d0611df9565b6040516103699190613c8e565b3480156108e8575f80fd5b506103ff7f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f581565b34801561091b575f80fd5b506103ff61092a3660046138a3565b611e60565b34801561093a575f80fd5b506103ff610949366004613b7d565b6101936020525f908152604090205481565b348015610966575f80fd5b506103c8611ebc565b34801561097a575f80fd5b506108d0611f5d565b34801561098e575f80fd5b506103c861099d366004613cc2565b61200c565b3480156109ad575f80fd5b5061019154610391906001600160a01b031681565b3480156109cd575f80fd5b506103ff7ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201481565b348015610a00575f80fd5b506103ff612081565b348015610a14575f80fd5b506103ff6120e2565b348015610a28575f80fd5b506108af610a373660046138d4565b612101565b5f6001600160e01b031982167f41de6830000000000000000000000000000000000000000000000000000000001480610a9e57506001600160e01b031982167f2ae9c60000000000000000000000000000000000000000000000000000000000145b80610ad257506001600160e01b031982167f52d1902d00000000000000000000000000000000000000000000000000000000145b80610b0657506001600160e01b031982167fafc5b82300000000000000000000000000000000000000000000000000000000145b80610b2157506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f610b3061218d565b6001600160a01b038416610b70576040517f32e63e4400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384165f908152610195602052604090206001015415610bc3576040517f91fc82b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051806060016040528060011515815260200142815260200184848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201829052509390945250506001600160a01b038716815261019560209081526040918290208451815460ff1916901515178155908401516001820155908301519091506002820190610c5b9082613d53565b505061019480546001810182555f919091527fa6f1ac7ad7b125ba5a5e1c96b00ad6914f90a503b1ac3d85a9dadbb4c639df9201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387169081179091556040513392507fe72b86315c30bd1bf352c4cf97594ba793f3e31b74bc874ce47ede0df6920ae990610ced9087908790613e38565b60405180910390a35082610d0060018055565b9392505050565b610191546001600160a01b03163314610d4c576040517f1a0831da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d55826121ec565b806001600160a01b0316826001600160a01b03160315610d7857610d78816121ec565b5050565b61019254604080517fc75dd54100000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163c75dd5419160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e019190613e4b565b905090565b610198545f90600160a01b900460ff16610e2257610e0161197e565b505f90565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490610e65906001600160a01b031630335b845f36612490565b6001600160a01b0382165f9081526101956020526040902060010154610eae57604051634c89018560e01b81526001600160a01b03831660048201526024015b60405180910390fd5b6001600160a01b0382165f908152610195602052604090205460ff1615610f01576040517fcf12acdd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f8181526101956020526040808220805460ff19166001179055517f34521f8891f6149b4baf837b8eea01eeefc28708be34ac8e705484dd34dde8189190a25050565b5f80610f58610e06565b5f908152610197602090815260408083206001600160a01b039096168352949052929092206002015492915050565b610f8f613748565b506040805160608101825260018152600460208201525f9181019190915290565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361104e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610ea5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110a97f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146111255760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610ea5565b61112e8161257c565b604080515f80825260208201909252611149918391906125b6565b50565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611186906001600160a01b03163033610e5d565b61114961275b565b61019254604080517f408e272700000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163408e27279160048083019260209291908290030181865afa1580156111ef573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e019190613e62565b61019254604080517f51b7d39900000000000000000000000000000000000000000000000000000000815290515f926001600160a01b0316916351b7d3999160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036113125760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610ea5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661136d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146113e95760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610ea5565b6113f28261257c565b610d78828260016125b6565b5f306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461149d5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610ea5565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b5f610e017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b5f806114fe610e06565b5f908152610197602090815260408083206001600160a01b0390961683529490529290922060030154151592915050565b61019254604080517f4ff0876a00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b031691634ff0876a9160048083019260209291908290030181865afa158015611590573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115b49190613e4b565b6101925f9054906101000a90046001600160a01b03166001600160a01b031663c75dd5416040518163ffffffff1660e01b8152600401602060405180830381865afa158015611605573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116299190613e4b565b610e019190613e91565b5f54610100900460ff161580801561165157505f54600160ff909116105b8061166a5750303b15801561166a57505f5460ff166001145b6116dc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610ea5565b5f805460ff1916600117905580156116fd575f805461ff0019166101001790555b611706876127ad565b61170e612820565b611716612892565b610191805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b0389811691909117909255610192805490911686831617905561019880549185167fffffffffffffffffffffff00000000000000000000000000000000000000000090921691909117600160a01b84151502179055841561179e5761179e612904565b80156117e3575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611826906001600160a01b03163033610e5d565b6001600160a01b0382165f908152610195602052604090206001015461186a57604051634c89018560e01b81526001600160a01b0383166004820152602401610ea5565b6001600160a01b0382165f908152610195602052604090205460ff166118bc576040517fcf12acdd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f8181526101956020526040808220805460ff19169055517f4a6f8353ec8700967336a2982804d34c6a35d417d5cb457ac11caa9eb917f0d49190a25050565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611940906001600160a01b03163033610e5d565b611149612904565b5f80611952610e06565b5f908152610196602090815260408083206001600160a01b039096168352949052929092205492915050565b61019254604080517f7667180800000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163766718089160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611a19906001600160a01b03163033610e5d565b6001600160a01b0384165f9081526101956020526040902060010154611a5d57604051634c89018560e01b81526001600160a01b0385166004820152602401610ea5565b6001600160a01b0384165f90815261019560205260409020600201611a83838583613ea4565b50836001600160a01b03167f98c22290de5c8f771a9b53bc6833b5ad1b69539ef5fdd73a0ebf36fba1cdab6b8484604051611abf929190613e38565b60405180910390a250505050565b60408051606080820183525f80835260208084018290528385018390526001600160a01b038616825261019581529084902084519283018552805460ff1615158352600181015491830191909152600281018054939492939192840191611b3390613cdd565b80601f0160208091040260200160405190810160405280929190818152602001828054611b5f90613cdd565b8015611baa5780601f10611b8157610100808354040283529160200191611baa565b820191905f5260205f20905b815481529060010190602001808311611b8d57829003601f168201915b5050505050815250509050919050565b6101948181548110611bca575f80fd5b5f918252602090912001546001600160a01b0316905081565b611beb61218d565b611bf3612941565b611bfb61118e565b611c31576040517f6d40818900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f339050611c90818484808060200260200160405190810160405280939291908181526020015f905b82821015611c8657611c7760408302860136819003810190613f5e565b81526020019060010190611c5a565b5050505050612994565b50610d7860018055565b6101956020525f908152604090208054600182015460028301805460ff909316939192611cc690613cdd565b80601f0160208091040260200160405190810160405280929190818152602001828054611cf290613cdd565b8015611d3d5780601f10611d1457610100808354040283529160200191611d3d565b820191905f5260205f20905b815481529060010190602001808311611d2057829003601f168201915b5050505050905083565b61012d547f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f790611d81906001600160a01b03163033610e5d565b610d78611d9336849003840184613f92565b612bdd565b6060610194805480602002602001604051908101604052809291908181526020018280548015611def57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611dd1575b5050505050905090565b604080518082019091525f80825260208201526040805180820190915261015f80546001600160a01b03811683526020830190600160a01b900460ff166001811115611e4757611e47613920565b6001811115611e5857611e58613920565b905250919050565b5f80611e6a610e06565b5f818152610197602090815260408083206001600160a01b03808a16808652828552838620918a1686528185529285205492909452909152600290910154919250611eb491612d21565b949350505050565b611ec461218d565b611ecc612941565b611ed461118e565b611f0a576040517f6d40818900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f13336114f4565b611f49576040517f51387b1a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f5233612d46565b611f5b60018055565b565b604080518082019091525f80825260208201526040805180820190915261015f80546001600160a01b03811683525f9291906020830190600160a01b900460ff166001811115611faf57611faf613920565b6001811115611fc057611fc0613920565b90525080519091506001600160a01b0316612007576040518060400160405280611ff361012d546001600160a01b031690565b6001600160a01b031681526020015f905290505b919050565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490612046906001600160a01b03163033610e5d565b506101988054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b61019254604080517fbed2e86b00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163bed2e86b9160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b5f806120ec610e06565b5f908152610193602052604090205492915050565b60605f61210c610e06565b5f818152610197602090815260408083206001600160a01b0388168452825291829020600101805483518184028101840190945280845293945091929083018282801561218057602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311612162575b5050505050915050919050565b6002600154036121df5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ea5565b6002600155565b60018055565b61019854600160a01b900460ff16612230576040517fec4df7bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612239816114f4565b6122405750565b5f612249610e06565b5f818152610197602090815260408083206001600160a01b0387168452909152812060018101805493945090929091036122835750505050565b610198546040517f9ab24eb00000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301525f921690639ab24eb090602401602060405180830381865afa1580156122e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123099190613e4b565b9050808360020154101561231e575050505050565b81545f9067ffffffffffffffff81111561233a5761233a61394e565b60405190808252806020026020018201604052801561237e57816020015b604080518082019091525f80825260208201528152602001906001900390816123585790505b5090505f5b8354811015612402575f84828154811061239f5761239f613fc6565b5f9182526020808320909101546001600160a01b031680835288825260409283902054835180850190945280845291830181905285519093509091908590859081106123ed576123ed613fc6565b60209081029190910101525050600101612383565b505f61240d82612f09565b905061241887612d46565b5f5b825181101561247c5761247383828151811061243857612438613fc6565b602002602001015160200151888a8761246d88878151811061245c5761245c613fc6565b60200260200101515f015188612f4f565b8b612f6a565b5060010161241a565b505050600283015550426003909101555050565b6040517ffdef91060000000000000000000000000000000000000000000000000000000081526001600160a01b0387169063fdef9106906124dd9088908890889088908890600401613fda565b602060405180830381865afa1580156124f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061251c9190613e62565b612574576040517f32dbe3b40000000000000000000000000000000000000000000000000000000081526001600160a01b03808816600483015280871660248301528516604482015260648101849052608401610ea5565b505050505050565b61012d547f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f590610d78906001600160a01b03163033610e5d565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156125ee576125e9836130c5565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612648575060408051601f3d908101601f1916820190925261264591810190613e4b565b60015b6126ba5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610ea5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc811461274f5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610ea5565b506125e9838383613190565b6127636131ba565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b5f54610100900460ff166128175760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b6111498161320c565b5f54610100900460ff1661288a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b611f5b6132a6565b5f54610100900460ff166128fc5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b611f5b613310565b61290c612941565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127903390565b60fb5460ff1615611f5b5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ea5565b610198545f90600160a01b900460ff16612a3357610198546001600160a01b0316633a46b1a8846129c361152f565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa158015612a0a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a2e9190613e4b565b612ab9565b610198546040517f9ab24eb00000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015290911690639ab24eb090602401602060405180830381865afa158015612a95573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ab99190613e4b565b9050805f03612af4576040517f7c176b7400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81515f819003612b1757604051630198e16360e41b815260040160405180910390fd5b612b20846114f4565b15612b2e57612b2e84612d46565b5f612b37610e06565b5f818152610197602090815260408083206001600160a01b038a1684529091528120919250612b6586612f09565b9050805f03612b8757604051630198e16360e41b815260040160405180910390fd5b5f5b84811015612bc6575f878281518110612ba457612ba4613fc6565b60200260200101519050612bbc81868b8a8789613386565b5050600101612b89565b505060028101939093555050426003909101555050565b8051612c12906001600160a01b03167f549ea75a000000000000000000000000000000000000000000000000000000006134eb565b8015612c335750600181602001516001811115612c3157612c31613920565b145b15612c6c57806040517f266d0fb9000000000000000000000000000000000000000000000000000000008152600401610ea59190613c8e565b805161015f80546001600160a01b0390921673ffffffffffffffffffffffffffffffffffffffff1983168117825560208401518493909183917fffffffffffffffffffffff0000000000000000000000000000000000000000001617600160a01b836001811115612cdf57612cdf613920565b02179055509050507f88e879ae0d71faf3aa708f2978daccb99b95243615dc104835b8c5a21c884ae681604051612d169190613c8e565b60405180910390a150565b5f6ec097ce7bc90715b34b9f1000000000612d3c838561400c565b610d009190614023565b5f612d4f610e06565b5f818152610197602090815260408083206001600160a01b0387168452909152812091925060018201905b8154811015612ed3575f828281548110612d9657612d96613fc6565b5f9182526020808320909101546001600160a01b031680835290869052604082205460028701549193509190612dcd908390612d21565b5f888152610196602090815260408083206001600160a01b0388168452909152812080549293508392909190612e04908490613e91565b90915550505f878152610193602052604081208054839290612e27908490613e91565b90915550506001600160a01b0383165f90815260208790526040812055612e4c61197e565b5f888152610196602090815260408083206001600160a01b03888116808652918452828520548d865261019385529483902054835188815294850195909552918301939093524260608301528b16907fe87470fcfb5344dc8e12bed9dd48daacd950077df9304ffc65c423ee4fb443559060800160405180910390a4505050600101612d7a565b505f60028301819055600383018190556040805191825260208201908190529051612f02916001850191613766565b5050505050565b5f80805b8351811015612f4857838181518110612f2857612f28613fc6565b60200260200101515f015182612f3e9190614042565b9150600101612f0d565b5092915050565b5f81612d3c846ec097ce7bc90715b34b9f100000000061400c565b5f80612f768486612d21565b6001848101805491820181555f9081526020808220909201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038d169081179091558152908590526040812080549293508692909190612fd6908490614042565b90915550505f878152610196602090815260408083206001600160a01b038c1684529091528120805483929061300d908490614042565b90915550505f878152610193602052604081208054839290613030908490614042565b9091555061303e905061197e565b5f888152610196602090815260408083206001600160a01b038d8116808652918452828520548d865261019385529483902054835188815294850195909552918301939093524260608301528916907f9597ca1d5e7730de0b0614eeeea16ce1a90d9798253c18b1b4941ae3d2d454ec9060800160405180910390a4979650505050505050565b6001600160a01b0381163b6131425760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610ea5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61319983613506565b5f825111806131a55750805b156125e9576131b48383613545565b50505050565b60fb5460ff16611f5b5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ea5565b5f54610100900460ff166132765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b61012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b5f54610100900460ff166121e65760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b5f54610100900460ff1661337a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b60fb805460ff19169055565b5f6133af87602001516001600160a01b03165f9081526101956020526040902060010154151590565b6133dd576020870151604051634c89018560e01b81526001600160a01b039091166004820152602401610ea5565b61340387602001516001600160a01b03165f908152610195602052604090205460ff1690565b61344a5760208701516040517fd2b961e10000000000000000000000000000000000000000000000000000000081526001600160a01b039091166004820152602401610ea5565b6020808801516001600160a01b03165f9081529083905260409020541561349d576040517ffdebb48000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6134ab885f015185612f4f565b9050805f036134cd57604051630198e16360e41b815260040160405180910390fd5b6134df88602001518888888588612f6a565b98975050505050505050565b5f6134f58361356a565b8015610d005750610d00838361359c565b61350f816130c5565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060610d00838360405180606001604052806027815260200161408360279139613637565b5f61357c826301ffc9a760e01b61359c565b8015610b215750613595826001600160e01b031961359c565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17815282515f9392849283928392918391908a617530fa92503d91505f519050828015613621575060208210155b801561362c57505f81115b979650505050505050565b60605f80856001600160a01b0316856040516136539190614055565b5f60405180830381855af49150503d805f811461368b576040519150601f19603f3d011682016040523d82523d5f602084013e613690565b606091505b50915091506136a1868383876136ab565b9695505050505050565b606083156137195782515f03613712576001600160a01b0385163b6137125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ea5565b5081611eb4565b611eb4838381511561372e5781518083602001fd5b8060405162461bcd60e51b8152600401610ea59190614070565b60405180606001604052806003906020820280368337509192915050565b828054828255905f5260205f209081019282156137c6579160200282015b828111156137c6578251825473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116178255602090920191600190910190613784565b506137d29291506137d6565b5090565b5b808211156137d2575f81556001016137d7565b5f602082840312156137fa575f80fd5b81356001600160e01b031981168114610d00575f80fd5b80356001600160a01b0381168114612007575f80fd5b5f805f60408486031215613839575f80fd5b61384284613811565b9250602084013567ffffffffffffffff8082111561385e575f80fd5b818601915086601f830112613871575f80fd5b81358181111561387f575f80fd5b876020828501011115613890575f80fd5b6020830194508093505050509250925092565b5f80604083850312156138b4575f80fd5b6138bd83613811565b91506138cb60208401613811565b90509250929050565b5f602082840312156138e4575f80fd5b610d0082613811565b6060810181835f5b600381101561391757815160ff168352602092830192909101906001016138f5565b50505092915050565b634e487b7160e01b5f52602160045260245ffd5b602081016003831061394857613948613920565b91905290565b634e487b7160e01b5f52604160045260245ffd5b6040805190810167ffffffffffffffff811182821017156139855761398561394e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156139b4576139b461394e565b604052919050565b5f80604083850312156139cd575f80fd5b6139d683613811565b915060208084013567ffffffffffffffff808211156139f3575f80fd5b818601915086601f830112613a06575f80fd5b813581811115613a1857613a1861394e565b613a2a84601f19601f8401160161398b565b91508082528784828501011115613a3f575f80fd5b80848401858401375f848284010152508093505050509250929050565b8015158114611149575f80fd5b5f805f805f8060c08789031215613a7e575f80fd5b613a8787613811565b9550613a9560208801613811565b94506040870135613aa581613a5c565b9350613ab360608801613811565b9250613ac160808801613811565b915060a0870135613ad181613a5c565b809150509295509295509295565b5f8060408385031215613af0575f80fd5b823591506138cb60208401613811565b5f5b83811015613b1a578181015183820152602001613b02565b50505f910152565b5f8151808452613b39816020860160208601613b00565b601f01601f19169290920160200192915050565b60208152815115156020820152602082015160408201525f6040830151606080840152611eb46080840182613b22565b5f60208284031215613b8d575f80fd5b5035919050565b5f8060208385031215613ba5575f80fd5b823567ffffffffffffffff80821115613bbc575f80fd5b818501915085601f830112613bcf575f80fd5b813581811115613bdd575f80fd5b8660208260061b8501011115613bf1575f80fd5b60209290920196919550909350505050565b8315158152826020820152606060408201525f613c236060830184613b22565b95945050505050565b5f60408284031215613c3c575f80fd5b50919050565b602080825282518282018190525f9190848201906040850190845b81811015613c825783516001600160a01b031683529284019291840191600101613c5d565b50909695505050505050565b81516001600160a01b031681526020820151604082019060028110613cb557613cb5613920565b8060208401525092915050565b5f60208284031215613cd2575f80fd5b8135610d0081613a5c565b600181811c90821680613cf157607f821691505b602082108103613c3c57634e487b7160e01b5f52602260045260245ffd5b601f8211156125e957805f5260205f20601f840160051c81016020851015613d345750805b601f840160051c820191505b81811015612f02575f8155600101613d40565b815167ffffffffffffffff811115613d6d57613d6d61394e565b613d8181613d7b8454613cdd565b84613d0f565b602080601f831160018114613db4575f8415613d9d5750858301515b5f19600386901b1c1916600185901b178555612574565b5f85815260208120601f198616915b82811015613de257888601518255948401946001909101908401613dc3565b5085821015613dff57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f611eb4602083018486613e0f565b5f60208284031215613e5b575f80fd5b5051919050565b5f60208284031215613e72575f80fd5b8151610d0081613a5c565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610b2157610b21613e7d565b67ffffffffffffffff831115613ebc57613ebc61394e565b613ed083613eca8354613cdd565b83613d0f565b5f601f841160018114613f01575f8515613eea5750838201355b5f19600387901b1c1916600186901b178355612f02565b5f83815260208120601f198716915b82811015613f305786850135825560209485019460019092019101613f10565b5086821015613f4c575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f60408284031215613f6e575f80fd5b613f76613962565b82358152613f8660208401613811565b60208201529392505050565b5f60408284031215613fa2575f80fd5b613faa613962565b613fb383613811565b8152602083013560028110613f86575f80fd5b634e487b7160e01b5f52603260045260245ffd5b5f6001600160a01b0380881683528087166020840152508460408301526080606083015261362c608083018486613e0f565b8082028115828204841417610b2157610b21613e7d565b5f8261403d57634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610b2157610b21613e7d565b5f8251614066818460208701613b00565b9190910192915050565b602081525f610d006020830184613b2256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564

Deployed Bytecode

0x60806040526004361061033a575f3560e01c806391ddadf4116101b2578063bda46ea9116100f2578063dd63c06f11610092578063e79e5a231161006d578063e79e5a23146109c2578063ecc44a38146109f5578063f0363ae414610a09578063fdd644d814610a1d575f80fd5b8063dd63c06f1461096f578063e284b4ee14610983578063e2fdcc17146109a2575f80fd5b8063c9c4bfca116100cd578063c9c4bfca146108dd578063cad1b90614610910578063d19d5ac71461092f578063d826f88f1461095b575f80fd5b8063bda46ea914610861578063c946c5cc1461089b578063c98425ee146108bc575f80fd5b8063abdb84e71161015d578063b4b1013c11610138578063b4b1013c146107d6578063b6a212ab146107f5578063b9a09fd514610814578063bb225da214610842575f80fd5b8063abdb84e714610741578063ad288fe81461078b578063b1c6f0e9146107aa575f80fd5b80639ef13a411161018d5780639ef13a41146106d65780639f8a13d7146106f5578063aa9bbc0c1461072d575f80fd5b806391ddadf41461065f5780639490895d1461067f5780639593c7ef1461069f575f80fd5b806341de68301161027d5780635f8dd6491161022857806367ebd57c1161020357806367ebd57c146105b757806382bbad24146105f95780638456cb59146106185780638cb750591461062c575f80fd5b80635f8dd6491461056557806361a8c8c41461058457806366dcecf314610598575f80fd5b806352d1902d1161025857806352d1902d146105265780635c60da1b1461053a5780635c975abb1461054e575f80fd5b806341de6830146104e55780634cea22f1146104ff5780634f1ef28614610513575f80fd5b806323303c6f116102e85780633659cfe6116102c35780633659cfe6146104805780633f4ba83a1461049f578063408e2727146104b35780634162169f146104c7575f80fd5b806323303c6f146104215780632a63061a146104405780632ae9c6001461045f575f80fd5b8063118f14c711610318578063118f14c7146103ca57806315e5a1e5146103eb57806317125b3b1461040d575f80fd5b806301ffc9a71461033e578063071d2171146103725780630a29e4c0146103a9575b5f80fd5b348015610349575f80fd5b5061035d6103583660046137ea565b610a3c565b60405190151581526020015b60405180910390f35b34801561037d575f80fd5b5061039161038c366004613827565b610b27565b6040516001600160a01b039091168152602001610369565b3480156103b4575f80fd5b506103c86103c33660046138a3565b610d07565b005b3480156103d5575f80fd5b506101985461035d90600160a01b900460ff1681565b3480156103f6575f80fd5b506103ff610d7c565b604051908152602001610369565b348015610418575f80fd5b506103ff610e06565b34801561042c575f80fd5b506103c861043b3660046138d4565b610e27565b34801561044b575f80fd5b506103ff61045a3660046138d4565b610f4e565b34801561046a575f80fd5b50610473610f87565b60405161036991906138ed565b34801561048b575f80fd5b506103c861049a3660046138d4565b610fb0565b3480156104aa575f80fd5b506103c861114c565b3480156104be575f80fd5b5061035d61118e565b3480156104d2575f80fd5b5061012d546001600160a01b0316610391565b3480156104f0575f80fd5b505f6040516103699190613934565b34801561050a575f80fd5b506103ff611213565b6103c86105213660046139bc565b611274565b348015610531575f80fd5b506103ff6113fe565b348015610545575f80fd5b506103916114c2565b348015610559575f80fd5b5060fb5460ff1661035d565b348015610570575f80fd5b5061035d61057f3660046138d4565b6114f4565b34801561058f575f80fd5b506103ff61152f565b3480156105a3575f80fd5b506103c86105b2366004613a69565b611633565b3480156105c2575f80fd5b506103ff6105d1366004613adf565b5f918252610196602090815260408084206001600160a01b0393909316845291905290205490565b348015610604575f80fd5b506103c86106133660046138d4565b6117ec565b348015610623575f80fd5b506103c8611906565b348015610637575f80fd5b506103ff7f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f781565b34801561066a575f80fd5b5061019254610391906001600160a01b031681565b34801561068a575f80fd5b5061019854610391906001600160a01b031681565b3480156106aa575f80fd5b506103ff6106b9366004613adf565b61019660209081525f928352604080842090915290825290205481565b3480156106e1575f80fd5b506103ff6106f03660046138d4565b611948565b348015610700575f80fd5b5061035d61070f3660046138d4565b6001600160a01b03165f908152610195602052604090205460ff1690565b348015610738575f80fd5b506103ff61197e565b34801561074c575f80fd5b506103c861075b3660046138d4565b610198805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b348015610796575f80fd5b506103c86107a5366004613827565b6119df565b3480156107b5575f80fd5b506107c96107c43660046138d4565b611acd565b6040516103699190613b4d565b3480156107e1575f80fd5b506103916107f0366004613b7d565b611bba565b348015610800575f80fd5b506103c861080f366004613b94565b611be3565b34801561081f575f80fd5b5061083361082e3660046138d4565b611c9a565b60405161036993929190613c03565b34801561084d575f80fd5b506103c861085c366004613c2c565b611d47565b34801561086c575f80fd5b5061035d61087b3660046138d4565b6001600160a01b03165f9081526101956020526040902060010154151590565b3480156108a6575f80fd5b506108af611d98565b6040516103699190613c42565b3480156108c7575f80fd5b506108d0611df9565b6040516103699190613c8e565b3480156108e8575f80fd5b506103ff7f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f581565b34801561091b575f80fd5b506103ff61092a3660046138a3565b611e60565b34801561093a575f80fd5b506103ff610949366004613b7d565b6101936020525f908152604090205481565b348015610966575f80fd5b506103c8611ebc565b34801561097a575f80fd5b506108d0611f5d565b34801561098e575f80fd5b506103c861099d366004613cc2565b61200c565b3480156109ad575f80fd5b5061019154610391906001600160a01b031681565b3480156109cd575f80fd5b506103ff7ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201481565b348015610a00575f80fd5b506103ff612081565b348015610a14575f80fd5b506103ff6120e2565b348015610a28575f80fd5b506108af610a373660046138d4565b612101565b5f6001600160e01b031982167f41de6830000000000000000000000000000000000000000000000000000000001480610a9e57506001600160e01b031982167f2ae9c60000000000000000000000000000000000000000000000000000000000145b80610ad257506001600160e01b031982167f52d1902d00000000000000000000000000000000000000000000000000000000145b80610b0657506001600160e01b031982167fafc5b82300000000000000000000000000000000000000000000000000000000145b80610b2157506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f610b3061218d565b6001600160a01b038416610b70576040517f32e63e4400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384165f908152610195602052604090206001015415610bc3576040517f91fc82b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051806060016040528060011515815260200142815260200184848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201829052509390945250506001600160a01b038716815261019560209081526040918290208451815460ff1916901515178155908401516001820155908301519091506002820190610c5b9082613d53565b505061019480546001810182555f919091527fa6f1ac7ad7b125ba5a5e1c96b00ad6914f90a503b1ac3d85a9dadbb4c639df9201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387169081179091556040513392507fe72b86315c30bd1bf352c4cf97594ba793f3e31b74bc874ce47ede0df6920ae990610ced9087908790613e38565b60405180910390a35082610d0060018055565b9392505050565b610191546001600160a01b03163314610d4c576040517f1a0831da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d55826121ec565b806001600160a01b0316826001600160a01b03160315610d7857610d78816121ec565b5050565b61019254604080517fc75dd54100000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163c75dd5419160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e019190613e4b565b905090565b610198545f90600160a01b900460ff16610e2257610e0161197e565b505f90565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490610e65906001600160a01b031630335b845f36612490565b6001600160a01b0382165f9081526101956020526040902060010154610eae57604051634c89018560e01b81526001600160a01b03831660048201526024015b60405180910390fd5b6001600160a01b0382165f908152610195602052604090205460ff1615610f01576040517fcf12acdd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f8181526101956020526040808220805460ff19166001179055517f34521f8891f6149b4baf837b8eea01eeefc28708be34ac8e705484dd34dde8189190a25050565b5f80610f58610e06565b5f908152610197602090815260408083206001600160a01b039096168352949052929092206002015492915050565b610f8f613748565b506040805160608101825260018152600460208201525f9181019190915290565b6001600160a01b037f000000000000000000000000195f5a775c366fbf89e6f95e1465d3c713b1fc5516300361104e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610ea5565b7f000000000000000000000000195f5a775c366fbf89e6f95e1465d3c713b1fc556001600160a01b03166110a97f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146111255760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610ea5565b61112e8161257c565b604080515f80825260208201909252611149918391906125b6565b50565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611186906001600160a01b03163033610e5d565b61114961275b565b61019254604080517f408e272700000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163408e27279160048083019260209291908290030181865afa1580156111ef573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e019190613e62565b61019254604080517f51b7d39900000000000000000000000000000000000000000000000000000000815290515f926001600160a01b0316916351b7d3999160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b6001600160a01b037f000000000000000000000000195f5a775c366fbf89e6f95e1465d3c713b1fc551630036113125760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610ea5565b7f000000000000000000000000195f5a775c366fbf89e6f95e1465d3c713b1fc556001600160a01b031661136d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146113e95760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f787900000000000000000000000000000000000000006064820152608401610ea5565b6113f28261257c565b610d78828260016125b6565b5f306001600160a01b037f000000000000000000000000195f5a775c366fbf89e6f95e1465d3c713b1fc55161461149d5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610ea5565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b5f610e017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b5f806114fe610e06565b5f908152610197602090815260408083206001600160a01b0390961683529490529290922060030154151592915050565b61019254604080517f4ff0876a00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b031691634ff0876a9160048083019260209291908290030181865afa158015611590573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115b49190613e4b565b6101925f9054906101000a90046001600160a01b03166001600160a01b031663c75dd5416040518163ffffffff1660e01b8152600401602060405180830381865afa158015611605573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116299190613e4b565b610e019190613e91565b5f54610100900460ff161580801561165157505f54600160ff909116105b8061166a5750303b15801561166a57505f5460ff166001145b6116dc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610ea5565b5f805460ff1916600117905580156116fd575f805461ff0019166101001790555b611706876127ad565b61170e612820565b611716612892565b610191805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b0389811691909117909255610192805490911686831617905561019880549185167fffffffffffffffffffffff00000000000000000000000000000000000000000090921691909117600160a01b84151502179055841561179e5761179e612904565b80156117e3575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611826906001600160a01b03163033610e5d565b6001600160a01b0382165f908152610195602052604090206001015461186a57604051634c89018560e01b81526001600160a01b0383166004820152602401610ea5565b6001600160a01b0382165f908152610195602052604090205460ff166118bc576040517fcf12acdd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382165f8181526101956020526040808220805460ff19169055517f4a6f8353ec8700967336a2982804d34c6a35d417d5cb457ac11caa9eb917f0d49190a25050565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611940906001600160a01b03163033610e5d565b611149612904565b5f80611952610e06565b5f908152610196602090815260408083206001600160a01b039096168352949052929092205492915050565b61019254604080517f7667180800000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163766718089160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490611a19906001600160a01b03163033610e5d565b6001600160a01b0384165f9081526101956020526040902060010154611a5d57604051634c89018560e01b81526001600160a01b0385166004820152602401610ea5565b6001600160a01b0384165f90815261019560205260409020600201611a83838583613ea4565b50836001600160a01b03167f98c22290de5c8f771a9b53bc6833b5ad1b69539ef5fdd73a0ebf36fba1cdab6b8484604051611abf929190613e38565b60405180910390a250505050565b60408051606080820183525f80835260208084018290528385018390526001600160a01b038616825261019581529084902084519283018552805460ff1615158352600181015491830191909152600281018054939492939192840191611b3390613cdd565b80601f0160208091040260200160405190810160405280929190818152602001828054611b5f90613cdd565b8015611baa5780601f10611b8157610100808354040283529160200191611baa565b820191905f5260205f20905b815481529060010190602001808311611b8d57829003601f168201915b5050505050815250509050919050565b6101948181548110611bca575f80fd5b5f918252602090912001546001600160a01b0316905081565b611beb61218d565b611bf3612941565b611bfb61118e565b611c31576040517f6d40818900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f339050611c90818484808060200260200160405190810160405280939291908181526020015f905b82821015611c8657611c7760408302860136819003810190613f5e565b81526020019060010190611c5a565b5050505050612994565b50610d7860018055565b6101956020525f908152604090208054600182015460028301805460ff909316939192611cc690613cdd565b80601f0160208091040260200160405190810160405280929190818152602001828054611cf290613cdd565b8015611d3d5780601f10611d1457610100808354040283529160200191611d3d565b820191905f5260205f20905b815481529060010190602001808311611d2057829003601f168201915b5050505050905083565b61012d547f568cc693d84eb1901f8bcecba154cbdef23ca3cf67efc0a0b698528a06c660f790611d81906001600160a01b03163033610e5d565b610d78611d9336849003840184613f92565b612bdd565b6060610194805480602002602001604051908101604052809291908181526020018280548015611def57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311611dd1575b5050505050905090565b604080518082019091525f80825260208201526040805180820190915261015f80546001600160a01b03811683526020830190600160a01b900460ff166001811115611e4757611e47613920565b6001811115611e5857611e58613920565b905250919050565b5f80611e6a610e06565b5f818152610197602090815260408083206001600160a01b03808a16808652828552838620918a1686528185529285205492909452909152600290910154919250611eb491612d21565b949350505050565b611ec461218d565b611ecc612941565b611ed461118e565b611f0a576040517f6d40818900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f13336114f4565b611f49576040517f51387b1a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f5233612d46565b611f5b60018055565b565b604080518082019091525f80825260208201526040805180820190915261015f80546001600160a01b03811683525f9291906020830190600160a01b900460ff166001811115611faf57611faf613920565b6001811115611fc057611fc0613920565b90525080519091506001600160a01b0316612007576040518060400160405280611ff361012d546001600160a01b031690565b6001600160a01b031681526020015f905290505b919050565b61012d547ffda1ae526c1fb38407f23e8b7712f7cfacc146f3e340a04221488331e0d4201490612046906001600160a01b03163033610e5d565b506101988054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b61019254604080517fbed2e86b00000000000000000000000000000000000000000000000000000000815290515f926001600160a01b03169163bed2e86b9160048083019260209291908290030181865afa158015610ddd573d5f803e3d5ffd5b5f806120ec610e06565b5f908152610193602052604090205492915050565b60605f61210c610e06565b5f818152610197602090815260408083206001600160a01b0388168452825291829020600101805483518184028101840190945280845293945091929083018282801561218057602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311612162575b5050505050915050919050565b6002600154036121df5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610ea5565b6002600155565b60018055565b61019854600160a01b900460ff16612230576040517fec4df7bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612239816114f4565b6122405750565b5f612249610e06565b5f818152610197602090815260408083206001600160a01b0387168452909152812060018101805493945090929091036122835750505050565b610198546040517f9ab24eb00000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301525f921690639ab24eb090602401602060405180830381865afa1580156122e5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123099190613e4b565b9050808360020154101561231e575050505050565b81545f9067ffffffffffffffff81111561233a5761233a61394e565b60405190808252806020026020018201604052801561237e57816020015b604080518082019091525f80825260208201528152602001906001900390816123585790505b5090505f5b8354811015612402575f84828154811061239f5761239f613fc6565b5f9182526020808320909101546001600160a01b031680835288825260409283902054835180850190945280845291830181905285519093509091908590859081106123ed576123ed613fc6565b60209081029190910101525050600101612383565b505f61240d82612f09565b905061241887612d46565b5f5b825181101561247c5761247383828151811061243857612438613fc6565b602002602001015160200151888a8761246d88878151811061245c5761245c613fc6565b60200260200101515f015188612f4f565b8b612f6a565b5060010161241a565b505050600283015550426003909101555050565b6040517ffdef91060000000000000000000000000000000000000000000000000000000081526001600160a01b0387169063fdef9106906124dd9088908890889088908890600401613fda565b602060405180830381865afa1580156124f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061251c9190613e62565b612574576040517f32dbe3b40000000000000000000000000000000000000000000000000000000081526001600160a01b03808816600483015280871660248301528516604482015260648101849052608401610ea5565b505050505050565b61012d547f821b6e3a557148015a918c89e5d092e878a69854a2d1a410635f771bd5a8a3f590610d78906001600160a01b03163033610e5d565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156125ee576125e9836130c5565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612648575060408051601f3d908101601f1916820190925261264591810190613e4b565b60015b6126ba5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f7420555550530000000000000000000000000000000000006064820152608401610ea5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc811461274f5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c655555494400000000000000000000000000000000000000000000006064820152608401610ea5565b506125e9838383613190565b6127636131ba565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b5f54610100900460ff166128175760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b6111498161320c565b5f54610100900460ff1661288a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b611f5b6132a6565b5f54610100900460ff166128fc5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b611f5b613310565b61290c612941565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127903390565b60fb5460ff1615611f5b5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ea5565b610198545f90600160a01b900460ff16612a3357610198546001600160a01b0316633a46b1a8846129c361152f565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa158015612a0a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a2e9190613e4b565b612ab9565b610198546040517f9ab24eb00000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015290911690639ab24eb090602401602060405180830381865afa158015612a95573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ab99190613e4b565b9050805f03612af4576040517f7c176b7400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b81515f819003612b1757604051630198e16360e41b815260040160405180910390fd5b612b20846114f4565b15612b2e57612b2e84612d46565b5f612b37610e06565b5f818152610197602090815260408083206001600160a01b038a1684529091528120919250612b6586612f09565b9050805f03612b8757604051630198e16360e41b815260040160405180910390fd5b5f5b84811015612bc6575f878281518110612ba457612ba4613fc6565b60200260200101519050612bbc81868b8a8789613386565b5050600101612b89565b505060028101939093555050426003909101555050565b8051612c12906001600160a01b03167f549ea75a000000000000000000000000000000000000000000000000000000006134eb565b8015612c335750600181602001516001811115612c3157612c31613920565b145b15612c6c57806040517f266d0fb9000000000000000000000000000000000000000000000000000000008152600401610ea59190613c8e565b805161015f80546001600160a01b0390921673ffffffffffffffffffffffffffffffffffffffff1983168117825560208401518493909183917fffffffffffffffffffffff0000000000000000000000000000000000000000001617600160a01b836001811115612cdf57612cdf613920565b02179055509050507f88e879ae0d71faf3aa708f2978daccb99b95243615dc104835b8c5a21c884ae681604051612d169190613c8e565b60405180910390a150565b5f6ec097ce7bc90715b34b9f1000000000612d3c838561400c565b610d009190614023565b5f612d4f610e06565b5f818152610197602090815260408083206001600160a01b0387168452909152812091925060018201905b8154811015612ed3575f828281548110612d9657612d96613fc6565b5f9182526020808320909101546001600160a01b031680835290869052604082205460028701549193509190612dcd908390612d21565b5f888152610196602090815260408083206001600160a01b0388168452909152812080549293508392909190612e04908490613e91565b90915550505f878152610193602052604081208054839290612e27908490613e91565b90915550506001600160a01b0383165f90815260208790526040812055612e4c61197e565b5f888152610196602090815260408083206001600160a01b03888116808652918452828520548d865261019385529483902054835188815294850195909552918301939093524260608301528b16907fe87470fcfb5344dc8e12bed9dd48daacd950077df9304ffc65c423ee4fb443559060800160405180910390a4505050600101612d7a565b505f60028301819055600383018190556040805191825260208201908190529051612f02916001850191613766565b5050505050565b5f80805b8351811015612f4857838181518110612f2857612f28613fc6565b60200260200101515f015182612f3e9190614042565b9150600101612f0d565b5092915050565b5f81612d3c846ec097ce7bc90715b34b9f100000000061400c565b5f80612f768486612d21565b6001848101805491820181555f9081526020808220909201805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038d169081179091558152908590526040812080549293508692909190612fd6908490614042565b90915550505f878152610196602090815260408083206001600160a01b038c1684529091528120805483929061300d908490614042565b90915550505f878152610193602052604081208054839290613030908490614042565b9091555061303e905061197e565b5f888152610196602090815260408083206001600160a01b038d8116808652918452828520548d865261019385529483902054835188815294850195909552918301939093524260608301528916907f9597ca1d5e7730de0b0614eeeea16ce1a90d9798253c18b1b4941ae3d2d454ec9060800160405180910390a4979650505050505050565b6001600160a01b0381163b6131425760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610ea5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61319983613506565b5f825111806131a55750805b156125e9576131b48383613545565b50505050565b60fb5460ff16611f5b5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ea5565b5f54610100900460ff166132765760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b61012d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b5f54610100900460ff166121e65760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b5f54610100900460ff1661337a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610ea5565b60fb805460ff19169055565b5f6133af87602001516001600160a01b03165f9081526101956020526040902060010154151590565b6133dd576020870151604051634c89018560e01b81526001600160a01b039091166004820152602401610ea5565b61340387602001516001600160a01b03165f908152610195602052604090205460ff1690565b61344a5760208701516040517fd2b961e10000000000000000000000000000000000000000000000000000000081526001600160a01b039091166004820152602401610ea5565b6020808801516001600160a01b03165f9081529083905260409020541561349d576040517ffdebb48000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6134ab885f015185612f4f565b9050805f036134cd57604051630198e16360e41b815260040160405180910390fd5b6134df88602001518888888588612f6a565b98975050505050505050565b5f6134f58361356a565b8015610d005750610d00838361359c565b61350f816130c5565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060610d00838360405180606001604052806027815260200161408360279139613637565b5f61357c826301ffc9a760e01b61359c565b8015610b215750613595826001600160e01b031961359c565b1592915050565b604080516001600160e01b03198316602480830191909152825180830390910181526044909101909152602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166301ffc9a760e01b17815282515f9392849283928392918391908a617530fa92503d91505f519050828015613621575060208210155b801561362c57505f81115b979650505050505050565b60605f80856001600160a01b0316856040516136539190614055565b5f60405180830381855af49150503d805f811461368b576040519150601f19603f3d011682016040523d82523d5f602084013e613690565b606091505b50915091506136a1868383876136ab565b9695505050505050565b606083156137195782515f03613712576001600160a01b0385163b6137125760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ea5565b5081611eb4565b611eb4838381511561372e5781518083602001fd5b8060405162461bcd60e51b8152600401610ea59190614070565b60405180606001604052806003906020820280368337509192915050565b828054828255905f5260205f209081019282156137c6579160200282015b828111156137c6578251825473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116178255602090920191600190910190613784565b506137d29291506137d6565b5090565b5b808211156137d2575f81556001016137d7565b5f602082840312156137fa575f80fd5b81356001600160e01b031981168114610d00575f80fd5b80356001600160a01b0381168114612007575f80fd5b5f805f60408486031215613839575f80fd5b61384284613811565b9250602084013567ffffffffffffffff8082111561385e575f80fd5b818601915086601f830112613871575f80fd5b81358181111561387f575f80fd5b876020828501011115613890575f80fd5b6020830194508093505050509250925092565b5f80604083850312156138b4575f80fd5b6138bd83613811565b91506138cb60208401613811565b90509250929050565b5f602082840312156138e4575f80fd5b610d0082613811565b6060810181835f5b600381101561391757815160ff168352602092830192909101906001016138f5565b50505092915050565b634e487b7160e01b5f52602160045260245ffd5b602081016003831061394857613948613920565b91905290565b634e487b7160e01b5f52604160045260245ffd5b6040805190810167ffffffffffffffff811182821017156139855761398561394e565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156139b4576139b461394e565b604052919050565b5f80604083850312156139cd575f80fd5b6139d683613811565b915060208084013567ffffffffffffffff808211156139f3575f80fd5b818601915086601f830112613a06575f80fd5b813581811115613a1857613a1861394e565b613a2a84601f19601f8401160161398b565b91508082528784828501011115613a3f575f80fd5b80848401858401375f848284010152508093505050509250929050565b8015158114611149575f80fd5b5f805f805f8060c08789031215613a7e575f80fd5b613a8787613811565b9550613a9560208801613811565b94506040870135613aa581613a5c565b9350613ab360608801613811565b9250613ac160808801613811565b915060a0870135613ad181613a5c565b809150509295509295509295565b5f8060408385031215613af0575f80fd5b823591506138cb60208401613811565b5f5b83811015613b1a578181015183820152602001613b02565b50505f910152565b5f8151808452613b39816020860160208601613b00565b601f01601f19169290920160200192915050565b60208152815115156020820152602082015160408201525f6040830151606080840152611eb46080840182613b22565b5f60208284031215613b8d575f80fd5b5035919050565b5f8060208385031215613ba5575f80fd5b823567ffffffffffffffff80821115613bbc575f80fd5b818501915085601f830112613bcf575f80fd5b813581811115613bdd575f80fd5b8660208260061b8501011115613bf1575f80fd5b60209290920196919550909350505050565b8315158152826020820152606060408201525f613c236060830184613b22565b95945050505050565b5f60408284031215613c3c575f80fd5b50919050565b602080825282518282018190525f9190848201906040850190845b81811015613c825783516001600160a01b031683529284019291840191600101613c5d565b50909695505050505050565b81516001600160a01b031681526020820151604082019060028110613cb557613cb5613920565b8060208401525092915050565b5f60208284031215613cd2575f80fd5b8135610d0081613a5c565b600181811c90821680613cf157607f821691505b602082108103613c3c57634e487b7160e01b5f52602260045260245ffd5b601f8211156125e957805f5260205f20601f840160051c81016020851015613d345750805b601f840160051c820191505b81811015612f02575f8155600101613d40565b815167ffffffffffffffff811115613d6d57613d6d61394e565b613d8181613d7b8454613cdd565b84613d0f565b602080601f831160018114613db4575f8415613d9d5750858301515b5f19600386901b1c1916600185901b178555612574565b5f85815260208120601f198616915b82811015613de257888601518255948401946001909101908401613dc3565b5085821015613dff57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f611eb4602083018486613e0f565b5f60208284031215613e5b575f80fd5b5051919050565b5f60208284031215613e72575f80fd5b8151610d0081613a5c565b634e487b7160e01b5f52601160045260245ffd5b81810381811115610b2157610b21613e7d565b67ffffffffffffffff831115613ebc57613ebc61394e565b613ed083613eca8354613cdd565b83613d0f565b5f601f841160018114613f01575f8515613eea5750838201355b5f19600387901b1c1916600186901b178355612f02565b5f83815260208120601f198716915b82811015613f305786850135825560209485019460019092019101613f10565b5086821015613f4c575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f60408284031215613f6e575f80fd5b613f76613962565b82358152613f8660208401613811565b60208201529392505050565b5f60408284031215613fa2575f80fd5b613faa613962565b613fb383613811565b8152602083013560028110613f86575f80fd5b634e487b7160e01b5f52603260045260245ffd5b5f6001600160a01b0380881683528087166020840152508460408301526080606083015261362c608083018486613e0f565b8082028115828204841417610b2157610b21613e7d565b5f8261403d57634e487b7160e01b5f52601260045260245ffd5b500490565b80820180821115610b2157610b21613e7d565b5f8251614066818460208701613b00565b9190910192915050565b602081525f610d006020830184613b2256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
0x195F5A775c366Fbf89E6F95E1465d3c713b1fC55
Loading...
Loading
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.