Renamed MixinExchange to MixinExchangeManager and added documentation

This commit is contained in:
Greg Hysen
2019-06-27 10:52:26 -07:00
parent 09843c3cf1
commit 9f1904ad3d
4 changed files with 20 additions and 49 deletions

View File

@@ -19,7 +19,7 @@
pragma solidity ^0.5.9;
import "./interfaces/IStaking.sol";
import "./core/MixinExchange.sol";
import "./core/MixinExchangeManager.sol";
import "./core/MixinZrxVault.sol";
import "./core/MixinRewardVault.sol";
import "./core/MixinScheduler.sol";
@@ -38,7 +38,7 @@ contract Staking is
MixinScheduler,
MixinRewardVault,
MixinZrxVault,
MixinExchange,
MixinExchangeManager,
MixinStakeBalances,
MixinPools,
MixinRewards,

View File

@@ -18,20 +18,25 @@
pragma solidity ^0.5.5;
import "@0x/contracts-utils/contracts/src/Authorizable.sol";
import "../interfaces/IStakingEvents.sol";
import "../immutable/MixinConstants.sol";
import "../immutable/MixinStorage.sol";
contract MixinExchange is
contract MixinExchangeManager is
Authorizable,
IStakingEvents,
MixinConstants,
MixinStorage
{
/// @dev This mixin contains logic for managing exchanges
///
/// @dev This mixin contains logic for managing exchanges.
/// Any exchange contract that connects to the staking contract
/// must be added here. When an exchange contract is deprecated
/// then it should be removed.
/// @dev Asserts that the call is coming from a valid exchange.
modifier onlyExchange() {
require(
isValidExchangeAddress(msg.sender),
@@ -40,9 +45,11 @@ contract MixinExchange is
_;
}
/// @dev Adds a new exchange address
/// @param addr Address of exchange contract to add
function addExchangeAddress(address addr)
external
// @TODO - Only by 0x multi-sig
onlyOwner
{
require(
!validExchanges[addr],
@@ -52,9 +59,11 @@ contract MixinExchange is
emit ExchangeAdded(addr);
}
/// @dev Removes an existing exchange address
/// @param addr Address of exchange contract to remove
function removeExchangeAddress(address addr)
external
// @TODO - Only by 0x multi-sig
onlyOwner
{
require(
validExchanges[addr],
@@ -64,6 +73,8 @@ contract MixinExchange is
emit ExchangeRemoved(addr);
}
/// @dev Returns true iff the address is a valid exchange
/// @param addr Address of exchange contract
function isValidExchangeAddress(address addr)
public
view

View File

@@ -26,7 +26,7 @@ import "../interfaces/IStakingEvents.sol";
import "./MixinStakeBalances.sol";
import "./MixinScheduler.sol";
import "./MixinPools.sol";
import "./MixinExchange.sol";
import "./MixinExchangeManager.sol";
import "./MixinRewardVault.sol";
import "../interfaces/IStructs.sol";
@@ -37,7 +37,7 @@ contract MixinFees is
MixinStorage,
MixinScheduler,
MixinRewardVault,
MixinExchange,
MixinExchangeManager,
MixinStakeBalances,
MixinPools
{

View File

@@ -1,40 +0,0 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-exchange-libs/contracts/src/LibEIP712ExchangeDomain.sol";
import "../src/MixinSignatureValidator.sol";
import "../src/MixinTransactions.sol";
import "../src/MixinExchangeRichErrors.sol";
contract TestSignatureValidator is
LibEIP712ExchangeDomain,
MixinSignatureValidator,
MixinTransactions,
MixinExchangeRichErrors
{
// solhint-disable no-empty-blocks
constructor (uint256 chainId)
public
LibEIP712ExchangeDomain(chainId, address(0))
{}
}