Renamed xxxReward... to StakingPoolReward...

This commit is contained in:
Greg Hysen
2019-06-27 16:02:53 -07:00
parent 217811d0af
commit e6a33dea0e
14 changed files with 72 additions and 71 deletions

View File

@@ -21,13 +21,13 @@ pragma solidity ^0.5.9;
import "./interfaces/IStaking.sol"; import "./interfaces/IStaking.sol";
import "./core/MixinExchangeManager.sol"; import "./core/MixinExchangeManager.sol";
import "./core/MixinZrxVault.sol"; import "./core/MixinZrxVault.sol";
import "./core/MixinRewardVault.sol"; import "./core/MixinStakingPoolRewardVault.sol";
import "./core/MixinScheduler.sol"; import "./core/MixinScheduler.sol";
import "./core/MixinStakeBalances.sol"; import "./core/MixinStakeBalances.sol";
import "./core/MixinStake.sol"; import "./core/MixinStake.sol";
import "./core/MixinStakingPool.sol"; import "./core/MixinStakingPool.sol";
import "./core/MixinExchangeFees.sol"; import "./core/MixinExchangeFees.sol";
import "./core/MixinRewards.sol"; import "./core/MixinStakingPoolRewards.sol";
contract Staking is contract Staking is
@@ -36,12 +36,12 @@ contract Staking is
MixinConstants, MixinConstants,
MixinStorage, MixinStorage,
MixinScheduler, MixinScheduler,
MixinRewardVault, MixinStakingPoolRewardVault,
MixinZrxVault, MixinZrxVault,
MixinExchangeManager, MixinExchangeManager,
MixinStakeBalances, MixinStakeBalances,
MixinStakingPool, MixinStakingPool,
MixinRewards, MixinStakingPoolRewards,
MixinStake, MixinStake,
MixinExchangeFees MixinExchangeFees
{ {

View File

@@ -27,7 +27,7 @@ import "./MixinStakeBalances.sol";
import "./MixinScheduler.sol"; import "./MixinScheduler.sol";
import "./MixinStakingPool.sol"; import "./MixinStakingPool.sol";
import "./MixinExchangeManager.sol"; import "./MixinExchangeManager.sol";
import "./MixinRewardVault.sol"; import "./MixinStakingPoolRewardVault.sol";
import "../interfaces/IStructs.sol"; import "../interfaces/IStructs.sol";
@@ -36,7 +36,7 @@ contract MixinExchangeFees is
MixinConstants, MixinConstants,
MixinStorage, MixinStorage,
MixinScheduler, MixinScheduler,
MixinRewardVault, MixinStakingPoolRewardVault,
MixinExchangeManager, MixinExchangeManager,
MixinStakeBalances, MixinStakeBalances,
MixinStakingPool MixinStakingPool
@@ -121,7 +121,7 @@ contract MixinExchangeFees is
/// Each pool receives a portion of the fees generated this epoch (see LibFeeMath) that is /// Each pool receives a portion of the fees generated this epoch (see LibFeeMath) that is
/// proportional to (i) the fee volume attributed to their pool over the epoch, and /// 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 /// (ii) the amount of stake provided by the maker and their delegators. Rebates are paid
/// into the Reward Vault (see MixinRewardVault) where they can be withdraw by makers and /// into the Reward Vault (see MixinStakingPoolRewardVault) 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 /// 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, /// 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. /// we plan to deposit this leftover into a DAO managed by the 0x community.
@@ -211,7 +211,7 @@ contract MixinExchangeFees is
); );
// record reward in vault // record reward in vault
_recordDepositInRewardVault(activePools[i].poolId, reward); _recordDepositInStakingPoolRewardVault(activePools[i].poolId, reward);
totalRewardsPaid = totalRewardsPaid._add(reward); totalRewardsPaid = totalRewardsPaid._add(reward);
// clear state for gas refunds // clear state for gas refunds
@@ -226,7 +226,7 @@ contract MixinExchangeFees is
"MISCALCULATED_REWARDS" "MISCALCULATED_REWARDS"
); );
if (totalRewardsPaid > 0) { if (totalRewardsPaid > 0) {
_depositIntoRewardVault(totalRewardsPaid); _depositIntoStakingPoolRewardVault(totalRewardsPaid);
} }
finalContractBalance = address(this).balance; finalContractBalance = address(this).balance;

