generated from BreadchainCoop/solidity-foundry-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.23; | ||
|
||
import {LayerSDK} from 'contracts/LayerSDK.sol'; | ||
|
||
contract StorageQueryConsumer is LayerSDK { | ||
/// @notice Mapping to store the task hashes | ||
mapping(bytes32 _taskHash => bool _isValid) internal _storedTasks; | ||
|
||
/// @notice Initializer | ||
constructor(address _stakeRegistry) LayerSDK(_stakeRegistry) {} | ||
|
||
/** | ||
* @notice Stores a layer task | ||
* @param _task The task to store | ||
*/ | ||
function storeLayerTask(Task memory _task) external onlyValidLayerTask(_task) { | ||
_storedTasks[_task.dataHash] = true; | ||
} | ||
|
||
/** | ||
* @notice Queries a layer task | ||
* @param _taskHash The hash of the task to query | ||
* @return _isValid Whether the task is valid | ||
*/ | ||
function queryLayerTask(bytes32 _taskHash) external view returns (bool _isValid) { | ||
_isValid = _storedTasks[_taskHash]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters