Skip to content

Commit

Permalink
add geodnet dapp contarct (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhiran authored Jan 8, 2025
1 parent 5311c0e commit b46dbdc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions smartcontracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export MIN_STAKE=1.0
| W3bstreamRouter | `0x28E0A99A76a467E7418019cBBbF79E4599C73B5B` |
| W3bstreamRewardDistributor | `0x058f2F501EC0505B9CF8AB361FFFBFd36C83a8aF` |
| W3bstreamMinter | `0x49C096AE869A3054Db06ffF221b917b41f94CEf3` |
| LivenessVerifier | `0x29bBA1515fB2Ae6480bA7086bCb9473044d40b18` |
| MovementVerifier | `0xe1FC0a1A75c9243C5Fe0d5ADC32A273C7a26E234` |
| GeodnetDapp | `0xB2Dda5D9E65E44749409E209d8b7b15fb4e82147` |

| Setting | Value |
|-----------------------------|--------------------------------------------|
Expand Down
36 changes: 36 additions & 0 deletions smartcontracts/contracts/GeodnetDapp.sol
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);
}
}

0 comments on commit b46dbdc

Please sign in to comment.