Improved readability of API for cumulative rewards

This commit is contained in:
Greg Hysen
2019-09-16 14:30:26 -07:00
parent 12f0797ace
commit f9163ccc01
7 changed files with 178 additions and 76 deletions

View File

@@ -37,20 +37,20 @@ export class CumulativeRewardTrackingSimulation {
private static _extractTestLogs(txReceiptLogs: DecodedLogArgs[]): TestLog[] {
const logs = [];
for (const log of txReceiptLogs) {
if ((log as any).event === 'SetMostRecentCumulativeReward') {
if ((log as DecodedLogArgs).event === 'SetMostRecentCumulativeReward') {
logs.push({
event: 'SetMostRecentCumulativeReward',
epoch: (log as any).args.epoch,
epoch: (log as DecodedLogArgs).args.epoch.toNumber(),
});
} else if ((log as any).event === 'SetCumulativeReward') {
} else if ((log as DecodedLogArgs).event === 'SetCumulativeReward') {
logs.push({
event: 'SetCumulativeReward',
epoch: (log as any).args.epoch,
epoch: (log as DecodedLogArgs).args.epoch.toNumber(),
});
} else if ((log as any).event === 'UnsetCumulativeReward') {
} else if ((log as DecodedLogArgs).event === 'UnsetCumulativeReward') {
logs.push({
event: 'UnsetCumulativeReward',
epoch: (log as any).args.epoch,
epoch: (log as DecodedLogArgs).args.epoch.toNumber(),
});
}
}
@@ -159,7 +159,7 @@ export class CumulativeRewardTrackingSimulation {
{ from: this._poolOperator },
);
const createStakingPoolLog = txReceipt.logs[0];
this._poolId = (createStakingPoolLog as any).args.poolId;
this._poolId = (createStakingPoolLog as DecodedLogArgs).args.poolId;
break;
default: