This repository was archived by the owner on Jul 9, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +13
-18
lines changed Expand file tree Collapse file tree 4 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -127,19 +127,6 @@ contract MixinExchangeFees is
127
127
activePoolsThisEpoch[poolId] = pool;
128
128
}
129
129
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
-
143
130
/// @dev Get information on an active staking pool in this epoch.
144
131
/// @param poolId Pool Id to query.
145
132
/// @return pool ActivePool struct.
Original file line number Diff line number Diff line change @@ -83,10 +83,10 @@ contract TestDelegatorRewards is
83
83
external
84
84
{
85
85
unfinalizedPoolRewardsByEpoch[currentEpoch][poolId] = UnfinalizedPoolReward ({
86
- operatorReward: operatorReward,
87
- membersReward: membersReward,
88
- membersStake: membersStake
89
- });
86
+ operatorReward: operatorReward,
87
+ membersReward: membersReward,
88
+ membersStake: membersStake
89
+ });
90
90
// Lazily initialize this pool.
91
91
_poolById[poolId].operator = operatorAddress;
92
92
_setOperatorShare (poolId, operatorReward, membersReward);
Original file line number Diff line number Diff line change @@ -241,7 +241,9 @@ export class FinalizerActor extends BaseActor {
241
241
this . _stakingApiWrapper . stakingContract . getActiveStakingPoolThisEpoch . callAsync ( poolId ) ,
242
242
) ,
243
243
) ;
244
- const totalRewards = await this . _stakingApiWrapper . stakingContract . getTotalBalance . callAsync ( ) ;
244
+ const totalRewards = await this . _stakingApiWrapper . utils . getEthAndWethBalanceOfAsync (
245
+ this . _stakingApiWrapper . stakingContract . address ,
246
+ ) ;
245
247
const totalFeesCollected = BigNumber . sum ( ...activePools . map ( p => p . feesCollected ) ) ;
246
248
const totalWeightedStake = BigNumber . sum ( ...activePools . map ( p => p . weightedStake ) ) ;
247
249
if ( totalRewards . eq ( 0 ) || totalFeesCollected . eq ( 0 ) || totalWeightedStake . eq ( 0 ) ) {
Original file line number Diff line number Diff line change @@ -128,6 +128,12 @@ export class StakingApiWrapper {
128
128
) ;
129
129
} ,
130
130
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
+
131
137
getParamsAsync : async ( ) : Promise < StakingParams > => {
132
138
return ( _ . zipObject (
133
139
[
You can’t perform that action at this time.
0 commit comments