From 5c3c78e097529d688d80d74bb45449a9d8eb3801 Mon Sep 17 00:00:00 2001 From: poma Date: Fri, 4 Oct 2019 16:43:15 +0300 Subject: [PATCH] allow verifier keys update, and an option to permanently disable it --- contracts/Mixer.sol | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contracts/Mixer.sol b/contracts/Mixer.sol index 262967c..f4b5431 100644 --- a/contracts/Mixer.sol +++ b/contracts/Mixer.sol @@ -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;