{
    "Function": "slitherConstructorConstantVariables",
    "File": "src/AxelarGatewaySinglesig.sol",
    "Parent Contracts": [
        "src/AxelarGateway.sol",
        "src/AdminMultisigBase.sol",
        "src/EternalStorage.sol",
        "src/interfaces/IAxelarGatewaySinglesig.sol",
        "src/interfaces/IAxelarGateway.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)",
        "keccak256(bytes)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract AxelarGatewaySinglesig is IAxelarGatewaySinglesig, AxelarGateway {\n    error InvalidAddress();\n    error NotProxy();\n    error InvalidChainId();\n    error InvalidCommands();\n\n    bytes32 internal constant KEY_OWNER_EPOCH = keccak256('owner-epoch');\n\n    bytes32 internal constant PREFIX_OWNER = keccak256('owner');\n\n    bytes32 internal constant KEY_OPERATOR_EPOCH = keccak256('operator-epoch');\n\n    bytes32 internal constant PREFIX_OPERATOR = keccak256('operator');\n\n    constructor(address tokenDeployer) AxelarGateway(tokenDeployer) {}\n\n    /********************\\\n    |* Pure Key Getters *|\n    \\********************/\n\n    function _getOwnerKey(uint256 ownerEpoch) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(PREFIX_OWNER, ownerEpoch));\n    }\n\n    function _getOperatorKey(uint256 operatorEpoch) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(PREFIX_OPERATOR, operatorEpoch));\n    }\n\n    /***********\\\n    |* Getters *|\n    \\***********/\n\n    function _ownerEpoch() internal view returns (uint256) {\n        return getUint(KEY_OWNER_EPOCH);\n    }\n\n    function _getOwner(uint256 ownerEpoch) internal view returns (address) {\n        return getAddress(_getOwnerKey(ownerEpoch));\n    }\n\n    /// @dev Returns true if a `account` is owner within the last `OLD_KEY_RETENTION + 1` owner epochs (excluding the current one).\n    function _isValidPreviousOwner(address account) internal view returns (bool) {\n        uint256 ownerEpoch = _ownerEpoch();\n        uint256 recentEpochs = OLD_KEY_RETENTION + uint256(1);\n        uint256 lowerBoundOwnerEpoch = ownerEpoch > recentEpochs ? ownerEpoch - recentEpochs : uint256(0);\n\n        --ownerEpoch;\n        while (ownerEpoch > lowerBoundOwnerEpoch) {\n            if (account == _getOwner(ownerEpoch--)) return true;\n        }\n\n        return false;\n    }\n\n    function owner() public view override returns (address) {\n        return _getOwner(_ownerEpoch());\n    }\n\n    function _operatorEpoch() internal view returns (uint256) {\n        return getUint(KEY_OPERATOR_EPOCH);\n    }\n\n    function _getOperator(uint256 operatorEpoch) internal view returns (address) {\n        return getAddress(_getOperatorKey(operatorEpoch));\n    }\n\n    /// @dev Returns true if a `account` is operator within the last `OLD_KEY_RETENTION + 1` operator epochs.\n    function _isValidRecentOperator(address account) internal view returns (bool) {\n        uint256 operatorEpoch = _operatorEpoch();\n        uint256 recentEpochs = OLD_KEY_RETENTION + uint256(1);\n        uint256 lowerBoundOperatorEpoch = operatorEpoch > recentEpochs ? operatorEpoch - recentEpochs : uint256(0);\n\n        while (operatorEpoch > lowerBoundOperatorEpoch) {\n            if (account == _getOperator(operatorEpoch--)) return true;\n        }\n\n        return false;\n    }\n\n    function operator() public view override returns (address) {\n        return _getOperator(_operatorEpoch());\n    }\n\n    /***********\\\n    |* Setters *|\n    \\***********/\n\n    function _setOwnerEpoch(uint256 ownerEpoch) internal {\n        _setUint(KEY_OWNER_EPOCH, ownerEpoch);\n    }\n\n    function _setOwner(uint256 ownerEpoch, address account) internal {\n        _setAddress(_getOwnerKey(ownerEpoch), account);\n    }\n\n    function _setOperatorEpoch(uint256 operatorEpoch) internal {\n        _setUint(KEY_OPERATOR_EPOCH, operatorEpoch);\n    }\n\n    function _setOperator(uint256 operatorEpoch, address account) internal {\n        _setAddress(_getOperatorKey(operatorEpoch), account);\n    }\n\n    /**********************\\\n    |* Self Functionality *|\n    \\**********************/\n\n    function deployToken(bytes calldata params, bytes32) external onlySelf {\n        (string memory name, string memory symbol, uint8 decimals, uint256 cap, address tokenAddr) = abi.decode(\n            params,\n            (string, string, uint8, uint256, address)\n        );\n\n        _deployToken(name, symbol, decimals, cap, tokenAddr);\n    }\n\n    function mintToken(bytes calldata params, bytes32) external onlySelf {\n        (string memory symbol, address account, uint256 amount) = abi.decode(params, (string, address, uint256));\n\n        _mintToken(symbol, account, amount);\n    }\n\n    function burnToken(bytes calldata params, bytes32) external onlySelf {\n        (string memory symbol, bytes32 salt) = abi.decode(params, (string, bytes32));\n\n        _burnToken(symbol, salt);\n    }\n\n    function approveContractCall(bytes calldata params, bytes32 commandId) external onlySelf {\n        (\n            string memory sourceChain,\n            string memory sourceAddress,\n            address contractAddress,\n            bytes32 payloadHash,\n            bytes32 sourceTxHash,\n            uint256 sourceEventIndex\n        ) = abi.decode(params, (string, string, address, bytes32, bytes32, uint256));\n\n        _approveContractCall(\n            commandId,\n            sourceChain,\n            sourceAddress,\n            contractAddress,\n            payloadHash,\n            sourceTxHash,\n            sourceEventIndex\n        );\n    }\n\n    function approveContractCallWithMint(bytes calldata params, bytes32 commandId) external onlySelf {\n        (\n            string memory sourceChain,\n            string memory sourceAddress,\n            address contractAddress,\n            bytes32 payloadHash,\n            string memory symbol,\n            uint256 amount,\n            bytes32 sourceTxHash,\n            uint256 sourceEventIndex\n        ) = abi.decode(params, (string, string, address, bytes32, string, uint256, bytes32, uint256));\n\n        _approveContractCallWithMint(\n            commandId,\n            sourceChain,\n            sourceAddress,\n            contractAddress,\n            payloadHash,\n            symbol,\n            amount,\n            sourceTxHash,\n            sourceEventIndex\n        );\n    }\n\n    function transferOwnership(bytes calldata params, bytes32) external onlySelf {\n        address newOwner = abi.decode(params, (address));\n        uint256 ownerEpoch = _ownerEpoch();\n\n        if (newOwner == address(0)) revert InvalidAddress();\n\n        emit OwnershipTransferred(_getOwner(ownerEpoch), newOwner);\n\n        _setOwnerEpoch(++ownerEpoch);\n        _setOwner(ownerEpoch, newOwner);\n    }\n\n    function transferOperatorship(bytes calldata params, bytes32) external onlySelf {\n        address newOperator = abi.decode(params, (address));\n\n        if (newOperator == address(0)) revert InvalidAddress();\n\n        emit OperatorshipTransferred(operator(), newOperator);\n\n        uint256 operatorEpoch = _operatorEpoch();\n        _setOperatorEpoch(++operatorEpoch);\n        _setOperator(operatorEpoch, newOperator);\n    }\n\n    /**************************\\\n    |* External Functionality *|\n    \\**************************/\n\n    function setup(bytes calldata params) external override {\n        // Prevent setup from being called on a non-proxy (the implementation).\n        if (implementation() == address(0)) revert NotProxy();\n\n        (address[] memory adminAddresses, uint256 adminThreshold, address ownerAddress, address operatorAddress) = abi\n            .decode(params, (address[], uint256, address, address));\n\n        uint256 adminEpoch = _adminEpoch() + uint256(1);\n        _setAdminEpoch(adminEpoch);\n        _setAdmins(adminEpoch, adminAddresses, adminThreshold);\n\n        uint256 ownerEpoch = _ownerEpoch() + uint256(1);\n        _setOwnerEpoch(ownerEpoch);\n        _setOwner(ownerEpoch, ownerAddress);\n\n        uint256 operatorEpoch = _operatorEpoch() + uint256(1);\n        _setOperatorEpoch(operatorEpoch);\n        _setOperator(operatorEpoch, operatorAddress);\n\n        emit OwnershipTransferred(address(0), ownerAddress);\n        emit OperatorshipTransferred(address(0), operatorAddress);\n    }\n\n    function execute(bytes calldata input) external override {\n        (bytes memory data, bytes memory signature) = abi.decode(input, (bytes, bytes));\n\n        _execute(data, signature);\n    }\n\n    function _execute(bytes memory data, bytes memory sig) internal {\n        address signer = ECDSA.recover(ECDSA.toEthSignedMessageHash(keccak256(data)), sig);\n\n        (\n            uint256 chainId,\n            Role signerRole,\n            bytes32[] memory commandIds,\n            string[] memory commands,\n            bytes[] memory params\n        ) = abi.decode(data, (uint256, Role, bytes32[], string[], bytes[]));\n\n        if (chainId != block.chainid) revert InvalidChainId();\n\n        uint256 commandsLength = commandIds.length;\n\n        if (commandsLength != commands.length || commandsLength != params.length) revert InvalidCommands();\n\n        bool isCurrentOwner;\n        bool isValidRecentOwner;\n        bool isValidRecentOperator;\n\n        if (signerRole == Role.Owner) {\n            isCurrentOwner = signer == owner();\n            isValidRecentOwner = isCurrentOwner || _isValidPreviousOwner(signer);\n        } else if (signerRole == Role.Operator) {\n            isValidRecentOperator = _isValidRecentOperator(signer);\n        }\n\n        for (uint256 i; i < commandsLength; i++) {\n            bytes32 commandId = commandIds[i];\n\n            if (isCommandExecuted(commandId)) continue; /* Ignore if duplicate commandId received */\n\n            bytes4 commandSelector;\n            bytes32 commandHash = keccak256(abi.encodePacked(commands[i]));\n\n            if (commandHash == SELECTOR_DEPLOY_TOKEN) {\n                if (!isValidRecentOwner) continue;\n\n                commandSelector = AxelarGatewaySinglesig.deployToken.selector;\n            } else if (commandHash == SELECTOR_MINT_TOKEN) {\n                if (!isValidRecentOperator && !isValidRecentOwner) continue;\n\n                commandSelector = AxelarGatewaySinglesig.mintToken.selector;\n            } else if (commandHash == SELECTOR_APPROVE_CONTRACT_CALL) {\n                if (!isValidRecentOperator && !isValidRecentOwner) continue;\n\n                commandSelector = AxelarGatewaySinglesig.approveContractCall.selector;\n            } else if (commandHash == SELECTOR_APPROVE_CONTRACT_CALL_WITH_MINT) {\n                if (!isValidRecentOperator && !isValidRecentOwner) continue;\n\n                commandSelector = AxelarGatewaySinglesig.approveContractCallWithMint.selector;\n            } else if (commandHash == SELECTOR_BURN_TOKEN) {\n                if (!isValidRecentOperator && !isValidRecentOwner) continue;\n\n                commandSelector = AxelarGatewaySinglesig.burnToken.selector;\n            } else if (commandHash == SELECTOR_TRANSFER_OWNERSHIP) {\n                if (!isCurrentOwner) continue;\n\n                commandSelector = AxelarGatewaySinglesig.transferOwnership.selector;\n            } else if (commandHash == SELECTOR_TRANSFER_OPERATORSHIP) {\n                if (!isCurrentOwner) continue;\n\n                commandSelector = AxelarGatewaySinglesig.transferOperatorship.selector;\n            } else {\n                continue; /* Ignore if unknown command received */\n            }\n\n            // Prevent a re-entrancy from executing this command before it can be marked as successful.\n            _setCommandExecuted(commandId, true);\n            (bool success, ) = address(this).call(abi.encodeWithSelector(commandSelector, params[i], commandId));\n            _setCommandExecuted(commandId, success);\n\n            if (success) {\n                emit Executed(commandId);\n            }\n        }\n    }\n}"
}