Files
dodo-contractV2/contracts/DODOVendorMachine/impl/DVMStorage.sol

92 lines
2.7 KiB
Solidity
Raw Normal View History

2020-10-23 01:16:52 +08:00
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {DODOMath} from "../../lib/DODOMath.sol";
import {DecimalMath} from "../../lib/DecimalMath.sol";
2020-11-05 00:26:45 +08:00
import {IPermissionManager} from "../../lib/PermissionManager.sol";
2020-11-18 17:51:50 +08:00
import {IExternalValue} from "../../lib/ExternalValue.sol";
2020-10-23 01:16:52 +08:00
import {IFeeRateModel} from "../../intf/IFeeRateModel.sol";
2020-11-18 17:51:50 +08:00
import {IERC20} from "../../intf/IERC20.sol";
2020-10-23 01:16:52 +08:00
contract DVMStorage is InitializableOwnable, ReentrancyGuard {
using SafeMath for uint256;
// ============ Variables for Control ============
2020-11-18 17:51:50 +08:00
IExternalValue public _GAS_PRICE_LIMIT_;
2020-10-23 01:16:52 +08:00
// ============ Advanced Controls ============
2020-11-06 00:31:30 +08:00
bool public _BUYING_CLOSE_;
bool public _SELLING_CLOSE_;
2020-10-23 01:16:52 +08:00
2020-11-05 00:26:45 +08:00
IPermissionManager public _TRADE_PERMISSION_;
2020-10-23 01:16:52 +08:00
// ============ Core Address ============
address public _MAINTAINER_; // collect maintainer fee
2020-11-18 17:51:50 +08:00
IERC20 public _BASE_TOKEN_;
IERC20 public _QUOTE_TOKEN_;
uint256 public _BASE_RESERVE_;
uint256 public _QUOTE_RESERVE_;
// ============ Shares ============
string public symbol;
uint256 public decimals;
string public name;
uint256 public totalSupply;
mapping(address => uint256) internal _SHARES_;
mapping(address => mapping(address => uint256)) internal _ALLOWED_;
2020-10-23 01:16:52 +08:00
// ============ Variables for Pricing ============
IFeeRateModel public _LP_FEE_RATE_MODEL_;
IFeeRateModel public _MT_FEE_RATE_MODEL_;
uint256 public _K_;
uint256 public _I_;
2020-11-05 00:26:45 +08:00
// ============ Setting Functions ============
function setLpFeeRateModel(address newLpFeeRateModel) external onlyOwner {
_LP_FEE_RATE_MODEL_ = IFeeRateModel(newLpFeeRateModel);
}
function setMtFeeRateModel(address newMtFeeRateModel) external onlyOwner {
_MT_FEE_RATE_MODEL_ = IFeeRateModel(newMtFeeRateModel);
}
function setTradePermissionManager(address newTradePermissionManager) external onlyOwner {
_TRADE_PERMISSION_ = IPermissionManager(newTradePermissionManager);
}
function setMaintainer(address newMaintainer) external onlyOwner {
_MAINTAINER_ = newMaintainer;
2020-10-23 01:16:52 +08:00
}
2020-11-06 00:31:30 +08:00
2020-11-11 16:42:00 +08:00
function setGasPriceSource(address newGasPriceLimitSource) external onlyOwner {
2020-11-18 17:51:50 +08:00
_GAS_PRICE_LIMIT_ = IExternalValue(newGasPriceLimitSource);
2020-11-06 00:31:30 +08:00
}
function setBuy(bool open) external onlyOwner {
_BUYING_CLOSE_ = !open;
}
function setSell(bool open) external onlyOwner {
_SELLING_CLOSE_ = !open;
}
2020-10-23 01:16:52 +08:00
}