{
    "Function": "slitherConstructorVariables",
    "File": "contracts/VoterID.sol",
    "Parent Contracts": [
        "interfaces/IVoterID.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract VoterID is IVoterID {\n\n    // mapping from tokenId to owner of that tokenId\n    mapping (uint => address) public owners;\n    // mapping from address to amount of NFTs they own\n    mapping (address => uint) public balances;\n\n    // Mapping from owner to operator approvals\n    mapping (address => mapping (address => bool)) public operatorApprovals;\n    // weird single-address-per-token-id mapping (why not just use operatorApprovals??)\n    mapping (uint => address) public tokenApprovals;\n\n    // forward and backward mappings used for enumerable standard\n    // owner -> array of tokens owned...  ownershipMapIndexToToken[owner][index] = tokenNumber\n    // owner -> array of tokens owned...  ownershipMapTokenToIndex[owner][tokenNumber] = index\n    mapping (address => mapping (uint => uint)) public ownershipMapIndexToToken;\n    mapping (address => mapping (uint => uint)) public ownershipMapTokenToIndex;\n\n    // array-like map of all tokens in existence #enumeration\n    mapping (uint => uint) public allTokens;\n\n    // tokenId -> uri ... typically ipfs://...\n    mapping (uint => string) public uriMap;\n\n    // Equals to `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`\n    bytes4 private constant ERC721_RECEIVED = 0x150b7a02;\n\n    /*\n     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231\n     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e\n     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3\n     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc\n     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465\n     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5\n     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd\n     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e\n     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde\n     *\n     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^\n     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd\n     */\n    bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd;\n\n    /*\n     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7\n     */\n    bytes4 private constant INTERFACE_ID_ERC165 = 0x01ffc9a7;\n\n    bytes4 private constant INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;\n    bytes4 private constant INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;\n\n    string _name;\n    string _symbol;\n\n    // count the number of NFTs minted\n    uint public numIdentities = 0;\n\n    // owner is a special name in the OpenZeppelin standard that opensea annoyingly expects for their management page\n    address public _owner_;\n    // minter has the sole, permanent authority to mint identities, in practice this will be a contract\n    address public _minter;\n\n    event OwnerUpdated(address oldOwner, address newOwner);\n    event IdentityCreated(address indexed owner, uint indexed token);\n\n\n    /// @dev This emits when ownership of any NFT changes by any mechanism.\n    ///  This event emits when NFTs are created (`from` == 0) and destroyed\n    ///  (`to` == 0). Exception: during contract creation, any number of NFTs\n    ///  may be created and assigned without emitting Transfer. At the time of\n    ///  any transfer, the approved address for that NFT (if any) is reset to none.\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /// @dev This emits when the approved address for an NFT is changed or\n    ///  reaffirmed. The zero address indicates there is no approved address.\n    ///  When a Transfer event emits, this also indicates that the approved\n    ///  address for that NFT (if any) is reset to none.\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /// @dev This emits when an operator is enabled or disabled for an owner.\n    ///  The operator can manage all NFTs of the owner.\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    modifier ownerOnly() {\n        require (msg.sender == _owner_, 'Identity: Only owner may call this');\n        _;\n    }\n\n    /// @notice Whoever deploys the contract determines the name, symbol and owner. Minter should be MerkleIdentity contract\n    /// @dev names are misspelled on purpose because we already have owners and _owner_ and _name and...\n    /// @param ooner the owner of this contract\n    /// @param minter address (MerkleIdentity contract) that can mint NFTs in this series\n    /// @param nomen name of the NFT series\n    /// @param symbowl symbol for the NFT series\n    constructor(address ooner, address minter, string memory nomen, string memory symbowl) {\n        _owner_ = ooner;\n        // we set it here with no resetting allowed so we cannot commit to NFTs and then reset\n        _minter = minter;\n        _name = nomen;\n        _symbol = symbowl;\n    }\n\n    /// @notice Create a new NFT in this series, with the given tokenId and uri\n    /// @dev All permissions around minting should be done thru MerkleIdentity and it's associate gates\n    /// @dev Only the minter contract can call this, and duplicate tokenIds are not allowed\n    /// @param thisOwner the owner of this particular NFT, not the owner of the contract\n    /// @param thisToken the tokenId that the newly NFT will have\n    /// @param uri the metadata string that this NFT will have\n    function createIdentityFor(address thisOwner, uint thisToken, string memory uri) public override {\n        require(msg.sender == _minter, 'Only minter may create identity');\n        require(owners[thisToken] == address(0), 'Token already exists');\n\n        // for getTokenByIndex below, 0 based index so we do it before incrementing numIdentities\n        allTokens[numIdentities] = thisToken;\n\n        // increment the number of identities\n        numIdentities = numIdentities + 1;\n\n        // two way mapping for enumeration\n        ownershipMapIndexToToken[thisOwner][balances[thisOwner]] = thisToken;\n        ownershipMapTokenToIndex[thisOwner][thisToken] = balances[thisOwner];\n\n\n        // set owner of new token\n        owners[thisToken] = thisOwner;\n        // increment balances for owner\n        balances[thisOwner] = balances[thisOwner] + 1;\n        uriMap[thisToken] = uri;\n        emit Transfer(address(0), thisOwner, thisToken);\n        emit IdentityCreated(thisOwner, thisToken);\n    }\n\n    /// ================= SETTERS =======================================\n\n    /// @notice Changing the owner key\n    /// @dev Only current owner may do this\n    /// @param newOwner the new address that will be owner, old address is no longer owner\n    function setOwner(address newOwner) external ownerOnly {\n        address oldOwner = _owner_;\n        _owner_ = newOwner;\n        emit OwnerUpdated(oldOwner, newOwner);\n    }\n\n    // manually set the token URI\n    /// @notice Manually set the token URI\n    /// @dev This is just a backup in case some metadata goes wrong, this is basically the only thing the owner can do\n    /// @param token tokenId that we are setting metadata for\n    /// @param uri metadata that will be associated to this token\n    function setTokenURI(uint token, string memory uri) external ownerOnly {\n        uriMap[token] = uri;\n    }\n\n    /// ================= ERC 721 FUNCTIONS =============================================\n\n    /// @notice Count all NFTs assigned to an owner\n    /// @dev NFTs assigned to the zero address are considered invalid, and this\n    ///  function throws for queries about the zero address.\n    /// @param _address An address for whom to query the balance\n    /// @return The number of NFTs owned by `owner`, possibly zero\n    function balanceOf(address _address) external view returns (uint256) {\n        return balances[_address];\n    }\n\n    /// @notice Find the owner of an NFT\n    /// @dev NFTs assigned to zero address are considered invalid, and queries\n    ///  about them do throw.\n    /// @param tokenId The identifier for an NFT\n    /// @return The address of the owner of the NFT\n    function ownerOf(uint256 tokenId) external view returns (address)  {\n        address ooner = owners[tokenId];\n        require(ooner != address(0), 'No such token');\n        return ooner;\n    }\n\n    /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n    ///  TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n    ///  THEY MAY BE PERMANENTLY LOST\n    /// @dev Throws unless `msg.sender` is the current owner, an authorized\n    ///  operator, or the approved address for this NFT. Throws if `from` is\n    ///  not the current owner. Throws if `to` is the zero address. Throws if\n    ///  `tokenId` is not a valid NFT.\n    /// @param from The current owner of the NFT\n    /// @param to The new owner\n    /// @param tokenId The NFT to transfer\n    function transferFrom(address from, address to, uint256 tokenId) public {\n        require(isApproved(msg.sender, tokenId), 'Identity: Unapproved transfer');\n        transfer(from, to, tokenId);\n    }\n\n    /// @notice Transfers the ownership of an NFT from one address to another address\n    /// @dev Throws unless `msg.sender` is the current owner, an authorized\n    ///  operator, or the approved address for this NFT. Throws if `from` is\n    ///  not the current owner. Throws if `to` is the zero address. Throws if\n    ///  `tokenId` is not a valid NFT. When transfer is complete, this function\n    ///  checks if `to` is a smart contract (code size > 0). If so, it calls\n    ///  `onERC721Received` on `to` and throws if the return value is not\n    ///  `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n    /// @param from The current owner of the NFT\n    /// @param to The new owner\n    /// @param tokenId The NFT to transfer\n    /// @param data Additional data with no specified format, sent in call to `to`\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public {\n        transferFrom(from, to, tokenId);\n        require(checkOnERC721Received(from, to, tokenId, data), \"Identity: transfer to non ERC721Receiver implementer\");\n    }\n\n    /// @notice Transfers the ownership of an NFT from one address to another address\n    /// @dev This works identically to the other function with an extra data parameter,\n    ///  except this function just sets data to \"\".\n    /// @param from The current owner of the NFT\n    /// @param to The new owner\n    /// @param tokenId The NFT to transfer\n    function safeTransferFrom(address from, address to, uint256 tokenId) public {\n        safeTransferFrom(from, to, tokenId, '');\n    }\n\n\n    /// @notice Change or reaffirm the approved address for an NFT\n    /// @dev The zero address indicates there is no approved address.\n    ///  Throws unless `msg.sender` is the current NFT owner, or an authorized\n    ///  operator of the current owner.\n    /// @param approved The new approved NFT controller\n    /// @param tokenId The NFT to approve\n    function approve(address approved, uint256 tokenId) public {\n        address holder = owners[tokenId];\n        require(isApproved(msg.sender, tokenId), 'Identity: Not authorized to approve');\n        require(holder != approved, 'Identity: Approving self not allowed');\n        tokenApprovals[tokenId] = approved;\n        emit Approval(holder, approved, tokenId);\n    }\n\n    /// @notice Enable or disable approval for a third party (\"operator\") to manage\n    ///  all of `msg.sender`'s assets\n    /// @dev Emits the ApprovalForAll event. The contract MUST allow\n    ///  multiple operators per owner.\n    /// @param operator Address to add to the set of authorized operators\n    /// @param approved True if the operator is approved, false to revoke approval\n    function setApprovalForAll(address operator, bool approved) external {\n        operatorApprovals[msg.sender][operator] = approved;\n        emit ApprovalForAll(msg.sender, operator, approved);\n    }\n\n    /// @notice Get the approved address for a single NFT\n    /// @dev Throws if `tokenId` is not a valid NFT.\n    /// @param tokenId The NFT to find the approved address for\n    /// @return The approved address for this NFT, or the zero address if there is none\n    function getApproved(uint256 tokenId) external view returns (address) {\n        address holder = owners[tokenId];\n        require(holder != address(0), 'Identity: Invalid tokenId');\n        return tokenApprovals[tokenId];\n    }\n\n    /// @notice Query if an address is an authorized operator for another address\n    /// @param _address The address that owns the NFTs\n    /// @param operator The address that acts on behalf of the owner\n    /// @return True if `operator` is an approved operator for `owner`, false otherwise\n    function isApprovedForAll(address _address, address operator) public view returns (bool) {\n        return operatorApprovals[_address][operator];\n    }\n\n    /// ================ UTILS =========================\n\n    /// @notice Look thru all 3 (???) notions of approval for one that matches\n    /// @dev There was a bug in this part of the contract when it was originally forked from OpenZeppelin\n    /// @param operator the address whose approval we are querying\n    /// @param tokenId the specific NFT about which we are querying approval\n    /// @return approval is the operator approved to transfer this tokenId?\n    function isApproved(address operator, uint tokenId) public view returns (bool) {\n        address holder = owners[tokenId];\n        return (\n            operator == holder ||\n            operatorApprovals[holder][operator] ||\n            tokenApprovals[tokenId] == operator\n        );\n    }\n\n    /**\n     * @notice Standard NFT transfer logic\n     * @dev Transfers `tokenId` from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     *\n     * Emits a {Transfer} event.\n     * @param from current owner of the NFT\n     * @param to new owner of the NFT\n     * @param tokenId which NFT is getting transferred\n     */\n    function transfer(address from, address to, uint256 tokenId) internal {\n        require(owners[tokenId] == from, \"Identity: Transfer of token that is not own\");\n        require(to != address(0), \"Identity: transfer to the zero address\");\n\n        // Clear approvals from the previous owner\n        approve(address(0), tokenId);\n\n        owners[tokenId] = to;\n\n        // update balances\n        balances[from] -= 1;\n\n\n        // zero out two way mapping\n        uint ownershipIndex = ownershipMapTokenToIndex[from][tokenId];\n        ownershipMapTokenToIndex[from][tokenId] = 0;\n        if (ownershipIndex != balances[from]) {\n            uint reslottedToken = ownershipMapIndexToToken[from][balances[from]];\n            ownershipMapIndexToToken[from][ownershipIndex] = reslottedToken;\n            ownershipMapIndexToToken[from][balances[from]] = 0;\n            ownershipMapTokenToIndex[from][reslottedToken] = ownershipIndex;\n        } else {\n            ownershipMapIndexToToken[from][ownershipIndex] = 0;\n        }\n\n        // set two way mapping\n        ownershipMapIndexToToken[to][balances[to]] = tokenId;\n        ownershipMapTokenToIndex[to][tokenId] = balances[to];\n\n        balances[to] += 1;\n\n\n        emit Transfer(from, to, tokenId);\n    }\n\n    /// @notice Query if an address is an EOA or a contract\n    /// @dev This relies on extcodesize, an EVM command that returns 0 for EOAs\n    /// @param account the address in question\n    /// @return nonzeroSize true if there is a contract currently deployed to that address\n    function isContract(address account) internal view returns (bool) {\n\n        uint256 size;\n        // solhint-disable-next-line no-inline-assembly\n        assembly { size := extcodesize(account) }\n        return size > 0;\n    }\n\n    /**\n     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n     * The call is not executed if the target address is not a contract.\n     *\n     * @param from address representing the previous owner of the given token ID\n     * @param to target address that will receive the tokens\n     * @param tokenId uint256 ID of the token to be transferred\n     * @param data bytes optional data to send along with the call\n     * @return bool whether the call correctly returned the expected magic value\n     */\n    function checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data)\n        private returns (bool)\n    {\n        if (!isContract(to)) {\n            return true;\n        }\n        IERC721Receiver target = IERC721Receiver(to);\n        bytes4 retval = target.onERC721Received(from, to, tokenId, data);\n        return ERC721_RECEIVED == retval;\n    }\n\n    /**\n     * @notice ERC165 function to tell other contracts which interfaces we support\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     * @dev This whole interface thing is a little pointless, because contracts can lie or mis-implement the interface\n     * @dev so you might as well just use a try catch\n     * @param interfaceId the first four bytes of the hash of the signatures of the functions of the interface in question\n     * @return supports true if the interface is supported, false otherwise\n     */\n    function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n        return (\n            interfaceId == INTERFACE_ID_ERC721 ||\n            interfaceId == INTERFACE_ID_ERC165 ||\n            interfaceId == INTERFACE_ID_ERC721_ENUMERABLE ||\n            interfaceId == INTERFACE_ID_ERC721_METADATA\n        );\n    }\n\n    /// ================= ERC721Metadata FUNCTIONS =============================================\n\n    /// @notice A descriptive name for a collection of NFTs in this contract\n    function name() external view returns (string memory) {\n        return _name;\n    }\n\n    /// @notice An abbreviated name for NFTs in this contract\n    function symbol() external view returns (string memory) {\n        return _symbol;\n    }\n\n    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n    /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n    ///  3986. The URI may point to a JSON file that conforms to the \"ERC721\n    ///  Metadata JSON Schema\".\n    /// @return uri the tokenUri for a specific tokenId\n    function tokenURI(uint256 _tokenId) external view returns (string memory) {\n        return uriMap[_tokenId];\n    }\n\n    /// @notice The address that can set the tokenUri for tokens\n    /// @return The address that can set the tokenUri for tokens\n    function owner() public view override returns (address) {\n        return _owner_;\n    }\n\n    /// ================= ERC721Enumerable FUNCTIONS =============================================\n\n\n    /// @notice Count NFTs tracked by this contract\n    /// @return A count of valid NFTs tracked by this contract, where each one of\n    ///  them has an assigned and queryable owner not equal to the zero address\n    function totalSupply() external view override returns (uint256) {\n        return numIdentities;\n    }\n\n    /// @notice Enumerate valid NFTs\n    /// @dev Throws if `_index` >= `totalSupply()`.\n    /// @param _index A counter less than `totalSupply()`\n    /// @return The token identifier for the `_index`th NFT,\n    ///  (sort order not specified)\n    function tokenByIndex(uint256 _index) external view returns (uint256) {\n        require(_index < numIdentities, 'Invalid token index');\n        return allTokens[_index];\n    }\n\n    /// @notice Enumerate NFTs assigned to an owner\n    /// @dev Throws if `_index` >= `balanceOf(_owner_)` or if\n    ///  `_owner_` is the zero address, representing invalid NFTs.\n    /// @param _address An address where we are interested in NFTs owned by them\n    /// @param _index A counter less than `balanceOf(_owner_)`\n    /// @return The token identifier for the `_index`th NFT assigned to `_owner_`,\n    ///   (sort order not specified)\n    function tokenOfOwnerByIndex(address _address, uint256 _index) external view returns (uint256) {\n        require(_index < balances[_address], 'Index out of range');\n        require(_address != address(0), 'Cannot query zero address');\n        return ownershipMapIndexToToken[_address][_index];\n    }\n\n\n}"
}