View File

@@ -24,7 +24,7 @@ import "../immutable/MixinConstants.sol";
import "../immutable/MixinStorage.sol"; import "../immutable/MixinStorage.sol";
import "../interfaces/IStakingEvents.sol"; import "../interfaces/IStakingEvents.sol";
import "./MixinZrxVault.sol"; import "./MixinZrxVault.sol";
import "./MixinRewardVault.sol"; import "./MixinStakingPoolRewardVault.sol";
import "./MixinScheduler.sol"; import "./MixinScheduler.sol";
import "./MixinStakeBalances.sol"; import "./MixinStakeBalances.sol";
@@ -34,7 +34,7 @@ contract MixinStake is
MixinConstants, MixinConstants,
MixinStorage, MixinStorage,
MixinScheduler, MixinScheduler,
MixinRewardVault, MixinStakingPoolRewardVault,
MixinZrxVault, MixinZrxVault,
MixinStakeBalances MixinStakeBalances
{ {
@@ -178,7 +178,7 @@ contract MixinStake is
// update delegator's share of reward pool // update delegator's share of reward pool
// note that this uses the snapshot parameters // note that this uses the snapshot parameters
uint256 poolBalance = getBalanceOfPoolInRewardVault(poolId); uint256 poolBalance = getBalanceOfPoolInStakingPoolRewardVault(poolId);
uint256 buyIn = LibRewardMath._computeBuyInDenominatedInShadowAsset( uint256 buyIn = LibRewardMath._computeBuyInDenominatedInShadowAsset(
amount, amount,
_delegatedStakeByPoolId, _delegatedStakeByPoolId,
@@ -211,7 +211,7 @@ contract MixinStake is
// get payout // get payout
// TODO -- not full balance, just balance that belongs to delegators. // TODO -- not full balance, just balance that belongs to delegators.
uint256 poolBalance = getBalanceOfPoolInRewardVault(poolId); uint256 poolBalance = getBalanceOfPoolInStakingPoolRewardVault(poolId);
uint256 payoutInRealAsset; uint256 payoutInRealAsset;
uint256 payoutInShadowAsset; uint256 payoutInShadowAsset;
if (_delegatedStakeToPoolByOwner == amount) { if (_delegatedStakeToPoolByOwner == amount) {
@@ -240,7 +240,7 @@ contract MixinStake is
// withdraw payout for delegator // withdraw payout for delegator
if (payoutInRealAsset > 0) { if (payoutInRealAsset > 0) {
_withdrawFromPoolInRewardVault(poolId, payoutInRealAsset); _withdrawFromPoolInStakingPoolRewardVault(poolId, payoutInRealAsset);
owner.transfer(payoutInRealAsset); owner.transfer(payoutInRealAsset);
} }
} }

View File

@@ -26,14 +26,14 @@ import "../interfaces/IStructs.sol";
import "../interfaces/IStakingEvents.sol"; import "../interfaces/IStakingEvents.sol";
import "../immutable/MixinConstants.sol"; import "../immutable/MixinConstants.sol";
import "../immutable/MixinStorage.sol"; import "../immutable/MixinStorage.sol";
import "./MixinRewardVault.sol"; import "./MixinStakingPoolRewardVault.sol";
contract MixinStakingPool is contract MixinStakingPool is
IStakingEvents, IStakingEvents,
MixinConstants, MixinConstants,
MixinStorage, MixinStorage,
MixinRewardVault MixinStakingPoolRewardVault
{ {
using LibSafeMath for uint256; using LibSafeMath for uint256;
@@ -108,7 +108,7 @@ contract MixinStakingPool is
poolById[poolId] = pool; poolById[poolId] = pool;
// register pool in reward vault // register pool in reward vault
_createPoolInRewardVault(poolId, operatorShare); _createPoolInStakingPoolRewardVault(poolId, operatorShare);
// notify // notify
emit StakingPoolCreated(poolId, operatorAddress, operatorShare); emit StakingPoolCreated(poolId, operatorAddress, operatorShare);

View File

@@ -18,22 +18,22 @@
pragma solidity ^0.5.5; pragma solidity ^0.5.5;
import "../interfaces/IRewardVault.sol"; import "../interfaces/IStakingPoolRewardVault.sol";
import "../immutable/MixinStorage.sol"; import "../immutable/MixinStorage.sol";
contract MixinRewardVault is contract MixinStakingPoolRewardVault is
MixinStorage MixinStorage
{ {
function setRewardVault(address payable _rewardVault) function setStakingPoolRewardVault(address payable _rewardVault)
external external
// onlyOwner // onlyOwner
{ {
rewardVault = IRewardVault(_rewardVault); rewardVault = IStakingPoolRewardVault(_rewardVault);
} }
function getRewardVault() function getStakingPoolRewardVault()
public public
view view
returns (address) returns (address)
@@ -41,7 +41,7 @@ contract MixinRewardVault is
return address(rewardVault); return address(rewardVault);
} }
function getBalanceInRewardVault(bytes32 poolId) function getBalanceInStakingPoolRewardVault(bytes32 poolId)
public public
view view
returns (uint256) returns (uint256)
@@ -49,7 +49,7 @@ contract MixinRewardVault is
return rewardVault.balanceOf(poolId); return rewardVault.balanceOf(poolId);
} }
function getBalanceOfOperatorInRewardVault(bytes32 poolId) function getBalanceOfOperatorInStakingPoolRewardVault(bytes32 poolId)
public public
view view
returns (uint256) returns (uint256)
@@ -57,7 +57,7 @@ contract MixinRewardVault is
return rewardVault.balanceOfOperator(poolId); return rewardVault.balanceOfOperator(poolId);
} }
function getBalanceOfPoolInRewardVault(bytes32 poolId) function getBalanceOfPoolInStakingPoolRewardVault(bytes32 poolId)
public public
view view
returns (uint256) returns (uint256)
@@ -65,7 +65,7 @@ contract MixinRewardVault is
return rewardVault.balanceOfPool(poolId); return rewardVault.balanceOfPool(poolId);
} }
function _createPoolInRewardVault(bytes32 poolId, uint8 operatorShare) function _createPoolInStakingPoolRewardVault(bytes32 poolId, uint8 operatorShare)
internal internal
{ {
rewardVault.createPool( rewardVault.createPool(
@@ -74,26 +74,26 @@ contract MixinRewardVault is
); );
} }
function _withdrawFromPoolInRewardVault(bytes32 poolId, uint256 amount) function _withdrawFromPoolInStakingPoolRewardVault(bytes32 poolId, uint256 amount)
internal internal
{ {
rewardVault.withdrawFromPool(poolId, amount); rewardVault.withdrawFromPool(poolId, amount);
} }
function _withdrawFromOperatorInRewardVault(bytes32 poolId, uint256 amount) function _withdrawFromOperatorInStakingPoolRewardVault(bytes32 poolId, uint256 amount)
internal internal
{ {
rewardVault.withdrawFromOperator(poolId, amount); rewardVault.withdrawFromOperator(poolId, amount);
} }
function _depositIntoRewardVault(uint256 amountInWei) function _depositIntoStakingPoolRewardVault(uint256 amountInWei)
internal internal
{ {
address payable rewardVaultAddress = address(uint160(address(rewardVault))); address payable rewardVaultAddress = address(uint160(address(rewardVault)));
rewardVaultAddress.transfer(amountInWei); rewardVaultAddress.transfer(amountInWei);
} }
function _recordDepositInRewardVault(bytes32 poolId, uint256 amount) function _recordDepositInStakingPoolRewardVault(bytes32 poolId, uint256 amount)
internal internal
{ {
rewardVault.recordDepositFor(poolId, amount); rewardVault.recordDepositFor(poolId, amount);

View File

@@ -23,27 +23,28 @@ import "../libs/LibRewardMath.sol";
import "../immutable/MixinStorage.sol"; import "../immutable/MixinStorage.sol";
import "../immutable/MixinConstants.sol"; import "../immutable/MixinConstants.sol";
import "./MixinStakeBalances.sol"; import "./MixinStakeBalances.sol";
import "./MixinRewardVault.sol"; import "./MixinStakingPoolRewardVault.sol";
import "./MixinStakingPool.sol"; import "./MixinStakingPool.sol";
contract MixinRewards is contract MixinStakingPoolRewards is
MixinConstants, MixinConstants,
MixinStorage, MixinStorage,
MixinRewardVault, MixinStakingPoolRewardVault,
MixinStakeBalances, MixinStakeBalances,
MixinStakingPool MixinStakingPool
{ {
using LibSafeMath for uint256; using LibSafeMath for uint256;
/// @dev This mixin contains logic for managing the reward pool /// @dev This mixin contains logic for managing the rewards belonging to a staking pool.
///
function withdrawOperatorReward(bytes32 poolId, uint256 amount) function withdrawOperatorReward(bytes32 poolId, uint256 amount)
external external
onlyPoolOperator(poolId) onlyPoolOperator(poolId)
{ {
_withdrawFromOperatorInRewardVault(poolId, amount); _withdrawFromOperatorInStakingPoolRewardVault(poolId, amount);
poolById[poolId].operatorAddress.transfer(amount); poolById[poolId].operatorAddress.transfer(amount);
} }
@@ -60,7 +61,7 @@ contract MixinRewards is
shadowRewardsInPoolByOwner[owner][poolId] = shadowRewardsInPoolByOwner[owner][poolId]._add(amount); shadowRewardsInPoolByOwner[owner][poolId] = shadowRewardsInPoolByOwner[owner][poolId]._add(amount);
shadowRewardsByPoolId[poolId] = shadowRewardsByPoolId[poolId]._add(amount); shadowRewardsByPoolId[poolId] = shadowRewardsByPoolId[poolId]._add(amount);
_withdrawFromPoolInRewardVault(poolId, amount); _withdrawFromPoolInStakingPoolRewardVault(poolId, amount);
owner.transfer(amount); owner.transfer(amount);
} }
@@ -69,8 +70,8 @@ contract MixinRewards is
onlyPoolOperator(poolId) onlyPoolOperator(poolId)
returns (uint256) returns (uint256)
{ {
uint256 amount = getBalanceOfOperatorInRewardVault(poolId); uint256 amount = getBalanceOfOperatorInStakingPoolRewardVault(poolId);
_withdrawFromOperatorInRewardVault(poolId, amount); _withdrawFromOperatorInStakingPoolRewardVault(poolId, amount);
poolById[poolId].operatorAddress.transfer(amount); poolById[poolId].operatorAddress.transfer(amount);
return amount; return amount;
@@ -86,7 +87,7 @@ contract MixinRewards is
shadowRewardsInPoolByOwner[owner][poolId] = shadowRewardsInPoolByOwner[owner][poolId]._add(amount); shadowRewardsInPoolByOwner[owner][poolId] = shadowRewardsInPoolByOwner[owner][poolId]._add(amount);
shadowRewardsByPoolId[poolId] = shadowRewardsByPoolId[poolId]._add(amount); shadowRewardsByPoolId[poolId] = shadowRewardsByPoolId[poolId]._add(amount);
_withdrawFromPoolInRewardVault(poolId, amount); _withdrawFromPoolInStakingPoolRewardVault(poolId, amount);
owner.transfer(amount); owner.transfer(amount);
return amount; return amount;
@@ -97,7 +98,7 @@ contract MixinRewards is
view view
returns (uint256) returns (uint256)
{ {
return getBalanceInRewardVault(poolId); return getBalanceInStakingPoolRewardVault(poolId);
} }
function getRewardBalanceOfOperator(bytes32 poolId) function getRewardBalanceOfOperator(bytes32 poolId)
@@ -105,7 +106,7 @@ contract MixinRewards is
view view
returns (uint256) returns (uint256)
{ {
return getBalanceOfOperatorInRewardVault(poolId); return getBalanceOfOperatorInStakingPoolRewardVault(poolId);
} }
function getRewardBalanceOfPool(bytes32 poolId) function getRewardBalanceOfPool(bytes32 poolId)
@@ -113,7 +114,7 @@ contract MixinRewards is
view view
returns (uint256) returns (uint256)
{ {
return getBalanceOfPoolInRewardVault(poolId); return getBalanceOfPoolInStakingPoolRewardVault(poolId);
} }
function computeRewardBalance(bytes32 poolId, address owner) function computeRewardBalance(bytes32 poolId, address owner)
@@ -121,7 +122,7 @@ contract MixinRewards is
view view
returns (uint256) returns (uint256)
{ {
uint256 poolBalance = getBalanceOfPoolInRewardVault(poolId); uint256 poolBalance = getBalanceOfPoolInStakingPoolRewardVault(poolId);
return LibRewardMath._computePayoutDenominatedInRealAsset( return LibRewardMath._computePayoutDenominatedInRealAsset(
delegatedStakeToPoolByOwner[owner][poolId], delegatedStakeToPoolByOwner[owner][poolId],
delegatedStakeByPoolId[poolId], delegatedStakeByPoolId[poolId],

View File

@@ -19,7 +19,7 @@
pragma solidity ^0.5.5; pragma solidity ^0.5.5;
import "../interfaces/IZrxVault.sol"; import "../interfaces/IZrxVault.sol";
import "../interfaces/IRewardVault.sol"; import "../interfaces/IStakingPoolRewardVault.sol";
import "./MixinConstants.sol"; import "./MixinConstants.sol";
import "../interfaces/IStructs.sol"; import "../interfaces/IStructs.sol";
@@ -102,5 +102,5 @@ contract MixinStorage is
IZrxVault internal zrxVault; IZrxVault internal zrxVault;
// Rebate Vault // Rebate Vault
IRewardVault internal rewardVault; IStakingPoolRewardVault internal rewardVault;
} }

View File

@@ -19,7 +19,7 @@
pragma solidity ^0.5.5; pragma solidity ^0.5.5;
interface IRewardVault { interface IStakingPoolRewardVault {
function () function ()
external external

View File

@@ -21,12 +21,12 @@ pragma solidity ^0.5.5;
import "../libs/LibSafeMath.sol"; import "../libs/LibSafeMath.sol";
import "../libs/LibSafeMath96.sol"; import "../libs/LibSafeMath96.sol";
import "./MixinVaultCore.sol"; import "./MixinVaultCore.sol";
import "../interfaces/IRewardVault.sol"; import "../interfaces/IStakingPoolRewardVault.sol";
import "../immutable/MixinConstants.sol"; import "../immutable/MixinConstants.sol";
contract RewardVault is contract StakingPoolRewardVault is
IRewardVault, IStakingPoolRewardVault,
MixinConstants, MixinConstants,
MixinVaultCore MixinVaultCore
{ {

View File

@@ -36,7 +36,7 @@
"compile:truffle": "truffle compile" "compile:truffle": "truffle compile"
}, },
"config": { "config": {
"abis": "./generated-artifacts/@(LibFeeMathTest|LibZrxToken|MixinStake|RewardVault|Staking|StakingProxy|ZrxVault).json", "abis": "./generated-artifacts/@(LibFeeMathTest|LibZrxToken|MixinStake|Staking|StakingPoolRewardVault|StakingProxy|ZrxVault).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
}, },
"repository": { "repository": {

View File

@@ -8,8 +8,8 @@ import { ContractArtifact } from 'ethereum-types';
import * as LibFeeMathTest from '../generated-artifacts/LibFeeMathTest.json'; import * as LibFeeMathTest from '../generated-artifacts/LibFeeMathTest.json';
import * as LibZrxToken from '../generated-artifacts/LibZrxToken.json'; import * as LibZrxToken from '../generated-artifacts/LibZrxToken.json';
import * as MixinStake from '../generated-artifacts/MixinStake.json'; import * as MixinStake from '../generated-artifacts/MixinStake.json';
import * as RewardVault from '../generated-artifacts/RewardVault.json';
import * as Staking from '../generated-artifacts/Staking.json'; import * as Staking from '../generated-artifacts/Staking.json';
import * as StakingPoolRewardVault from '../generated-artifacts/StakingPoolRewardVault.json';
import * as StakingProxy from '../generated-artifacts/StakingProxy.json'; import * as StakingProxy from '../generated-artifacts/StakingProxy.json';
import * as ZrxVault from '../generated-artifacts/ZrxVault.json'; import * as ZrxVault from '../generated-artifacts/ZrxVault.json';
export const artifacts = { export const artifacts = {
@@ -17,7 +17,7 @@ export const artifacts = {
StakingProxy: StakingProxy as ContractArtifact, StakingProxy: StakingProxy as ContractArtifact,
MixinStake: MixinStake as ContractArtifact, MixinStake: MixinStake as ContractArtifact,
LibZrxToken: LibZrxToken as ContractArtifact, LibZrxToken: LibZrxToken as ContractArtifact,
RewardVault: RewardVault as ContractArtifact, StakingPoolRewardVault: StakingPoolRewardVault as ContractArtifact,
ZrxVault: ZrxVault as ContractArtifact, ZrxVault: ZrxVault as ContractArtifact,
LibFeeMathTest: LibFeeMathTest as ContractArtifact, LibFeeMathTest: LibFeeMathTest as ContractArtifact,
}; };

View File

@@ -6,7 +6,7 @@
export * from '../generated-wrappers/lib_fee_math_test'; export * from '../generated-wrappers/lib_fee_math_test';
export * from '../generated-wrappers/lib_zrx_token'; export * from '../generated-wrappers/lib_zrx_token';
export * from '../generated-wrappers/mixin_stake'; export * from '../generated-wrappers/mixin_stake';
export * from '../generated-wrappers/reward_vault';
export * from '../generated-wrappers/staking'; export * from '../generated-wrappers/staking';
export * from '../generated-wrappers/staking_pool_reward_vault';
export * from '../generated-wrappers/staking_proxy'; export * from '../generated-wrappers/staking_proxy';
export * from '../generated-wrappers/zrx_vault'; export * from '../generated-wrappers/zrx_vault';

View File

@@ -11,7 +11,7 @@ import * as _ from 'lodash';
import { import {
artifacts, artifacts,
LibFeeMathTestContract, LibFeeMathTestContract,
RewardVaultContract, StakingPoolRewardVaultContract,
StakingContract, StakingContract,
StakingProxyContract, StakingProxyContract,
ZrxVaultContract, ZrxVaultContract,
@@ -32,7 +32,7 @@ export class StakingWrapper {
private _stakingContractIfExists?: StakingContract; private _stakingContractIfExists?: StakingContract;
private _stakingProxyContractIfExists?: StakingProxyContract; private _stakingProxyContractIfExists?: StakingProxyContract;
private _zrxVaultContractIfExists?: ZrxVaultContract; private _zrxVaultContractIfExists?: ZrxVaultContract;
private _rewardVaultContractIfExists?: RewardVaultContract; private _rewardVaultContractIfExists?: StakingPoolRewardVaultContract;
private _LibFeeMathTestContractIfExists?: LibFeeMathTestContract; private _LibFeeMathTestContractIfExists?: LibFeeMathTestContract;
public static toBaseUnitAmount(amount: BigNumber | number): BigNumber { public static toBaseUnitAmount(amount: BigNumber | number): BigNumber {
const decimals = 18; const decimals = 18;
@@ -90,9 +90,9 @@ export class StakingWrapper {
this._validateDeployedOrThrow(); this._validateDeployedOrThrow();
return this._zrxVaultContractIfExists as ZrxVaultContract; return this._zrxVaultContractIfExists as ZrxVaultContract;
} }
public getRewardVaultContract(): RewardVaultContract { public getStakingPoolRewardVaultContract(): StakingPoolRewardVaultContract {
this._validateDeployedOrThrow(); this._validateDeployedOrThrow();
return this._rewardVaultContractIfExists as RewardVaultContract; return this._rewardVaultContractIfExists as StakingPoolRewardVaultContract;
} }
public getLibFeeMathTestContract(): LibFeeMathTestContract { public getLibFeeMathTestContract(): LibFeeMathTestContract {
this._validateDeployedOrThrow(); this._validateDeployedOrThrow();
@@ -110,8 +110,8 @@ export class StakingWrapper {
zrxAssetData, zrxAssetData,
); );
// deploy reward vault // deploy reward vault
this._rewardVaultContractIfExists = await RewardVaultContract.deployFrom0xArtifactAsync( this._rewardVaultContractIfExists = await StakingPoolRewardVaultContract.deployFrom0xArtifactAsync(
artifacts.RewardVault, artifacts.StakingPoolRewardVault,
this._provider, this._provider,
txDefaults, txDefaults,
); );
@@ -156,17 +156,17 @@ export class StakingWrapper {
(this._stakingProxyContractIfExists).address, (this._stakingProxyContractIfExists).address,
); );
// set reward vault in staking contract // set reward vault in staking contract
const setRewardVaultCalldata = (this const setStakingPoolRewardVaultCalldata = (this
._stakingContractIfExists).setRewardVault.getABIEncodedTransactionData( ._stakingContractIfExists).setStakingPoolRewardVault.getABIEncodedTransactionData(
(this._rewardVaultContractIfExists).address, (this._rewardVaultContractIfExists).address,
); );
const setRewardVaultTxData = { const setStakingPoolRewardVaultTxData = {
from: this._ownerAddress, from: this._ownerAddress,
to: (this._stakingProxyContractIfExists).address, to: (this._stakingProxyContractIfExists).address,
data: setRewardVaultCalldata, data: setStakingPoolRewardVaultCalldata,
}; };
await this._web3Wrapper.awaitTransactionSuccessAsync( await this._web3Wrapper.awaitTransactionSuccessAsync(
await this._web3Wrapper.sendTransactionAsync(setRewardVaultTxData), await this._web3Wrapper.sendTransactionAsync(setStakingPoolRewardVaultTxData),
); );
// deploy libmath test // deploy libmath test
this._LibFeeMathTestContractIfExists = await LibFeeMathTestContract.deployFrom0xArtifactAsync( this._LibFeeMathTestContractIfExists = await LibFeeMathTestContract.deployFrom0xArtifactAsync(
@@ -601,27 +601,27 @@ export class StakingWrapper {
amount: BigNumber, amount: BigNumber,
stakingContractAddress: string, stakingContractAddress: string,
): Promise<TransactionReceiptWithDecodedLogs> { ): Promise<TransactionReceiptWithDecodedLogs> {
const calldata = this.getRewardVaultContract().depositFor.getABIEncodedTransactionData(poolId); const calldata = this.getStakingPoolRewardVaultContract().depositFor.getABIEncodedTransactionData(poolId);
const txReceipt = await this._executeTransactionAsync(calldata, stakingContractAddress, amount); const txReceipt = await this._executeTransactionAsync(calldata, stakingContractAddress, amount);
return txReceipt; return txReceipt;
} }
public async rewardVaultEnterCatastrophicFailureModeAsync( public async rewardVaultEnterCatastrophicFailureModeAsync(
zeroExMultisigAddress: string, zeroExMultisigAddress: string,
): Promise<TransactionReceiptWithDecodedLogs> { ): Promise<TransactionReceiptWithDecodedLogs> {
const calldata = this.getRewardVaultContract().enterCatostrophicFailure.getABIEncodedTransactionData(); const calldata = this.getStakingPoolRewardVaultContract().enterCatostrophicFailure.getABIEncodedTransactionData();
const txReceipt = await this._executeTransactionAsync(calldata, zeroExMultisigAddress); const txReceipt = await this._executeTransactionAsync(calldata, zeroExMultisigAddress);
return txReceipt; return txReceipt;
} }
public async rewardVaultBalanceOfAsync(poolId: string): Promise<BigNumber> { public async rewardVaultBalanceOfAsync(poolId: string): Promise<BigNumber> {
const balance = await this.getRewardVaultContract().balanceOf.callAsync(poolId); const balance = await this.getStakingPoolRewardVaultContract().balanceOf.callAsync(poolId);
return balance; return balance;
} }
public async rewardVaultBalanceOfOperatorAsync(poolId: string): Promise<BigNumber> { public async rewardVaultBalanceOfOperatorAsync(poolId: string): Promise<BigNumber> {
const balance = await this.getRewardVaultContract().balanceOfOperator.callAsync(poolId); const balance = await this.getStakingPoolRewardVaultContract().balanceOfOperator.callAsync(poolId);
return balance; return balance;
} }
public async rewardVaultBalanceOfPoolAsync(poolId: string): Promise<BigNumber> { public async rewardVaultBalanceOfPoolAsync(poolId: string): Promise<BigNumber> {
const balance = await this.getRewardVaultContract().balanceOfPool.callAsync(poolId); const balance = await this.getStakingPoolRewardVaultContract().balanceOfPool.callAsync(poolId);
return balance; return balance;
} }
public async rewardVaultCreatePoolAsync( public async rewardVaultCreatePoolAsync(
@@ -629,7 +629,7 @@ export class StakingWrapper {
poolOperatorShare: number, poolOperatorShare: number,
stakingContractAddress: string, stakingContractAddress: string,
): Promise<TransactionReceiptWithDecodedLogs> { ): Promise<TransactionReceiptWithDecodedLogs> {
const calldata = this.getRewardVaultContract().createPool.getABIEncodedTransactionData( const calldata = this.getStakingPoolRewardVaultContract().createPool.getABIEncodedTransactionData(
poolId, poolId,
poolOperatorShare, poolOperatorShare,
); );

View File

@@ -6,8 +6,8 @@
"generated-artifacts/LibFeeMathTest.json", "generated-artifacts/LibFeeMathTest.json",
"generated-artifacts/LibZrxToken.json", "generated-artifacts/LibZrxToken.json",
"generated-artifacts/MixinStake.json", "generated-artifacts/MixinStake.json",
"generated-artifacts/RewardVault.json",
"generated-artifacts/Staking.json", "generated-artifacts/Staking.json",
"generated-artifacts/StakingPoolRewardVault.json",
"generated-artifacts/StakingProxy.json", "generated-artifacts/StakingProxy.json",
"generated-artifacts/ZrxVault.json" "generated-artifacts/ZrxVault.json"
], ],