Skip to content

Commit

Permalink
write IDatabaseManager
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanRHall committed Feb 24, 2025
1 parent da41908 commit a96a1ef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/v2/DatabaseManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {AccessControlUpgradeable} from
"@openzeppelin-contracts-upgradeable-5.2.0/access/AccessControlUpgradeable.sol";
import {Initializable} from
"@openzeppelin-contracts-upgradeable-5.2.0/proxy/utils/Initializable.sol";
import {IDatabaseManager} from "./interfaces/IDatabaseManager.sol";

/// @title DatabaseManager
/// @notice Manages the registration of tables and queries for the system
Expand All @@ -14,6 +15,7 @@ import {Initializable} from
contract DatabaseManager is
Initializable,
AccessControlUpgradeable,
IDatabaseManager,
IVersioned
{
/// @notice The semantic version of the contract
Expand Down Expand Up @@ -109,9 +111,7 @@ contract DatabaseManager is
emit NewQueryRegistration(hash, tableHash, sql);
}

/// @notice Checks if a query is queryable
/// @param hash The hash of the query
/// @return True if the query is queryable, false otherwise
/// @inheritdoc IDatabaseManager
function isQueryActive(bytes32 hash) public view returns (bool) {
return s_tables[s_queries[hash]];
}
Expand Down
6 changes: 3 additions & 3 deletions src/v2/QueryExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
import {supportsL1BlockData} from "../utils/Constants.sol";
import {IQueryExecutor} from "./interfaces/IQueryExecutor.sol";
import {L1BlockHash, L1BlockNumber} from "../utils/L1Block.sol";
import {DatabaseManager} from "./DatabaseManager.sol";
import {
Ownable2Step,
Ownable
} from "@openzeppelin-contracts-5.2.0/access/Ownable2Step.sol";
import {SafeCast} from "@openzeppelin-contracts-5.2.0/utils/math/SafeCast.sol";
import {IDatabaseManager} from "./interfaces/IDatabaseManager.sol";

/// @title QueryExecutor
/// @notice The contract that handles requesting and responding to queries
Expand Down Expand Up @@ -49,7 +49,7 @@ contract QueryExecutor is

/// @notice other contracts in the system
address public immutable router;
DatabaseManager public immutable dbManager;
IDatabaseManager public immutable dbManager;
address payable public immutable feeCollector;

/// @notice A nonce for constructing new requestIDs
Expand Down Expand Up @@ -136,7 +136,7 @@ contract QueryExecutor is
Config memory config
) Ownable(initialOwner) {
router = _router;
dbManager = DatabaseManager(_dbManager);
dbManager = IDatabaseManager(_dbManager);
feeCollector = _feeCollector;
s_config = config;
SUPPORTS_L1_BLOCKDATA = supportsL1BlockData();
Expand Down
11 changes: 11 additions & 0 deletions src/v2/interfaces/IDatabaseManager.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/// @title IDatabaseManager
/// @notice Minimal interface for DatabaseManager functionality needed by QueryExecutor
interface IDatabaseManager {
/// @notice Checks if a query is queryable
/// @param hash The hash of the query
/// @return isActive true if the query is queryable, false otherwise
function isQueryActive(bytes32 hash) external view returns (bool);
}

0 comments on commit a96a1ef

Please sign in to comment.