allow verifier keys update, and an option to permanently disable it

This commit is contained in:
poma 2019-10-04 16:43:15 +03:00
parent 3624cb7531
commit 5c3c78e097

View File

@ -19,6 +19,7 @@ contract IVerifier {
contract Mixer is MerkleTreeWithHistory {
bool public isDepositsEnabled = true;
bool public isVerifierUpdateAllowed = true;
// operator can disable new deposits in case of emergency
// it also receives a relayer fee
address payable public operator;
@ -96,6 +97,17 @@ contract Mixer is MerkleTreeWithHistory {
isDepositsEnabled = !isDepositsEnabled;
}
function updateVerifier(address newVerifier) external {
require(isVerifierUpdateAllowed, "verifier updates are disabled");
require(msg.sender == operator, "unauthorized");
verifier = IVerifier(newVerifier);
}
function disableVerifierUpdate() external {
require(msg.sender == operator, "unauthorized");
isVerifierUpdateAllowed = false;
}
function changeOperator(address payable _newAccount) external {
require(msg.sender == operator, "unauthorized");
operator = _newAccount;