Skip to content
This repository was archived by the owner on Jul 9, 2021. It is now read-only.

Commit 3883297

Browse files
@0x/contracts-staking: Remove getTotalBalance() function.
`@0x/contracts-staking`: Fix linter errors.
1 parent 196cc43 commit 3883297

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

contracts/staking/contracts/src/fees/MixinExchangeFees.sol

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,6 @@ contract MixinExchangeFees is
127127
activePoolsThisEpoch[poolId] = pool;
128128
}
129129

130-
/// @dev Returns the total balance of this contract, including WETH.
131-
/// @return totalBalance Total balance.
132-
function getTotalBalance()
133-
external
134-
view
135-
returns (uint256 totalBalance)
136-
{
137-
totalBalance = address(this).balance.safeAdd(
138-
IEtherToken(_getWETHAddress()).balanceOf(address(this))
139-
);
140-
return totalBalance;
141-
}
142-
143130
/// @dev Get information on an active staking pool in this epoch.
144131
/// @param poolId Pool Id to query.
145132
/// @return pool ActivePool struct.

contracts/staking/contracts/test/TestDelegatorRewards.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ contract TestDelegatorRewards is
8383
external
8484
{
8585
unfinalizedPoolRewardsByEpoch[currentEpoch][poolId] = UnfinalizedPoolReward({
86-
operatorReward: operatorReward,
87-
membersReward: membersReward,
88-
membersStake: membersStake
89-
});
86+
operatorReward: operatorReward,
87+
membersReward: membersReward,
88+
membersStake: membersStake
89+
});
9090
// Lazily initialize this pool.
9191
_poolById[poolId].operator = operatorAddress;
9292
_setOperatorShare(poolId, operatorReward, membersReward);

contracts/staking/test/actors/finalizer_actor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ export class FinalizerActor extends BaseActor {
241241
this._stakingApiWrapper.stakingContract.getActiveStakingPoolThisEpoch.callAsync(poolId),
242242
),
243243
);
244-
const totalRewards = await this._stakingApiWrapper.stakingContract.getTotalBalance.callAsync();
244+
const totalRewards = await this._stakingApiWrapper.utils.getEthAndWethBalanceOfAsync(
245+
this._stakingApiWrapper.stakingContract.address,
246+
);
245247
const totalFeesCollected = BigNumber.sum(...activePools.map(p => p.feesCollected));
246248
const totalWeightedStake = BigNumber.sum(...activePools.map(p => p.weightedStake));
247249
if (totalRewards.eq(0) || totalFeesCollected.eq(0) || totalWeightedStake.eq(0)) {

contracts/staking/test/utils/api_wrapper.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ export class StakingApiWrapper {
128128
);
129129
},
130130

131+
getEthAndWethBalanceOfAsync: async (address: string): Promise<BigNumber> => {
132+
const ethBalance = await this._web3Wrapper.getBalanceInWeiAsync(address);
133+
const wethBalance = await this.wethContract.balanceOf.callAsync(address);
134+
return BigNumber.sum(ethBalance, wethBalance);
135+
},
136+
131137
getParamsAsync: async (): Promise<StakingParams> => {
132138
return (_.zipObject(
133139
[

0 commit comments

Comments
 (0)