@0x/contracts-staking
: Remove getTotalBalance()
function.
`@0x/contracts-staking`: Fix linter errors.
This commit is contained in:
@@ -127,19 +127,6 @@ contract MixinExchangeFees is
|
||||
activePoolsThisEpoch[poolId] = pool;
|
||||
}
|
||||
|
||||
/// @dev Returns the total balance of this contract, including WETH.
|
||||
/// @return totalBalance Total balance.
|
||||
function getTotalBalance()
|
||||
external
|
||||
view
|
||||
returns (uint256 totalBalance)
|
||||
{
|
||||
totalBalance = address(this).balance.safeAdd(
|
||||
IEtherToken(_getWETHAddress()).balanceOf(address(this))
|
||||
);
|
||||
return totalBalance;
|
||||
}
|
||||
|
||||
/// @dev Get information on an active staking pool in this epoch.
|
||||
/// @param poolId Pool Id to query.
|
||||
/// @return pool ActivePool struct.
|
||||
|
@@ -83,10 +83,10 @@ contract TestDelegatorRewards is
|
||||
external
|
||||
{
|
||||
unfinalizedPoolRewardsByEpoch[currentEpoch][poolId] = UnfinalizedPoolReward({
|
||||
operatorReward: operatorReward,
|
||||
membersReward: membersReward,
|
||||
membersStake: membersStake
|
||||
});
|
||||
operatorReward: operatorReward,
|
||||
membersReward: membersReward,
|
||||
membersStake: membersStake
|
||||
});
|
||||
// Lazily initialize this pool.
|
||||
_poolById[poolId].operator = operatorAddress;
|
||||
_setOperatorShare(poolId, operatorReward, membersReward);
|
||||
|
@@ -241,7 +241,9 @@ export class FinalizerActor extends BaseActor {
|
||||
this._stakingApiWrapper.stakingContract.getActiveStakingPoolThisEpoch.callAsync(poolId),
|
||||
),
|
||||
);
|
||||
const totalRewards = await this._stakingApiWrapper.stakingContract.getTotalBalance.callAsync();
|
||||
const totalRewards = await this._stakingApiWrapper.utils.getEthAndWethBalanceOfAsync(
|
||||
this._stakingApiWrapper.stakingContract.address,
|
||||
);
|
||||
const totalFeesCollected = BigNumber.sum(...activePools.map(p => p.feesCollected));
|
||||
const totalWeightedStake = BigNumber.sum(...activePools.map(p => p.weightedStake));
|
||||
if (totalRewards.eq(0) || totalFeesCollected.eq(0) || totalWeightedStake.eq(0)) {
|
||||
|
@@ -128,6 +128,12 @@ export class StakingApiWrapper {
|
||||
);
|
||||
},
|
||||
|
||||
getEthAndWethBalanceOfAsync: async (address: string): Promise<BigNumber> => {
|
||||
const ethBalance = await this._web3Wrapper.getBalanceInWeiAsync(address);
|
||||
const wethBalance = await this.wethContract.balanceOf.callAsync(address);
|
||||
return BigNumber.sum(ethBalance, wethBalance);
|
||||
},
|
||||
|
||||
getParamsAsync: async (): Promise<StakingParams> => {
|
||||
return (_.zipObject(
|
||||
[
|
||||
|
Reference in New Issue
Block a user