Removed MixinStakingPoolRewards

This commit is contained in:
Greg Hysen
2019-09-17 17:22:03 -07:00
parent 768387fea9
commit 877abeda63
8 changed files with 8 additions and 126 deletions

View File

@@ -156,7 +156,7 @@ contract MixinExchangeFees is
/// Each pool receives a portion of the fees generated this epoch (see _cobbDouglas) that is
/// proportional to (i) the fee volume attributed to their pool over the epoch, and
/// (ii) the amount of stake provided by the maker and their delegators. Rebates are paid
/// into the Reward Vault (see MixinStakingPoolRewardVault) where they can be withdraw by makers and
/// into the Reward Vault where they can be withdraw by makers and
/// the members of their pool. There will be a small amount of ETH leftover in this contract
/// after paying out the rebates; at present, this rolls over into the next epoch. Eventually,
/// we plan to deposit this leftover into a DAO managed by the 0x community.
@@ -278,9 +278,6 @@ contract MixinExchangeFees is
initialContractBalance
));
}
if (totalRewardsPaid > 0) {
_depositIntoStakingPoolRewardVault(totalRewardsPaid);
}
finalContractBalance = address(this).balance;

View File

@@ -137,12 +137,6 @@ interface IStakingEvents {
address makerAddress
);
/// @dev Emitted by MixinStakingPoolRewardVault when the vault's address is changed.
/// @param rewardVaultAddress Address of new reward vault.
event StakingPoolRewardVaultChanged(
address rewardVaultAddress
);
/// @dev Emitted when a staking pool's operator share is decreased.
/// @param poolId Unique Id of pool.
/// @param oldOperatorShare Previous share of rewards owned by operator.

View File

