forked from russel-ra/zk-hangman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzkHangmanFactory.sol
49 lines (43 loc) · 1.17 KB
/
zkHangmanFactory.sol
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "./zkHangman.sol";
contract zkHangmanFactory {
address[] public games;
event GameCreated(
address indexed host,
address gameAddress,
address initVerifier,
address guessVerifier,
uint256 totalChars
);
// @notice Creates the game
// _input is the public outputs from the init circuit.
// input[0] contains the hash of the secret
// input[1] contains the total characters in the word
// input[2...26] contains the hashes of the characters
function createGame(
address _initVerifier,
address _guessVerifier,
uint256[2] memory _a,
uint256[2][2] memory _b,
uint256[2] memory _c,
uint256[27] memory _input
) public {
zkHangman _game = new zkHangman(
_initVerifier,
_guessVerifier,
_a,
_b,
_c,
_input
);
games.push(address(_game));
emit GameCreated(
msg.sender,
address(_game),
_initVerifier,
_guessVerifier,
_input[1]
);
}
}