Fixed linter errors

This commit is contained in:
Greg Hysen
2019-06-27 19:55:38 -07:00
parent 35f4e2fb4f
commit ce15b4c678
9 changed files with 88 additions and 92 deletions

View File

@@ -45,8 +45,6 @@ contract MixinExchangeFees is
MixinStakingPool
{
using LibSafeMath for uint256;
/// @dev This mixin contains the logic for 0x protocol fees.
/// Protocol fees are sent by 0x exchanges every time there is a trade.
/// If the maker has associated their address with a pool (see MixinStakingPool.sol), then
@@ -57,9 +55,11 @@ contract MixinExchangeFees is
/// stake provided by directly by the maker; this is a disincentive for market makers to
/// monopolize a single pool that they all delegate to.
using LibSafeMath for uint256;
/// @dev Pays a protocol fee in ETH.
/// Only a known 0x exchange can call this method. See (MixinExchangeManager).
/// @param makerAddress The address of the order's maker
/// @param makerAddress The address of the order's maker.
function payProtocolFee(address makerAddress)
external
payable

View File

@@ -34,10 +34,6 @@ contract MixinScheduler is
MixinConstants,
MixinStorage
{
using LibSafeMath for uint256;
using LibSafeMath64 for uint64;
/// @dev This mixin contains logic for time-based scheduling.
/// All processes in the system are segmented into time intervals, called epochs.
/// Epochs have a fixed minimum time period that is configured when this contract is deployed.
@@ -45,6 +41,9 @@ contract MixinScheduler is
/// Epochs serve as the basis for all other time intervals, which provides a more stable
/// and consistent scheduling metric than time. Timelocks, for example, are measured in epochs.
using LibSafeMath for uint256;
using LibSafeMath64 for uint64;
/// @dev Returns the current epoch.
/// @return Epoch.
function getCurrentEpoch()

View File

@@ -38,8 +38,6 @@ contract MixinStakingPool is
MixinStakingPoolRewardVault
{
using LibSafeMath for uint256;
/// @dev This mixin contains logic for staking pools.
/// A pool has a single operator and any number of delegators (members).
/// Any staker can create a pool, although at present it is only beneficial
@@ -64,6 +62,8 @@ contract MixinStakingPool is
/// 2. Add the addresses that you use to market make on 0x.
/// 3. Leverage the staking power of others by convincing them to delegate to your pool.
using LibSafeMath for uint256;
/// @dev Asserts that the sender is the operator of the input pool.
/// @param poolId Pool sender must be operator of.
modifier onlyStakingPoolOperator(bytes32 poolId) {
@@ -157,8 +157,8 @@ contract MixinStakingPool is
bytes32 poolId,
address makerAddress
)
onlyStakingPoolOperatorOrMaker(poolId, makerAddress)
external
onlyStakingPoolOperatorOrMaker(poolId, makerAddress)
{
require(
getStakingPoolIdOfMaker(makerAddress) == poolId,

View File

@@ -23,6 +23,7 @@ import "../interfaces/IStakingPoolRewardVault.sol";
import "../immutable/MixinStorage.sol";
import "./MixinOwnable.sol";
contract MixinStakingPoolRewardVault is
IStakingEvents,
MixinDeploymentConstants,

View File

@@ -40,8 +40,6 @@ contract MixinStakingPoolRewards is
MixinStakingPool
{
using LibSafeMath for uint256;
/// @dev This mixin contains logic for staking pool rewards.
/// Rewards for a pool are generated by their market makers trading on the 0x protocol (MixinStakingPool).
/// The operator of a pool receives a fixed percentage of all rewards; generally, the operator is the
@@ -74,38 +72,7 @@ contract MixinStakingPoolRewards is
/// their realized balance *increases* while their ownership of the pool *decreases*. To reflect this, we
/// decrease their Shadow Balance, the Total Shadow Balance, their Real Balance, and the Total Real Balance.
/// @dev Returns the sum total reward balance in ETH of a staking pool, across all members and the pool operator.
/// @param poolId Unique id of pool.
/// @return Balance.
function getTotalRewardBalanceOfStakingPool(bytes32 poolId)
external
view
returns (uint256)
{
return getTotalBalanceInStakingPoolRewardVault(poolId);
}
/// @dev Returns the total shadow balance of a staking pool.
/// @param poolId Unique id of pool.
/// @return Balance.
function getTotalShadowBalanceOfStakingPool(bytes32 poolId)
public
view
returns (uint256)
{
return shadowRewardsByPoolId[poolId];
}
/// @dev Returns the reward balance in ETH of the pool operator.
/// @param poolId Unique id of pool.
/// @return Balance.
function getRewardBalanceOfStakingPoolOperator(bytes32 poolId)
external
view
returns (uint256)
{
return getBalanceOfOperatorInStakingPoolRewardVault(poolId);
}
using LibSafeMath for uint256;
/// @dev Withdraws an amount in ETH of the reward for the pool operator.
/// @param poolId Unique id of pool.
@@ -133,48 +100,6 @@ contract MixinStakingPoolRewards is
return amount;
}
/// @dev Returns the reward balance in ETH co-owned by the members of a pool.
/// @param poolId Unique id of pool.
/// @return Balance.
function getRewardBalanceOfStakingPoolMembers(bytes32 poolId)
external
view
returns (uint256)
{
return getBalanceOfMembersInStakingPoolRewardVault(poolId);
}
/// @dev Returns the shadow balance of a specific member of a staking pool.
/// @param poolId Unique id of pool.
/// @param member The member of the pool.
/// @return Balance.
function getShadowBalanceOfStakingPoolMember(bytes32 poolId, address member)
public
view
returns (uint256)
{
return shadowRewardsInPoolByOwner[member][poolId];
}
/// @dev Computes the reward balance in ETH of a specific member of a pool.
/// @param poolId Unique id of pool.
/// @param member The member of the pool.
/// @return Balance.
function computeRewardBalanceOfStakingPoolMember(bytes32 poolId, address member)
public
view
returns (uint256)
{
uint256 poolBalance = getBalanceOfMembersInStakingPoolRewardVault(poolId);
return LibRewardMath._computePayoutDenominatedInRealAsset(
delegatedStakeToPoolByOwner[member][poolId],
delegatedStakeByPoolId[poolId],
shadowRewardsInPoolByOwner[member][poolId],
shadowRewardsByPoolId[poolId],
poolBalance
);
}
/// @dev Withdraws an amount in ETH of the reward for a pool member.
/// @param poolId Unique id of pool.
/// @param amount The amount to withdraw.
@@ -218,4 +143,79 @@ contract MixinStakingPoolRewards is
member.transfer(amount);
return amount;
}
/// @dev Returns the sum total reward balance in ETH of a staking pool, across all members and the pool operator.
/// @param poolId Unique id of pool.
/// @return Balance.
function getTotalRewardBalanceOfStakingPool(bytes32 poolId)
external
view
returns (uint256)
{
return getTotalBalanceInStakingPoolRewardVault(poolId);
}
/// @dev Returns the reward balance in ETH of the pool operator.
/// @param poolId Unique id of pool.
/// @return Balance.
function getRewardBalanceOfStakingPoolOperator(bytes32 poolId)
external
view
returns (uint256)
{
return getBalanceOfOperatorInStakingPoolRewardVault(poolId);
}
/// @dev Returns the reward balance in ETH co-owned by the members of a pool.
/// @param poolId Unique id of pool.
/// @return Balance.
function getRewardBalanceOfStakingPoolMembers(bytes32 poolId)
external
view
returns (uint256)
{
return getBalanceOfMembersInStakingPoolRewardVault(poolId);
}
/// @dev Returns the shadow balance of a specific member of a staking pool.
/// @param poolId Unique id of pool.
/// @param member The member of the pool.
/// @return Balance.
function getShadowBalanceOfStakingPoolMember(bytes32 poolId, address member)
public
view
returns (uint256)
{
return shadowRewardsInPoolByOwner[member][poolId];
}
/// @dev Returns the total shadow balance of a staking pool.
/// @param poolId Unique id of pool.
/// @return Balance.
function getTotalShadowBalanceOfStakingPool(bytes32 poolId)
public
view
returns (uint256)
{
return shadowRewardsByPoolId[poolId];
}
/// @dev Computes the reward balance in ETH of a specific member of a pool.
/// @param poolId Unique id of pool.
/// @param member The member of the pool.
/// @return Balance.
function computeRewardBalanceOfStakingPoolMember(bytes32 poolId, address member)
public
view
returns (uint256)
{
uint256 poolBalance = getBalanceOfMembersInStakingPoolRewardVault(poolId);
return LibRewardMath._computePayoutDenominatedInRealAsset(
delegatedStakeToPoolByOwner[member][poolId],
delegatedStakeByPoolId[poolId],
shadowRewardsInPoolByOwner[member][poolId],
shadowRewardsByPoolId[poolId],
poolBalance
);
}
}

View File

@@ -28,7 +28,6 @@ contract IMixinScheduler {
/// Epochs serve as the basis for all other time intervals, which provides a more stable
/// and consistent scheduling metric than time. Timelocks, for example, are measured in epochs.
/*
/// @dev Returns the current epoch.
function getCurrentEpoch()
public
@@ -83,5 +82,4 @@ contract IMixinScheduler {
public
view
returns (uint64);
*/
}

View File

@@ -63,7 +63,6 @@ interface IStakingEvents {
address newOwner
);
/// @dev Emitted by MixinStakingPool when a new pool is created.
/// @param poolId Unique id generated for pool.
/// @param operatorAddress Address of creator/operator of pool.

View File

@@ -120,7 +120,7 @@ describe('End-To-End Simulations', () => {
// @TODO - get computations more accurate
Pool | Total Fees | Total Stake | Total Delegated Stake | Total Stake (Weighted) | Payout
0 | 0.304958 | 42 | 0 | 42 | 3.0060373...
1 | 15.323258 | 84 | 0 | 84 |
1 | 15.323258 | 84 | 0 | 84 |
3 | 28.12222236 | 97 | 182 | 260.8
...
Cumulative Fees = 43.75043836

View File

@@ -11,8 +11,8 @@ import * as _ from 'lodash';
import {
artifacts,
LibFeeMathTestContract,
StakingPoolRewardVaultContract,
StakingContract,
StakingPoolRewardVaultContract,
StakingProxyContract,
ZrxVaultContract,
} from '../../src';
@@ -411,7 +411,6 @@ export class StakingWrapper {
logUtils.log(
`Finalization costed ${txReceipt.gasUsed} gas`,
);
console.log(JSON.stringify(txReceipt.logs, null, 4));
return txReceipt;
}
public async skipToNextEpochAsync(): Promise<TransactionReceiptWithDecodedLogs> {