diff --git a/contracts/staking/contracts/src/core/MixinFees.sol b/contracts/staking/contracts/src/core/MixinFees.sol new file mode 100644 index 0000000000..68a93485c9 --- /dev/null +++ b/contracts/staking/contracts/src/core/MixinFees.sol @@ -0,0 +1,57 @@ +/* + + 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/IVault.sol"; +import "../libs/LibZrxToken.sol"; +import "@0x/contracts-utils/contracts/src/SafeMath.sol"; +import "../immutable/MixinStorage.sol"; +import "../immutable/MixinConstants.sol"; +import "../interfaces/IStakingEvents.sol"; +import "./MixinStakeBalances.sol"; +import "./MixinEpoch.sol"; +import "./MixinPools.sol"; + + +contract MixinFees is + SafeMath, + IStakingEvents, + MixinConstants, + MixinStorage, + MixinEpoch, + MixinStakeBalances, + MixinPools +{ + + function _payFee(address makerAddress, uint256 amount) + internal + { + bytes32 poolId = _getMakerPoolId(makerAddress); + uint256 _feesCollectedThisEpoch = feesCollectedThisEpochByPoolId[poolId]; + feesCollectedThisEpochByPoolId[poolId] = _safeAdd(_feesCollectedThisEpoch, amount); + if (_feesCollectedThisEpoch == 0) { + activePoolIdsThisEpoch.append(poolId); + } + } + + function _payRebates() + { + + } +} \ No newline at end of file diff --git a/contracts/staking/contracts/src/core/MixinStake.sol b/contracts/staking/contracts/src/core/MixinStake.sol index 2b634ec6a8..c6a1f43e0e 100644 --- a/contracts/staking/contracts/src/core/MixinStake.sol +++ b/contracts/staking/contracts/src/core/MixinStake.sol @@ -176,7 +176,7 @@ contract MixinStake is delegatedStakeByPoolId[poolId] = _safeSub(delegatedStakeByPoolId[poolId], amount); } - // Epoch | lockedAt | total | pending | | timelock() | withdraw() | available() + // Epoch | lockedAt | total | pending | deactivated | timelock() | withdraw() | available() // 0 | 0 | 0 | 0 | 0 | | | 0 // 1 | 1 | 5 | 0 | 0 | +5 | | 0 // 2 | 1 | 5 | 0 | 0 | | | 0 diff --git a/contracts/staking/contracts/src/immutable/MixinStorage.sol b/contracts/staking/contracts/src/immutable/MixinStorage.sol index ca495186fa..a072ba9052 100644 --- a/contracts/staking/contracts/src/immutable/MixinStorage.sol +++ b/contracts/staking/contracts/src/immutable/MixinStorage.sol @@ -74,6 +74,12 @@ contract MixinStorage is // current epoch start time uint64 currentTimelockPeriodStartEpoch = INITIAL_EPOCH; + // fees collected this epoch + mapping (bytes32 => uint256) feesCollectedThisEpochByPoolId; + + // + bytes32[] activePoolIdsThisEpoch; + // ZRX vault IVault zrxVault;