Files
dodo-contractV2/contracts/impl/Admin.sol

96 lines
2.6 KiB
Solidity
Raw Normal View History

2020-06-26 00:31:25 +08:00
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {Storage} from "./Storage.sol";
/**
* @title Admin
* @author DODO Breeder
*
* @notice Functions for admin operations
*/
contract Admin is Storage {
// ============ Events ============
2020-07-11 00:57:00 +08:00
event UpdateGasPriceLimit(uint256 oldGasPriceLimit, uint256 newGasPriceLimit);
event UpdateLiquidityProviderFeeRate(
uint256 oldLiquidityProviderFeeRate,
uint256 newLiquidityProviderFeeRate
);
event UpdateMaintainerFeeRate(uint256 oldMaintainerFeeRate, uint256 newMaintainerFeeRate);
event UpdateK(uint256 oldK, uint256 newK);
2020-06-26 00:31:25 +08:00
// ============ Params Setting Functions ============
function setOracle(address newOracle) external onlyOwner {
_ORACLE_ = newOracle;
}
function setSupervisor(address newSupervisor) external onlyOwner {
_SUPERVISOR_ = newSupervisor;
}
function setMaintainer(address newMaintainer) external onlyOwner {
_MAINTAINER_ = newMaintainer;
}
function setLiquidityProviderFeeRate(uint256 newLiquidityPorviderFeeRate) external onlyOwner {
2020-07-11 00:57:00 +08:00
emit UpdateLiquidityProviderFeeRate(_LP_FEE_RATE_, newLiquidityPorviderFeeRate);
2020-06-26 00:31:25 +08:00
_LP_FEE_RATE_ = newLiquidityPorviderFeeRate;
_checkDODOParameters();
}
function setMaintainerFeeRate(uint256 newMaintainerFeeRate) external onlyOwner {
2020-07-11 00:57:00 +08:00
emit UpdateMaintainerFeeRate(_MT_FEE_RATE_, newMaintainerFeeRate);
2020-06-26 00:31:25 +08:00
_MT_FEE_RATE_ = newMaintainerFeeRate;
_checkDODOParameters();
}
function setK(uint256 newK) external onlyOwner {
2020-07-11 00:57:00 +08:00
emit UpdateK(_K_, newK);
2020-06-26 00:31:25 +08:00
_K_ = newK;
_checkDODOParameters();
}
function setGasPriceLimit(uint256 newGasPriceLimit) external onlySupervisorOrOwner {
2020-07-11 00:57:00 +08:00
emit UpdateGasPriceLimit(_GAS_PRICE_LIMIT_, newGasPriceLimit);
2020-06-26 00:31:25 +08:00
_GAS_PRICE_LIMIT_ = newGasPriceLimit;
}
// ============ System Control Functions ============
function disableTrading() external onlySupervisorOrOwner {
_TRADE_ALLOWED_ = false;
}
function enableTrading() external onlyOwner notClosed {
_TRADE_ALLOWED_ = true;
}
function disableQuoteDeposit() external onlySupervisorOrOwner {
_DEPOSIT_QUOTE_ALLOWED_ = false;
}
function enableQuoteDeposit() external onlyOwner notClosed {
_DEPOSIT_QUOTE_ALLOWED_ = true;
}
function disableBaseDeposit() external onlySupervisorOrOwner {
_DEPOSIT_BASE_ALLOWED_ = false;
}
function enableBaseDeposit() external onlyOwner notClosed {
_DEPOSIT_BASE_ALLOWED_ = true;
}
}