-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCounterCaller.sol
More file actions
25 lines (19 loc) · 846 Bytes
/
CounterCaller.sol
File metadata and controls
25 lines (19 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import "../lib/coprocessor-base-contract/src/CoprocessorAdapter.sol";
contract CounterCaller is CoprocessorAdapter {
uint256 public count;
event ResultReceived(bytes32 indexed inputPayloadHash, bytes output);
constructor(address _taskIssuerAddress, bytes32 _machineHash) CoprocessorAdapter(_taskIssuerAddress, _machineHash) {}
function runExecution(bytes calldata input) external {
callCoprocessor(input);
}
function handleNotice(bytes32 inputPayloadHash, bytes memory notice ) internal override {
require(notice.length >= 32, "Invalid notice length");
count = abi.decode(notice, (uint256));
emit ResultReceived(inputPayloadHash, notice);
}
function get() external view returns (uint256) {
return count;
}
}