{
  "language": "Solidity",
  "sources": {
    "contracts/Election.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\n\npragma solidity >=0.8.0;\n\nimport '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';\n\nimport './interfaces/IStake.sol';\nimport './interfaces/IElection.sol';\nimport './MajorNodes.sol';\n\ncontract Election is IElection, MajorNodes {\n\tstruct VoterInfo {\n\t\tuint256 amount;\n\t\tuint256 rewardDebt;\n\t}\n\n\tIERC20Upgradeable public override token;\n\n\tIStake public override stake;\n\n\tuint256 public override ACC_PRECISION;\n\n\tmapping(address => mapping(address => VoterInfo)) public voters;\n\n\tmapping(address => uint256) public override voteSupply;\n\n\tmapping(address => uint256) public accPerShares;\n\n\tmodifier onlyStake() {\n\t\trequire(msg.sender == address(stake), 'Rewarder: caller is not stake contract');\n\t\t_;\n\t}\n\n\tfunction initialize(IERC20Upgradeable _token, IStake _stake) external initializer {\n\t\t_setToken(_token);\n\t\t_setStake(_stake);\n\t\t__Init_MAX_NODES_LENGTH(2);\n\t\tACC_PRECISION = 1e12;\n\t}\n\n\tfunction vote(\n\t\taddress candidate,\n\t\taddress voter,\n\t\tuint256 amount\n\t) external override {\n\t\tstake.voterClaim(candidate);\n\t\tvoters[candidate][voter].amount = voters[candidate][voter].amount + amount;\n\t\tvoters[candidate][voter].rewardDebt = voters[candidate][voter].rewardDebt + (amount * accPerShares[candidate] / ACC_PRECISION);\n\t\tvoteSupply[candidate] = voteSupply[candidate] + amount;\n\t\t(address input, address output) = resolveNode(candidate, voteSupply[candidate]);\n\t\tif (input != address(0)) {\n\t\t\tstake.upgrade(input);\n\t\t}\n\t\tif (output != address(0)) {\n\t\t\tstake.downgrade(output);\n\t\t}\n\t\ttoken.transferFrom(msg.sender, address(this), amount);\n\n\t\temit Vote(candidate, voter, amount);\n\t}\n\n\tfunction claim(address candidate, address to) external {\n\t\tstake.voterClaim(candidate);\n\t\tVoterInfo storage voter = voters[candidate][msg.sender];\n\t\tuint256 accumulated = voter.amount * accPerShares[candidate] / ACC_PRECISION;\n\t\tuint256 _pending = accumulated - voter.rewardDebt;\n\t\tvoter.rewardDebt = accumulated;\n\t\ttoken.transfer(to, _pending);\n\n\t\temit Claimed(candidate, msg.sender, to, _pending);\n\t}\n\n\tfunction withdrawAndClaim(\n\t\taddress candidate,\n\t\tuint256 amount,\n\t\taddress to\n\t) public override {\n\t\tstake.voterClaim(candidate);\n\t\tVoterInfo storage voter = voters[candidate][msg.sender];\n\t\tuint256 accumulated = voter.amount * accPerShares[candidate] / ACC_PRECISION;\n\t\tuint256 _pending = accumulated - voter.rewardDebt;\n\t\tvoter.rewardDebt = accumulated - (amount * accPerShares[candidate] / ACC_PRECISION);\n\t\tvoter.amount = voter.amount - amount;\n\t\tvoteSupply[candidate] = voteSupply[candidate] - amount;\n\t\t// token.transfer(to, amount);\n\t\t// token.transfer(to, _pending);\n\t\ttoken.transfer(to, _pending + amount);\n\t\temit Claimed(candidate, msg.sender, to, _pending);\n\t\temit Withdrawn(candidate, msg.sender, to, amount);\n\t}\n\n\tfunction pendingReward(address candidate, address voter) public view returns (uint256 pending) {\n\t\tif (voteSupply[candidate] > 0) {\n\t\t\t(, uint256 pendingAllocation) = stake.pendingReward(candidate);\n\t\t\tuint256 rewardDebt = voters[candidate][voter].rewardDebt;\n\t\t\tuint256 pendingShares = accPerShares[candidate] + (pendingAllocation * ACC_PRECISION / voteSupply[candidate]);\n\t\t\tpending = voters[candidate][voter].amount * pendingShares / ACC_PRECISION - rewardDebt;\n\t\t}\n\t}\n\n\tfunction allocateRewardFor(address candidate, uint256 amount) public override onlyStake {\n\t\tif (voteSupply[candidate] > 0) {\n\t\t\taccPerShares[candidate] = accPerShares[candidate] + (amount * ACC_PRECISION / voteSupply[candidate]);\n\t\t\temit ShareUpdated(candidate);\n\t\t}\n\t}\n\n\tfunction _setStake(IStake _stake) internal {\n\t\tstake = _stake;\n\t\temit StakeUpdated(stake);\n\t}\n\n\tfunction _setToken(IERC20Upgradeable _token) internal {\n\t\ttoken = _token;\n\t\temit TokenUpdated(_token);\n\t}\n}\n"
    },
    "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
    },
    "contracts/interfaces/IStake.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\n\npragma solidity >=0.8.0;\n\nimport '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';\n\nimport './IRewarder.sol';\nimport './IElection.sol';\n\ninterface IStake {\n\n\tenum Grade {\n\t\tNull,\n\t\tMajor,\n\t\tSecondary,\n\t\tOptional\n\t}\n\n\tstruct CandidateInfo {\n\t\tGrade grade;\n\t\tuint256 amount;\n\t\tuint256 rewardDebt;\n\t}\n\n\tstruct PoolInfo {\n\t\tuint256 accPerShare;\n\t\tuint256 lastRewardBlock;\n\t\tuint256 allocPoint;\n\t\tuint256 minStake;\n\t}\n\n\tevent TokenUpdated(IERC20Upgradeable token);\n\n\tevent RewarderUpdated(IRewarder rewarder);\n\n\tevent ElectionUpdated(IElection election);\n\n\tevent RewardPerBlockUpdated(uint256 rewardPerBlock);\n\n\tevent AddPool(Grade grade);\n\n\tevent Register(Grade grade, address candidate);\n\n\tevent Stake(address from, address candidate, uint256 amount);\n\n\tevent Claimed(address from, address candidate, uint256 amount);\n\n\tevent Allocate(address candidate, uint256 amount);\n\n\tevent Withdrawn(address candidate, address to, uint256 amount);\n\n\tevent VoteRewardCoefUpdated(uint256 coef);\n\n\tevent Upgrade(address candidate, Grade fromGrade, Grade toGrade);\n\n\tevent Downgrade(address candidate, Grade fromGrade, Grade toGrade);\n\n\tfunction election() external view returns(IElection);\n\n\tfunction token() external view returns(IERC20Upgradeable);\n\n\tfunction rewarder() external view returns(IRewarder);\n\n\tfunction poolInfo(Grade grade) external returns(PoolInfo memory);\n\n\tfunction totalAllocPoint() external view returns(uint256);\n\n\tfunction rewardPerBlock() external view returns(uint256);\n\n\tfunction ACC_PRECISION() external view returns(uint256);\n\n\tfunction candidateInfo(address candidate) external view returns(CandidateInfo memory);\n\n\tfunction addPool(Grade grade, uint256 allocPoint, uint256 minStake) external;\n\n\tfunction voteRewardCoef(address candidate) external view returns (uint256 pending);\n\n\tfunction pendingReward(address candidate) external view returns (uint256 pending, uint256 pendingAllocation);\n\t\n\tfunction stake(\n\t\taddress candidate,\n\t\tuint256 amount\n\t) external;\n\n\tfunction updatePool(Grade grade) external returns (PoolInfo memory pool);\n\n\tfunction claim(address candidate) external returns(PoolInfo memory pool);\n\n\tfunction voterClaim(address candidate) external;\n\n\tfunction withdrawAndClaim(uint256 amount, address to) external;\n\n\tfunction setVoteRewardCoef(uint256 coef) external;\n\n\tfunction upgrade(address candidate) external;\n\n\tfunction downgrade(address candidate) external;\n\n}\n"
    },
    "contracts/interfaces/IElection.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\n\npragma solidity >=0.8.0;\n\nimport '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';\nimport './IStake.sol';\n\ninterface IElection {\n\n\tevent TokenUpdated(IERC20Upgradeable token);\n\n\tevent StakeUpdated(IStake stake);\n\n\tevent ShareUpdated(address candidate);\n\n\tevent Vote(address candidate, address voter, uint256 amount);\n\n\tevent Claimed(address candidate, address voter, address to, uint256 amount);\n\n\tevent Withdrawn(address candidate, address voter, address to, uint256 amount);\n\n\tfunction token() external view returns(IERC20Upgradeable);\n\n\tfunction stake() external view returns(IStake);\n\n\tfunction voteSupply(address to) external view returns(uint256);\n\n\tfunction ACC_PRECISION() external view returns(uint256);\n\n\tfunction allocateRewardFor(address to, uint256 amount) external;\n\n\tfunction vote(address to, address user, uint256 amount) external;\n\n\tfunction withdrawAndClaim(\n\t\taddress to,\n\t\tuint256 amount,\n\t\taddress receiver\n\t) external;\n}\n"
    },
    "contracts/MajorNodes.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\n\npragma solidity >=0.8.0;\n\nimport '@openzeppelin/contracts-upgradeable/utils/structs/EnumerableMapUpgradeable.sol';\nimport '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';\n\nabstract contract MajorNodes is Initializable {\n\tusing EnumerableMapUpgradeable for EnumerableMapUpgradeable.AddressToUintMap;\n\n\tEnumerableMapUpgradeable.AddressToUintMap internal nodes;\n\n\tuint256 public MAX_NODES_LENGTH;\n\n\tfunction __Init_MAX_NODES_LENGTH(uint256 length) internal onlyInitializing {\n\t\tMAX_NODES_LENGTH = length;\n\t}\n\n\tfunction majorNodesLength() public view returns (uint256) {\n\t\treturn nodes.length();\n\t}\n\n\tfunction resolveNode(address to, uint256 votes) internal returns(address input, address output) {\n\t\tif (nodes.contains(to)) {\n\t\t\tnodes.set(to, votes);\n\t\t\treturn (address(0), address(0));\n\t\t}\n\t\trequire(majorNodesLength() <= MAX_NODES_LENGTH, 'EnumerableNodes: invalid node length');\n\t\tif (majorNodesLength() == MAX_NODES_LENGTH) {\n\t\t\tuint256 minVotes;\n\t\t\tfor (uint8 i = 0; i < majorNodesLength(); i++) {\n\t\t\t\t(address c, uint256 cv) = nodes.at(i);\n\t\t\t\tif (minVotes == 0) {\n\t\t\t\t\toutput = c;\n\t\t\t\t\tminVotes = cv;\n\t\t\t\t} else if (cv < minVotes) {\n\t\t\t\t\toutput = c;\n\t\t\t\t\tminVotes = cv;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (votes > minVotes) {\n\t\t\t\tinput = to;\n\t\t\t\tnodes.set(to, votes);\n\t\t\t\tnodes.remove(output);\n\t\t\t}\n\t\t} else {\n\t\t\tnodes.set(to, votes);\n\t\t\tinput = to;\n\t\t\toutput = address(0);\n\t\t}\n\t}\n\n\tfunction majorNodeAt(uint256 index) public view returns(address, uint256) {\n\t\treturn nodes.at(index);\n\t}\n\n\tfunction getMajorNodeVotes(address to) public view returns(uint256) {\n\t\treturn nodes.get(to);\n\t}\n\n}\n"
    },
    "contracts/interfaces/IRewarder.sol": {
      "content": "\n// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.8.0;\n\nimport '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';\nimport './IStake.sol';\n\ninterface IRewarder {\n\n\tevent TokenUpdated(IERC20Upgradeable token);\n\n\tevent StakeUpdated(IStake stake);\n\n\tevent SendReward(address to, uint256 amount);\n\n\tfunction token() external view returns(IERC20Upgradeable);\n\n\tfunction sendReward(address to, uint256 amount) external;\n\n}"
    },
    "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableMapUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableMap.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./EnumerableSetUpgradeable.sol\";\n\n/**\n * @dev Library for managing an enumerable variant of Solidity's\n * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]\n * type.\n *\n * Maps have the following properties:\n *\n * - Entries are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Entries are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n *     // Add the library methods\n *     using EnumerableMap for EnumerableMap.UintToAddressMap;\n *\n *     // Declare a set state variable\n *     EnumerableMap.UintToAddressMap private myMap;\n * }\n * ```\n *\n * The following map types are supported:\n *\n * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0\n * - `address -> uint256` (`AddressToUintMap`) since v4.6.0\n * - `bytes32 -> bytes32` (`Bytes32ToBytes32`) since v4.6.0\n * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0\n * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0\n *\n * [WARNING]\n * ====\n *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n *  In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an array of EnumerableMap.\n * ====\n */\nlibrary EnumerableMapUpgradeable {\n    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.Bytes32Set;\n\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Map type with\n    // bytes32 keys and values.\n    // The Map implementation uses private functions, and user-facing\n    // implementations (such as Uint256ToAddressMap) are just wrappers around\n    // the underlying Map.\n    // This means that we can only create new EnumerableMaps for types that fit\n    // in bytes32.\n\n    struct Bytes32ToBytes32Map {\n        // Storage of keys\n        EnumerableSetUpgradeable.Bytes32Set _keys;\n        mapping(bytes32 => bytes32) _values;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(\n        Bytes32ToBytes32Map storage map,\n        bytes32 key,\n        bytes32 value\n    ) internal returns (bool) {\n        map._values[key] = value;\n        return map._keys.add(key);\n    }\n\n    /**\n     * @dev Removes a key-value pair from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {\n        delete map._values[key];\n        return map._keys.remove(key);\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {\n        return map._keys.contains(key);\n    }\n\n    /**\n     * @dev Returns the number of key-value pairs in the map. O(1).\n     */\n    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {\n        return map._keys.length();\n    }\n\n    /**\n     * @dev Returns the key-value pair stored at position `index` in the map. O(1).\n     *\n     * Note that there are no guarantees on the ordering of entries inside the\n     * array, and it may change when more entries are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {\n        bytes32 key = map._keys.at(index);\n        return (key, map._values[key]);\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`.  O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {\n        bytes32 value = map._values[key];\n        if (value == bytes32(0)) {\n            return (contains(map, key), bytes32(0));\n        } else {\n            return (true, value);\n        }\n    }\n\n    /**\n     * @dev Returns the value associated with `key`.  O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {\n        bytes32 value = map._values[key];\n        require(value != 0 || contains(map, key), \"EnumerableMap: nonexistent key\");\n        return value;\n    }\n\n    /**\n     * @dev Same as {_get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {_tryGet}.\n     */\n    function get(\n        Bytes32ToBytes32Map storage map,\n        bytes32 key,\n        string memory errorMessage\n    ) internal view returns (bytes32) {\n        bytes32 value = map._values[key];\n        require(value != 0 || contains(map, key), errorMessage);\n        return value;\n    }\n\n    // UintToUintMap\n\n    struct UintToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(\n        UintToUintMap storage map,\n        uint256 key,\n        uint256 value\n    ) internal returns (bool) {\n        return set(map._inner, bytes32(key), bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {\n        return remove(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {\n        return contains(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(UintToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the set. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (uint256(key), uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`.  O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`.  O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(key)));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        UintToUintMap storage map,\n        uint256 key,\n        string memory errorMessage\n    ) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(key), errorMessage));\n    }\n\n    // UintToAddressMap\n\n    struct UintToAddressMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(\n        UintToAddressMap storage map,\n        uint256 key,\n        address value\n    ) internal returns (bool) {\n        return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {\n        return remove(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {\n        return contains(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(UintToAddressMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the set. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (uint256(key), address(uint160(uint256(value))));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`.  O(1).\n     * Does not revert if `key` is not in the map.\n     *\n     * _Available since v3.4._\n     */\n    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));\n        return (success, address(uint160(uint256(value))));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`.  O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {\n        return address(uint160(uint256(get(map._inner, bytes32(key)))));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        UintToAddressMap storage map,\n        uint256 key,\n        string memory errorMessage\n    ) internal view returns (address) {\n        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));\n    }\n\n    // AddressToUintMap\n\n    struct AddressToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(\n        AddressToUintMap storage map,\n        address key,\n        uint256 value\n    ) internal returns (bool) {\n        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(AddressToUintMap storage map, address key) internal returns (bool) {\n        return remove(map._inner, bytes32(uint256(uint160(key))));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(AddressToUintMap storage map, address key) internal view returns (bool) {\n        return contains(map._inner, bytes32(uint256(uint160(key))));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(AddressToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the set. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (address(uint160(uint256(key))), uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`.  O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`.  O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(AddressToUintMap storage map, address key) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(uint256(uint160(key)))));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        AddressToUintMap storage map,\n        address key,\n        string memory errorMessage\n    ) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));\n    }\n\n    // Bytes32ToUintMap\n\n    struct Bytes32ToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(\n        Bytes32ToUintMap storage map,\n        bytes32 key,\n        uint256 value\n    ) internal returns (bool) {\n        return set(map._inner, key, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {\n        return remove(map._inner, key);\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {\n        return contains(map._inner, key);\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the set. O(1).\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (key, uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`.  O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, key);\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`.  O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {\n        return uint256(get(map._inner, key));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        Bytes32ToUintMap storage map,\n        bytes32 key,\n        string memory errorMessage\n    ) internal view returns (uint256) {\n        return uint256(get(map._inner, key, errorMessage));\n    }\n}\n"
    },
    "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initialized = 1;\n        if (isTopLevelCall) {\n            _initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n     * initialization step. This is essential to configure modules that are added through upgrades and that require\n     * initialization.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initialized = version;\n        _initializing = true;\n        _;\n        _initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     */\n    function _disableInitializers() internal virtual {\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized < type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n}\n"
    },
    "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSetUpgradeable {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        return _values(set._inner);\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"
    },
    "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n                /// @solidity memory-safe-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"
    },
    "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
    },
    "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    function __Ownable_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable_init_unchained() internal onlyInitializing {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
    },
    "contracts/Stake.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\n\npragma solidity >=0.8.0;\n\nimport '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';\nimport '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';\n\nimport './interfaces/IRewarder.sol';\nimport './interfaces/IStake.sol';\nimport './interfaces/IElection.sol';\n\ncontract Stake is IStake, OwnableUpgradeable {\n\tIERC20Upgradeable public override token;\n\n\tIElection public override election;\n\n\tIRewarder public override rewarder;\n\n\tuint256 public override totalAllocPoint;\n\n\tuint256 public override rewardPerBlock;\n\n\tuint256 public override ACC_PRECISION;\n\n\tuint256 public MAXCOEF;\n\n\tmapping(Grade => PoolInfo) internal pools;\n\n\tuint256 public voteRewardCoefFrozen = 1000;\n\n\tmapping(address => uint256) public override voteRewardCoef;\n\n\tmapping(address => CandidateInfo) internal candidates;\n\n\tmodifier validateGrade(Grade grade) {\n\t\trequire(grade != Grade.Null, 'Stake: invalid grade');\n\t\t_;\n\t}\n\n\tmodifier onlyElection() {\n\t\trequire(msg.sender == address(election), 'Stake: caller must be election contract');\n\t\t_;\n\t}\n\n\tfunction initialize(\n\t\taddress newOwner,\n\t\tIERC20Upgradeable _token,\n\t\tIElection _election,\n\t\tIRewarder _rewarder,\n\t\tuint256 _rewardPerBlock\n\t) external initializer {\n\t\t_transferOwnership(newOwner);\n\t\t_setToken(_token);\n\t\t_setElection(_election);\n\t\t_setRewarder(_rewarder);\n\t\t_setRewardPerBlock(_rewardPerBlock);\n\t\tACC_PRECISION = 1e12;\n\t\tMAXCOEF = 1e6;\n\t}\n\n\tfunction addPool(\n\t\tGrade grade,\n\t\tuint256 allocPoint,\n\t\tuint256 minStake\n\t) external override onlyOwner validateGrade(grade) {\n\t\trequire(pools[grade].allocPoint == 0, 'Stake: pool exists');\n\t\ttotalAllocPoint = totalAllocPoint + allocPoint;\n\t\tpools[grade] = PoolInfo({ allocPoint: allocPoint, lastRewardBlock: block.number, accPerShare: 0, minStake: minStake });\n\t\temit AddPool(grade);\n\t}\n\n\tfunction registerAndStake(Grade grade, uint256 amount) external validateGrade(grade) {\n\t\t_register(grade, msg.sender);\n\t\t_stake(msg.sender, msg.sender, amount);\n\t}\n\n\tfunction register(Grade grade) external validateGrade(grade) {\n\t\t_register(grade, msg.sender);\n\t}\n\n\tfunction _register(Grade grade, address candidate) internal {\n\t\trequire(candidates[candidate].grade == Grade.Null, 'Stake: candidate has been registered');\n\t\trequire(grade == Grade.Major || grade == Grade.Secondary || grade == Grade.Optional, 'Stake: invalid grade');\n\t\tcandidates[candidate].grade = grade;\n\t\temit Register(grade, candidate);\n\t}\n\n\tfunction stake(address candidate, uint256 amount) public override {\n\t\t_stake(msg.sender, candidate, amount);\n\t}\n\n\tfunction _stake(\n\t\taddress user,\n\t\taddress _candidate,\n\t\tuint256 amount\n\t) internal {\n\t\trequire(isRegistered(_candidate), 'Stake: candidate is not registered');\n\t\tCandidateInfo storage candidate = candidates[_candidate];\n\t\tPoolInfo memory pool;\n\t\tif (voteRewardCoef[_candidate] > 0) {\n\t\t\tpool = _claim(_candidate, _candidate);\n\t\t} else {\n\t\t\tpool = updatePool(candidate.grade);\n\t\t}\n\t\trequire(amount + candidate.amount >= pool.minStake, 'Stake: amount is less than minimum stake');\n\t\tcandidate.amount = candidate.amount + amount;\n\t\tcandidate.rewardDebt = candidate.rewardDebt + (amount * pool.accPerShare / ACC_PRECISION);\n\t\ttoken.transferFrom(user, address(this), amount);\n\n\t\temit Stake(user, _candidate, amount);\n\t}\n\n\tfunction upgrade(address candidate) external override onlyElection {\n\t\tif (gradeOf(candidate) == Grade.Secondary) {\n\t\t\t_onCandidateGradeChanged(candidate, Grade.Major);\n\t\t\temit Upgrade(candidate, Grade.Secondary, Grade.Major);\n\t\t}\n\t}\n\n\tfunction downgrade(address candidate) external override onlyElection {\n\t\tif (gradeOf(candidate) == Grade.Major) {\n\t\t\t_onCandidateGradeChanged(candidate, Grade.Secondary);\n\t\t\temit Downgrade(candidate, Grade.Major, Grade.Secondary);\n\t\t}\n\t}\n\n\tfunction _onCandidateGradeChanged(address _candidate, Grade grade) internal {\n\t\tCandidateInfo storage candidate = candidates[_candidate];\n\t\tcandidate.grade = grade;\n\t\tPoolInfo memory pool = updatePool(grade);\n\t\tcandidate.rewardDebt = candidate.amount * pool.accPerShare / ACC_PRECISION;\n\t}\n\n\tfunction updatePool(Grade grade) public override returns (PoolInfo memory pool) {\n\t\tpool = pools[grade];\n\t\tif (block.number > pool.lastRewardBlock) {\n\t\t\tuint256 lpSupply = token.balanceOf(address(this));\n\t\t\tif (lpSupply > 0) {\n\t\t\t\tuint256 blocks = block.number - pool.lastRewardBlock;\n\t\t\t\tuint256 reward = blocks * rewardPerBlock * pool.allocPoint / totalAllocPoint;\n\t\t\t\tpool.accPerShare = pool.accPerShare + (reward * ACC_PRECISION / lpSupply);\n\t\t\t}\n\t\t\tpool.lastRewardBlock = block.number;\n\t\t\tpools[grade] = pool;\n\t\t}\n\t}\n\n\tfunction claim(address candidate) public override returns (PoolInfo memory pool) {\n\t\treturn _claim(msg.sender, candidate);\n\t}\n\n\tfunction voterClaim(address candidate) external override onlyElection {\n\t\trequire(gradeOf(candidate) == Grade.Major || gradeOf(candidate) == Grade.Secondary, 'Stake: candidate can not be voted');\n\t\t_claim(candidate, candidate);\n\t}\n\n\tfunction _claim(address _candidate, address to) internal returns (PoolInfo memory pool) {\n\t\tCandidateInfo storage candidate = candidates[_candidate];\n\t\tpool = updatePool(candidate.grade);\n\t\tuint256 accumulated = candidate.amount * pool.accPerShare / ACC_PRECISION;\n\t\tuint256 _pending = accumulated - candidate.rewardDebt;\n\t\tcandidate.rewardDebt = accumulated;\n\t\t_allocateReward(_candidate, to, _pending);\n\t}\n\n\tfunction withdrawAndClaim(uint256 amount, address to) public override {\n\t\tCandidateInfo storage candidate = candidates[msg.sender];\n\t\tPoolInfo memory pool = updatePool(candidate.grade);\n\t\tuint256 accumulated = candidate.amount * pool.accPerShare / ACC_PRECISION;\n\t\tuint256 _pending = accumulated - candidate.rewardDebt;\n\t\tcandidate.rewardDebt = accumulated - (amount * pool.accPerShare / ACC_PRECISION);\n\t\tcandidate.amount = candidate.amount - amount;\n\t\t_allocateReward(msg.sender, to, _pending);\n\t\ttoken.transfer(to, amount);\n\n\t\temit Withdrawn(msg.sender, to, amount);\n\t}\n\n\tfunction _allocateReward(\n\t\taddress _candidate,\n\t\taddress to,\n\t\tuint256 _pending\n\t) internal {\n\t\tif (_pending > 0) {\n\t\t\tif (voteRewardCoef[_candidate] > 0 && election.voteSupply(_candidate) > 0) {\n\t\t\t\tuint256 allocation = _pending * voteRewardCoef[_candidate] / MAXCOEF;\n\t\t\t\telection.allocateRewardFor(_candidate, allocation);\n\t\t\t\t_pending = _pending - allocation;\n\t\t\t\trewarder.sendReward(address(election), allocation);\n\t\t\t\temit Allocate(_candidate, allocation);\n\t\t\t}\n\t\t\trewarder.sendReward(to, _pending);\n\t\t\temit Claimed(_candidate, to, _pending);\n\t\t}\n\t}\n\n\tfunction setVoteRewardCoef(uint256 coef) public override {\n\t\t_setVoteRewardCoef(msg.sender, coef);\n\t}\n\n\tfunction _setVoteRewardCoef(address candidate, uint256 coef) internal {\n\t\trequire(coef > 0 && coef < MAXCOEF, 'Stake: invalid coef');\n\t\trequire(isRegistered(candidate), 'Stake: candidate is not registered');\n\t\trequire(gradeOf(candidate) == Grade.Major || gradeOf(candidate) == Grade.Secondary, 'Stake: candidate is not allowed to set reward coefficient');\n\t\t_claim(candidate, candidate);\n\t\tvoteRewardCoef[candidate] = coef;\n\t\temit VoteRewardCoefUpdated(coef);\n\t}\n\n\tfunction _setRewardPerBlock(uint256 _rewardPerBlock) internal {\n\t\trewardPerBlock = _rewardPerBlock;\n\t\temit RewardPerBlockUpdated(_rewardPerBlock);\n\t}\n\n\tfunction _setElection(IElection _election) internal {\n\t\telection = _election;\n\t\temit ElectionUpdated(_election);\n\t}\n\n\tfunction _setRewarder(IRewarder _rewarder) internal {\n\t\trewarder = _rewarder;\n\t\temit RewarderUpdated(_rewarder);\n\t}\n\n\tfunction _setToken(IERC20Upgradeable _token) internal {\n\t\ttoken = _token;\n\t\temit TokenUpdated(_token);\n\t}\n\n\tfunction poolInfo(Grade grade) external view override returns (PoolInfo memory) {\n\t\treturn pools[grade];\n\t}\n\n\tfunction candidateInfo(address candidate) external view override returns (CandidateInfo memory) {\n\t\treturn candidates[candidate];\n\t}\n\n\tfunction pendingReward(address _candidate) public view override returns (uint256 pending, uint256 pendingAllocation) {\n\t\tCandidateInfo storage candidate = candidates[_candidate];\n\t\tPoolInfo memory pool = pools[candidate.grade];\n\t\tuint256 accPerShare = pool.accPerShare;\n\t\tuint256 lpSupply = token.balanceOf(address(this));\n\t\tif (block.number > pool.lastRewardBlock && lpSupply != 0) {\n\t\t\tuint256 blocks = block.number - pool.lastRewardBlock;\n\t\t\tuint256 reward = blocks * rewardPerBlock * pool.allocPoint / totalAllocPoint;\n\t\t\taccPerShare = accPerShare + (reward * ACC_PRECISION / lpSupply);\n\t\t}\n\t\tpending = candidate.amount * accPerShare / ACC_PRECISION - candidate.rewardDebt;\n\t\tif (voteRewardCoef[_candidate] > 0 && election.voteSupply(_candidate) > 0) {\n\t\t\tpendingAllocation = pending * voteRewardCoef[_candidate] / MAXCOEF;\n\t\t\tpending = pending - pendingAllocation;\n\t\t}\n\t}\n\n\tfunction isRegistered(address candidate) public view returns (bool) {\n\t\treturn candidates[candidate].grade != Grade.Null;\n\t}\n\n\tfunction gradeOf(address candidate) public view returns (Grade) {\n\t\treturn candidates[candidate].grade;\n\t}\n}\n"
    },
    "contracts/Rewarder.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-only\n\npragma solidity >=0.8.0;\n\nimport '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';\nimport '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';\nimport './interfaces/IRewarder.sol';\n\ncontract Rewarder is IRewarder, Initializable {\n\n\tIERC20Upgradeable public override token;\n\n\tIStake public stake;\n\n\tmodifier onlyStake() {\n\t\trequire(msg.sender == address(stake), 'Rewarder: caller is not stake contract');\n\t\t_;\n\t}\n\n\tfunction initialize(IERC20Upgradeable _token, IStake _stake) external initializer {\n\t\t_setToken(_token);\n\t\t_setStake(_stake);\n\t}\n\n\tfunction _setToken(IERC20Upgradeable _token) internal {\n\t\ttoken = _token;\n\t\temit TokenUpdated(token);\n\t}\n\n\tfunction _setStake(IStake _stake) internal {\n\t\tstake = _stake;\n\t\temit StakeUpdated(stake);\n\t}\n\n\tfunction sendReward(address to, uint256 amount) external override onlyStake {\n\t\ttoken.transfer(to, amount);\n\t\temit SendReward(to, amount);\n\t}\n\n}\n"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200,
      "details": {
        "yul": false
      }
    },
    "outputSelection": {
      "*": {
        "*": [
          "storageLayout",
          "abi",
          "evm.bytecode",
          "evm.deployedBytecode",
          "evm.methodIdentifiers",
          "metadata",
          "devdoc",
          "userdoc",
          "evm.gasEstimates"
        ],
        "": [
          "ast"
        ]
      }
    },
    "metadata": {
      "useLiteralContent": true
    }
  }
}