@@ -10,12 +10,12 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
10
10
import "hardhat/console.sol " ; // for debugging
11
11
12
12
import "./Events.sol " ;
13
- import "./Verifier .sol " ;
13
+ import "./IVerifier .sol " ;
14
14
15
15
/**
16
16
* @title FluiDexDemo
17
17
*/
18
- contract FluiDexDemo is AccessControl , Events , KeyedVerifier , Ownable , ReentrancyGuard {
18
+ contract FluiDexDemo is AccessControl , Events , Ownable , ReentrancyGuard {
19
19
using SafeERC20 for IERC20 ;
20
20
21
21
bytes32 public constant TOKEN_ADMIN_ROLE = keccak256 ("TOKEN_ADMIN_ROLE " );
@@ -38,6 +38,8 @@ contract FluiDexDemo is AccessControl, Events, KeyedVerifier, Ownable, Reentranc
38
38
/// use 0 representing ETH in tokenId
39
39
uint16 constant ETH_ID = 0 ;
40
40
41
+ IVerifier verifier;
42
+
41
43
uint256 GENESIS_ROOT;
42
44
mapping (uint256 => uint256 ) public state_roots;
43
45
mapping (uint256 => BlockState) public block_states;
@@ -50,8 +52,9 @@ contract FluiDexDemo is AccessControl, Events, KeyedVerifier, Ownable, Reentranc
50
52
mapping (uint16 => UserInfo) public userIdToUserInfo;
51
53
mapping (bytes32 => uint16 ) public userBjjPubkeyToUserId;
52
54
53
- constructor (uint256 _genesis_root ) {
55
+ constructor (uint256 _genesis_root , IVerifier _verifier ) {
54
56
GENESIS_ROOT = _genesis_root;
57
+ verifier = _verifier;
55
58
_setupRole (DEFAULT_ADMIN_ROLE, msg .sender );
56
59
_setRoleAdmin (TOKEN_ADMIN_ROLE, DEFAULT_ADMIN_ROLE);
57
60
grantRole (TOKEN_ADMIN_ROLE, msg .sender );
@@ -146,7 +149,7 @@ contract FluiDexDemo is AccessControl, Events, KeyedVerifier, Ownable, Reentranc
146
149
147
150
if (_serialized_proof.length != 0 ) {
148
151
// TODO: hash inputs and then pass into verifier
149
- assert (verify_serialized_proof (_public_inputs, _serialized_proof));
152
+ assert (verifier. verify_serialized_proof (_public_inputs, _serialized_proof));
150
153
if (_block_id > 0 ) {
151
154
assert (block_states[_block_id-1 ] == BlockState.Verified);
152
155
}
0 commit comments