contract GatewayRegistryGettersV2 is GatewayRegistryStateV2 {
    using StringSet for StringSet.Set;

    function getChainId() public view returns (uint256) {
        return _chainId;
    }

    function getSignatureVerifier() public view returns (address) {
        require(_signatureVerifier != address(0x0), "GatewayRegistry: not initialized");
        return _signatureVerifier;
    }

    function getTransferContract() external view returns (address) {
        require(_transferContract != address(0x0), "GatewayRegistry: not initialized");
        return _transferContract;
    }

    /// @dev To get all the registered Gateway contracts set count to `0`.
    function getMintGatewaySymbols(uint256 from, uint256 count) external view returns (string[] memory) {
        return enumerateSet(mintGatewaySymbols, from, count);
    }

    /// @dev To get all the registered tokens set count to `0`.
    function getLockGatewaySymbols(uint256 from, uint256 count) external view returns (string[] memory) {
        return enumerateSet(lockGatewaySymbols, from, count);
    }

    function enumerateSet(
        StringSet.Set storage set,
        uint256 from,
        uint256 count
    ) internal view returns (string[] memory) {
        uint256 length = set.length();

        if (count == 0 || from + count > length) {
            count = length - from;
        }

        string[] memory gateways = new string[](count);

        for (uint256 i = 0; i < count; i++) {
            gateways[i] = set.at(i + from);
        }

        return gateways;
    }

    /// @notice Returns the Gateway contract for the given RenERC20 token
    ///         address.
    ///
    /// @param token The address of the RenERC20 token contract.
    function getMintGatewayByToken(address token) public view returns (IMintGateway) {
        return IMintGateway(mintGatewayDetailsBySymbol[mintSymbolByToken[token]].gateway);
    }

    /// @notice Deprecated in favour of getMintGatewayByToken.
    function getGatewayByToken(address token) external view returns (IMintGateway) {
        return getMintGatewayByToken(token);
    }

    /// @notice Returns the Gateway contract for the given RenERC20 token
    ///         symbol.
    ///
    /// @param tokenSymbol The symbol of the RenERC20 token contract.
    function getMintGatewayBySymbol(string calldata tokenSymbol) public view returns (IMintGateway) {
        return IMintGateway(mintGatewayDetailsBySymbol[tokenSymbol].gateway);
    }

    /// @notice Deprecated in favour of getMintGatewayBySymbol.
    function getGatewayBySymbol(string calldata tokenSymbol) external view returns (IMintGateway) {
        return getMintGatewayBySymbol(tokenSymbol);
    }

    /// @notice Returns the RenERC20 address for the given token symbol.
    ///
    /// @param tokenSymbol The symbol of the RenERC20 token contract to
    ///        lookup.
    function getRenAssetBySymbol(string calldata tokenSymbol) public view returns (IERC20) {
        return IERC20(mintGatewayDetailsBySymbol[tokenSymbol].token);
    }

    /// @notice Deprecated in favour of getRenAssetBySymbol.
    function getTokenBySymbol(string calldata tokenSymbol) external view returns (IERC20) {
        return getRenAssetBySymbol(tokenSymbol);
    }

    function getLockGatewayByToken(address token_) external view returns (ILockGateway) {
        return ILockGateway(lockGatewayDetailsBySymbol[lockSymbolByToken[token_]].gateway);
    }

    function getLockGatewayBySymbol(string calldata tokenSymbol) external view returns (ILockGateway) {
        return ILockGateway(lockGatewayDetailsBySymbol[tokenSymbol].gateway);
    }

    function getLockAssetBySymbol(string calldata tokenSymbol) external view returns (IERC20) {
        return IERC20(lockGatewayDetailsBySymbol[tokenSymbol].token);
    }
}
function getMintGatewayBySymbol(string calldata tokenSymbol) public view returns (IMintGateway) {
    return IMintGateway(mintGatewayDetailsBySymbol[tokenSymbol].gateway);
}

/// @notice Returns the Gateway contract for the given RenERC20 token
///         symbol.
///
/// @param tokenSymbol The symbol of the RenERC20 token contract.