@@ -22,11 +22,9 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/LibFractions.sol";
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
import "../stake/MixinStakeBalances.sol";
import "./MixinStakingPoolRewardVault.sol";
contract MixinCumulativeRewards is
MixinStakingPoolRewardVault,
MixinStakeBalances
{
using LibSafeMath for uint256;

View File

@@ -1,84 +0,0 @@
/*
Copyright 2019 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.9;
import "@0x/contracts-utils/contracts/src/LibRichErrors.sol";
import "../libs/LibStakingRichErrors.sol";
import "../interfaces/IStakingEvents.sol";
import "../interfaces/IStakingPoolRewardVault.sol";
import "../immutable/MixinStorage.sol";
/// @dev This mixin contains logic for interfacing with the Staking Pool Reward Vault (vaults/StakingPoolRewardVault.sol)
/// Note that setters are callable only by the owner of this contract, and withdraw functionality is accessible only
/// from within this contract.
contract MixinStakingPoolRewardVault is
IStakingEvents,
MixinStorage
{
/// @dev Sets the address of the reward vault.
/// This can only be called by the owner of this contract.
function setStakingPoolRewardVault(address payable rewardVaultAddress)
external
onlyOwner
{
rewardVault = IStakingPoolRewardVault(rewardVaultAddress);
emit StakingPoolRewardVaultChanged(rewardVaultAddress);
}
/// @dev Returns the staking pool reward vault
/// @return Address of reward vault.
function getStakingPoolRewardVault()
public
view
returns (address)
{
return address(rewardVault);
}
/// @dev Deposits an amount in ETH into the reward vault.
/// @param amount The amount in ETH to deposit.
function _depositIntoStakingPoolRewardVault(uint256 amount)
internal
{
// cast to payable then transfer
address payable rewardVaultAddress = address(uint160(address(rewardVault)));
rewardVaultAddress.transfer(amount);
}
/// @dev Transfer from transient Reward Pool vault to ETH Vault.
/// @param poolId Unique Id of pool.
/// @param member of pool to transfer ETH to.
/// @param amount The amount in ETH to transfer.
function _transferMemberBalanceToEthVault(
bytes32 poolId,
address member,
uint256 amount
)
internal
{
rewardVault.transferToEthVault(
poolId,
member,
amount,
address(ethVault)
);
}
}

View File

@@ -130,11 +130,7 @@ contract MixinStakingPoolRewards is
reward
);
_transferOperatorRewardToEthVault(
poolId,
pool.operator,
operatorPortion
);
ethVault.depositFor.value(operatorPortion)(pool.operator);
// compute the reward portion for the pool members and transfer it to the Reward Vault.
uint256 membersPortion = reward.safeSub(operatorPortion);
@@ -201,7 +197,12 @@ contract MixinStakingPoolRewards is
}
// transfer from transient Reward Pool vault to ETH Vault
_transferMemberBalanceToEthVault(poolId, member, balance);
rewardVault.transferToEthVault(
poolId,
member,
balance,
address(ethVault)
);
}
/// @dev Computes the reward balance in ETH of a specific member of a pool.
@@ -291,24 +292,4 @@ contract MixinStakingPoolRewards is
);
}
}
/// @dev Transfers operator reward to the ETH vault.
/// @param poolId Unique Id of pool to transfer reward for,
/// @param operator of the pool.
/// @param amount of ETH to transfer.
function _transferOperatorRewardToEthVault(
bytes32 poolId,
address operator,
uint256 amount
)
private
{
// perform transfer and notify
ethVault.depositFor.value(amount)(operator);
emit OperatorRewardTransferredToEthVault(
poolId,
operator,
amount
);
}
}

View File

@@ -35,7 +35,6 @@ import * as MixinStakingPool from '../generated-artifacts/MixinStakingPool.json'
import * as MixinStakingPoolMakers from '../generated-artifacts/MixinStakingPoolMakers.json';
import * as MixinStakingPoolModifiers from '../generated-artifacts/MixinStakingPoolModifiers.json';
import * as MixinStakingPoolRewards from '../generated-artifacts/MixinStakingPoolRewards.json';
import * as MixinStakingPoolRewardVault from '../generated-artifacts/MixinStakingPoolRewardVault.json';
import * as MixinStorage from '../generated-artifacts/MixinStorage.json';
import * as MixinVaultCore from '../generated-artifacts/MixinVaultCore.json';
import * as ReadOnlyProxy from '../generated-artifacts/ReadOnlyProxy.json';
@@ -86,7 +85,6 @@ export const artifacts = {
MixinStakingPool: MixinStakingPool as ContractArtifact,
MixinStakingPoolMakers: MixinStakingPoolMakers as ContractArtifact,
MixinStakingPoolModifiers: MixinStakingPoolModifiers as ContractArtifact,
MixinStakingPoolRewardVault: MixinStakingPoolRewardVault as ContractArtifact,
MixinStakingPoolRewards: MixinStakingPoolRewards as ContractArtifact,
MixinParams: MixinParams as ContractArtifact,
MixinScheduler: MixinScheduler as ContractArtifact,

View File

@@ -32,7 +32,6 @@ export * from '../generated-wrappers/mixin_stake_storage';
export * from '../generated-wrappers/mixin_staking_pool';
export * from '../generated-wrappers/mixin_staking_pool_makers';
export * from '../generated-wrappers/mixin_staking_pool_modifiers';
export * from '../generated-wrappers/mixin_staking_pool_reward_vault';
export * from '../generated-wrappers/mixin_staking_pool_rewards';
export * from '../generated-wrappers/mixin_storage';
export * from '../generated-wrappers/mixin_vault_core';

View File

@@ -32,7 +32,6 @@
"generated-artifacts/MixinStakingPool.json",
"generated-artifacts/MixinStakingPoolMakers.json",
"generated-artifacts/MixinStakingPoolModifiers.json",
"generated-artifacts/MixinStakingPoolRewardVault.json",
"generated-artifacts/MixinStakingPoolRewards.json",
"generated-artifacts/MixinStorage.json",
"generated-artifacts/MixinVaultCore.json",