-
Notifications
You must be signed in to change notification settings - Fork 18
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
1 parent
5311c0e
commit b46dbdc
Showing
2 changed files
with
39 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,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
interface IMarshalDAOTicker { | ||
function tick(address _device) external; | ||
} | ||
|
||
contract GeodnetDapp { | ||
address public verifier; | ||
address public ticker; | ||
|
||
constructor(address _verifier, address _ticker) { | ||
verifier = _verifier; | ||
ticker = _ticker; | ||
} | ||
|
||
function process( | ||
uint256 _projectId, | ||
bytes32 _taskId, | ||
address _prover, | ||
address _deviceId, | ||
bytes calldata _data | ||
) external { | ||
// Validate data length (79 uint256 values = 79 * 32 bytes) | ||
require(_data.length == 79 * 32, "Invalid data length"); | ||
|
||
// Prepare function selector | ||
bytes4 selector = bytes4(keccak256("verifyProof(uint256[8],uint256[2],uint256[2],uint256[67])")); | ||
|
||
// Call verifier contract | ||
(bool success, ) = verifier.staticcall(abi.encodePacked(selector, _data)); | ||
require(success, "Verifier call failed"); | ||
|
||
IMarshalDAOTicker(ticker).tick(_deviceId); | ||
} | ||
} |