Updated dependency ordering using a linearizer script, which is now here: https://github.com/hysz/SmartContractLinearizer

This commit is contained in:
Greg Hysen
2019-06-26 10:20:32 -07:00
parent 8bc1d5fe3e
commit b756e723ea
10 changed files with 22 additions and 135 deletions

View File

@@ -31,14 +31,18 @@ import "./core/MixinRewards.sol";
contract Staking is
IStakingEvents,
MixinDeploymentConstants,
MixinConstants,
MixinStorage,
MixinEpoch,
MixinExchange,
MixinZrxVault,
MixinRewardVault,
MixinZrxVault,
MixinExchange,
MixinStakeBalances,
MixinStake,
MixinPools,
MixinRewards,
MixinStake,
MixinFees
{

View File

@@ -23,8 +23,8 @@ import "./interfaces/IStakingProxy.sol";
contract StakingProxy is
IStakingProxy,
MixinStorage
MixinStorage,
IStakingProxy
{
address constant NIL_ADDRESS = 0x0000000000000000000000000000000000000000;

View File

@@ -25,9 +25,7 @@ import "../immutable/MixinStorage.sol";
contract MixinExchange is
// interfaces
IStakingEvents,
// immutables
MixinConstants,
MixinStorage
{

View File

@@ -32,17 +32,12 @@ import "../interfaces/IStructs.sol";
contract MixinFees is
// interfaces
IStakingEvents,
IStructs,
// immutables
MixinConstants,
MixinStorage,
// standalones
MixinEpoch,
MixinExchange,
MixinRewardVault,
// staking logic
MixinExchange,
MixinStakeBalances,
MixinPools
{
@@ -91,7 +86,7 @@ contract MixinFees is
{
// Step 1 - compute total fees this epoch
uint256 numberOfActivePoolIds = activePoolIdsThisEpoch.length;
ActivePool[] memory activePoolIds = new ActivePool[](activePoolIdsThisEpoch.length);
IStructs.ActivePool[] memory activePoolIds = new IStructs.ActivePool[](activePoolIdsThisEpoch.length);
uint256 totalFees = 0;
for (uint i = 0; i != numberOfActivePoolIds; i++) {
activePoolIds[i].poolId = activePoolIdsThisEpoch[i];

View File

@@ -33,12 +33,9 @@ import "./MixinRewardVault.sol";
contract MixinPools is
// interfaces
IStakingEvents,
// immutables
MixinConstants,
MixinStorage,
// standalone
MixinRewardVault
{
@@ -63,7 +60,7 @@ contract MixinPools is
nextPoolId = _computeNextPoolId(poolId);
//
Pool memory pool = Pool({
IStructs.Pool memory pool = IStructs.Pool({
operatorAddress: operatorAddress,
operatorShare: operatorShare
});
@@ -125,7 +122,7 @@ contract MixinPools is
view
returns (bytes32 approvalHash)
{
StakingPoolApproval memory approval = StakingPoolApproval({
IStructs.StakingPoolApproval memory approval = IStructs.StakingPoolApproval({
poolId: poolId,
makerAddress: makerAddress
});
@@ -182,7 +179,7 @@ contract MixinPools is
function _getPool(bytes32 poolId)
internal
view
returns (Pool memory pool)
returns (IStructs.Pool memory pool)
{
pool = poolById[poolId];
return pool;

View File

@@ -22,18 +22,15 @@ import "../libs/LibSafeMath.sol";
import "../libs/LibRewardMath.sol";
import "../immutable/MixinStorage.sol";
import "../immutable/MixinConstants.sol";
import "../interfaces/IStakingEvents.sol";
import "./MixinStakeBalances.sol";
import "./MixinRewardVault.sol";
import "./MixinPools.sol";
contract MixinRewards is
// immutables
MixinConstants,
MixinStorage,
// standalones
MixinRewardVault,
// logic
MixinStakeBalances,
MixinPools
{

View File

@@ -30,16 +30,12 @@ import "./MixinStakeBalances.sol";
contract MixinStake is
// interfaces
IStakingEvents,
// immutables
MixinConstants,
MixinStorage,
// standalone
MixinEpoch,
MixinZrxVault,
MixinRewardVault,
// logic
MixinZrxVault,
MixinStakeBalances
{
@@ -268,7 +264,7 @@ contract MixinStake is
function _timelockStake(address owner, uint256 amount)
private
{
(Timelock memory ownerTimelock,) = _getSynchronizedTimelock(owner);
(IStructs.Timelock memory ownerTimelock,) = _getSynchronizedTimelock(owner);
uint96 downcastAmount = amount._downcastToUint96();
ownerTimelock.total += downcastAmount;
timelockedStakeByOwner[owner] = ownerTimelock;
@@ -277,7 +273,7 @@ contract MixinStake is
function _syncTimelockedStake(address owner)
private
{
(Timelock memory ownerTimelock, bool isOutOfSync) = _getSynchronizedTimelock(owner);
(IStructs.Timelock memory ownerTimelock, bool isOutOfSync) = _getSynchronizedTimelock(owner);
if (!isOutOfSync) {
return;
}

View File

@@ -119,7 +119,7 @@ contract MixinStakeBalances is
view
returns (uint256)
{
(Timelock memory timelock,) = _getSynchronizedTimelock(owner);
(IStructs.Timelock memory timelock,) = _getSynchronizedTimelock(owner);
return timelock.total;
}
@@ -128,7 +128,7 @@ contract MixinStakeBalances is
view
returns (uint256)
{
(Timelock memory timelock,) = _getSynchronizedTimelock(owner);
(IStructs.Timelock memory timelock,) = _getSynchronizedTimelock(owner);
return timelock.lockedAt;
}

View File

@@ -25,7 +25,6 @@ import "../interfaces/IStructs.sol";
contract MixinStorage is
IStructs,
MixinConstants
{
@@ -46,7 +45,7 @@ contract MixinStorage is
mapping (address => uint256) activeStakeByOwner;
// mapping from Owner to Amount Timelocked
mapping (address => Timelock) timelockedStakeByOwner;
mapping (address => IStructs.Timelock) timelockedStakeByOwner;
// mapping from Owner to Amount Delegated
mapping (address => uint256) delegatedStakeByOwner;
@@ -64,7 +63,7 @@ contract MixinStorage is
bytes32 nextPoolId = INITIAL_POOL_ID;
// mapping from Pool Id to Pool
mapping (bytes32 => Pool) poolById;
mapping (bytes32 => IStructs.Pool) poolById;
// mapping from Maker Address to Pool Id
// A Maker can only hold a single token

View File

@@ -1,99 +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;
import "../interfaces/IStructs.sol";
import "@0x/contracts-utils/contracts/src/SafeMath.sol";
contract MixinTimelock is
IStructs,
SafeMath
{
// Epoch | lockedAt | total | pending | current | timelock() | withdraw() | available()
// 0 | 0 | 0 | 0 | 0 | | | 0
// 1 | 1 | 5 | 0 | 0 | +5 | | 0
// 2 | 1 | 5 | 0 | 0 | | | 0
// 2 | 2 | 15 | 5 | 0 | +10 | | 0
// 3 | 2 | 15 | 5 | 0 | | | 5
// 3 | 3 | 30 | 15 | 5 | +15 | | 5
// 4 | 3 | 30 | 15 | 5 | | | 15
// 5 | 3 | 30 | 15 | 5 | | | 30
// 5 | 5 | 30 | 30 | 30 | +0 * | | 30
// 6 | 6 | 50 | 30 | 30 | +20 | | 30
// 6 | 6 | 20 | 0 | 0 | | -30 | 0
// 7 | 6 | 20 | 0 | 0 | | | 0
// 8 | 6 | 20 | 0 | 0 | | | 20
function _add(Timelock memory timelock, uint256 amount)
internal
returns (uint256)
{
timelock.total += amount;
}
function _sub(Timelock memory timelock, uint256 amount)
internal
returns (uint256)
{
}
function _subTimelockedStake(address owner, uint256 amount)
internal
{
}
function _addTimelockedStake(address owner, uint256 amount)
internal
{
timelockedStakeByOwner[owner] = safeAdd(timelockedStakeByOwner[owner], amount);
// update timelock
uint64 currentTimelockPeriod = _getTimelockPeriod();
Timelock memory timelock = timelocksByOwner[owner];
}
function _getAvailableTimelockedStake(address owner)
internal
returns (uint256)
{
}
function _getPendingTimelockedStake(address owner)
internal
returns (uint256)
{
}
function _getTotalTimelockedStake(address owner)
internal
returns (uint256)
{
}
}