Refactored finalization state.
1. Removes state variables: - totalWeightedStakeThisEpoch - totalFeesCollectedThisEpoch - numActivePoolsThisEpoch 2. No longer indexes by epoch % 2 3. Renamed event StakingPoolActivated → StakingPoolEarnedRewards. 4. Renamed structs: - ActivePool → PoolStats. This holds stats for a pool that earned rewards. - UnfinalizedState → AggregatedStats. This aggregates stats from the former struct.
This commit is contained in:
@@ -9,7 +9,7 @@ import * as _ from 'lodash';
|
||||
import {
|
||||
artifacts,
|
||||
IStakingEventsEpochEndedEventArgs,
|
||||
IStakingEventsStakingPoolActivatedEventArgs,
|
||||
IStakingEventsStakingPoolEarnedRewardsInEpochEventArgs,
|
||||
ReadOnlyProxyContract,
|
||||
StakingProxyContract,
|
||||
TestCobbDouglasContract,
|
||||
@@ -76,13 +76,13 @@ export class StakingApiWrapper {
|
||||
|
||||
findActivePoolIdsAsync: async (epoch?: number): Promise<string[]> => {
|
||||
const _epoch = epoch !== undefined ? epoch : await this.stakingContract.currentEpoch.callAsync();
|
||||
const events = filterLogsToArguments<IStakingEventsStakingPoolActivatedEventArgs>(
|
||||
const events = filterLogsToArguments<IStakingEventsStakingPoolEarnedRewardsInEpochEventArgs>(
|
||||
await this.stakingContract.getLogsAsync(
|
||||
TestStakingEvents.StakingPoolActivated,
|
||||
TestStakingEvents.StakingPoolEarnedRewardsInEpoch,
|
||||
{ fromBlock: BlockParamLiteral.Earliest, toBlock: BlockParamLiteral.Latest },
|
||||
{ epoch: new BigNumber(_epoch) },
|
||||
),
|
||||
TestStakingEvents.StakingPoolActivated,
|
||||
TestStakingEvents.StakingPoolEarnedRewardsInEpoch,
|
||||
);
|
||||
return events.map(e => e.poolId);
|
||||
},
|
||||
|
Reference in New Issue
Block a user