From 482a66f261a6ebc87bb3b49afecfc8eb80eba29b Mon Sep 17 00:00:00 2001 From: mzxyz <8177474+mzxyz@users.noreply.github.com> Date: Wed, 16 Aug 2023 17:04:29 +1200 Subject: [PATCH] Add `setSettings` function to contracts --- contracts/ConsumerHost.sol | 8 ++++++++ contracts/DisputeManager.sol | 8 ++++++++ contracts/EraManager.sol | 8 ++++++++ contracts/InflationController.sol | 8 ++++++++ contracts/PermissionedExchange.sol | 8 ++++++++ contracts/PlanManager.sol | 8 ++++++++ contracts/PurchaseOfferMarket.sol | 8 ++++++++ contracts/RewardsHelper.sol | 8 ++++++++ contracts/StakingManager.sol | 8 ++++++++ contracts/StateChannel.sol | 8 ++++++++ contracts/VSQToken.sol | 8 ++++++++ 11 files changed, 88 insertions(+) diff --git a/contracts/ConsumerHost.sol b/contracts/ConsumerHost.sol index 5595f7bf..3f676bf0 100644 --- a/contracts/ConsumerHost.sol +++ b/contracts/ConsumerHost.sol @@ -102,6 +102,14 @@ contract ConsumerHost is Initializable, OwnableUpgradeable, IConsumer, ERC165 { sqt.approve(_channel, sqt.totalSupply()); } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @notice Update fee percentage * @param _feePercentage fee percentage diff --git a/contracts/DisputeManager.sol b/contracts/DisputeManager.sol index ddd3b326..8739015c 100644 --- a/contracts/DisputeManager.sol +++ b/contracts/DisputeManager.sol @@ -57,6 +57,14 @@ contract DisputeManager is IDisputeManager, Initializable, OwnableUpgradeable { minimumDeposit = _minimumDeposit; } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + function setMinimumDeposit(uint256 _minimumDeposit) external onlyOwner { minimumDeposit = _minimumDeposit; } diff --git a/contracts/EraManager.sol b/contracts/EraManager.sol index 7709feaa..c95c2dde 100644 --- a/contracts/EraManager.sol +++ b/contracts/EraManager.sol @@ -54,6 +54,14 @@ contract EraManager is Initializable, OwnableUpgradeable, IEraManager { emit NewEraStart(eraNumber, msg.sender); } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + function enableMaintenance() external onlyOwner { maintenance = true; } diff --git a/contracts/InflationController.sol b/contracts/InflationController.sol index 9473a332..46917bdc 100644 --- a/contracts/InflationController.sol +++ b/contracts/InflationController.sol @@ -59,6 +59,14 @@ contract InflationController is Initializable, OwnableUpgradeable, Constants { lastInflationTimestamp = block.timestamp; } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @notice Set the inflation rate * @param _inflationRate One year inflationRate for SQT token diff --git a/contracts/PermissionedExchange.sol b/contracts/PermissionedExchange.sol index 1e5cdbf0..7271e3c5 100644 --- a/contracts/PermissionedExchange.sol +++ b/contracts/PermissionedExchange.sol @@ -85,6 +85,14 @@ contract PermissionedExchange is Initializable, OwnableUpgradeable { } } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @notice Set controller role for this contract, controller have the permission to addQuota for trader. * @param _controller The account address to set. diff --git a/contracts/PlanManager.sol b/contracts/PlanManager.sol index ffea0d2e..fdadc936 100644 --- a/contracts/PlanManager.sol +++ b/contracts/PlanManager.sol @@ -76,6 +76,14 @@ contract PlanManager is Initializable, OwnableUpgradeable, IPlanManager { nextPlanId = 1; } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @notice Set the indexer plan limit. * @param _limit limit to set diff --git a/contracts/PurchaseOfferMarket.sol b/contracts/PurchaseOfferMarket.sol index 19463f44..37757e85 100644 --- a/contracts/PurchaseOfferMarket.sol +++ b/contracts/PurchaseOfferMarket.sol @@ -133,6 +133,14 @@ contract PurchaseOfferMarket is Initializable, OwnableUpgradeable, IPurchaseOffe penaltyDestination = _penaltyDestination; } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @notice allow admin the set the Penalty Rate for cancel unexpired offer. * @param _penaltyRate penalty rate to set diff --git a/contracts/RewardsHelper.sol b/contracts/RewardsHelper.sol index e714af59..56419209 100644 --- a/contracts/RewardsHelper.sol +++ b/contracts/RewardsHelper.sol @@ -32,6 +32,14 @@ contract RewardsHelper is Initializable, OwnableUpgradeable { settings = _settings; } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @dev Apply a list of stakers' StakeChanges, call applyStakeChange one by one. */ diff --git a/contracts/StakingManager.sol b/contracts/StakingManager.sol index ec88f1f9..c4299bba 100644 --- a/contracts/StakingManager.sol +++ b/contracts/StakingManager.sol @@ -26,6 +26,14 @@ contract StakingManager is IStakingManager, Initializable, OwnableUpgradeable { settings = _settings; } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @dev Indexers stake to themself. * The caller can be either an existing indexer or IndexerRegistry contract. The staking change will be applied immediately if the caller is IndexerRegistry. diff --git a/contracts/StateChannel.sol b/contracts/StateChannel.sol index a844d590..3cca85b6 100644 --- a/contracts/StateChannel.sol +++ b/contracts/StateChannel.sol @@ -96,6 +96,14 @@ contract StateChannel is Initializable, OwnableUpgradeable { settings = _settings; } + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + /** * @notice Update the expiration of the terminate * @param expiration terminate expiration time in seconds diff --git a/contracts/VSQToken.sol b/contracts/VSQToken.sol index 18ccbc91..6c498282 100644 --- a/contracts/VSQToken.sol +++ b/contracts/VSQToken.sol @@ -16,6 +16,14 @@ contract VSQToken is Initializable { uint8 private _decimals = 18; ISettings public settings; + /** + * @notice Update setting state. + * @param _settings ISettings contract + */ + function setSettings(ISettings _settings) external onlyOwner { + settings = _settings; + } + function initialize(ISettings _settings) external initializer { settings = _settings; }