Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/modules/blockchain/blockchain-module-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ class BlockchainModuleManager extends BaseModuleManager {
]);
}

async getV81ReleaseEpoch(blockchain) {
return this.callImplementationFunction(blockchain, 'getV81ReleaseEpoch');
}

async getAssetStorageContractsAddress(blockchain) {
return this.callImplementationFunction(blockchain, 'getAssetStorageContractsAddress');
}
Expand Down
9 changes: 9 additions & 0 deletions src/modules/blockchain/implementation/web3-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,15 @@ class Web3Service {
});
}

async getV81ReleaseEpoch() {
return this.callContractFunction(
this.contracts.ParametersStorage,
'v81ReleaseEpoch',
[],
CONTRACTS.PARAMETERS_STORAGE,
);
}

async getAssetStorageContractsAddress() {
return Object.keys(this.assetStorageContracts);
}
Expand Down
9 changes: 6 additions & 3 deletions src/service/claim-rewards-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ class ClaimRewardsService {
// This means node never claimed and delegated before introduction of random sampling
// If he staked or claimed before the value would have been set correctly
const delegatorAddresses = lastClaimedEpochAddressesMap['0'];
const v81ReleaseEpoch = Number(
(await this.blockchainModuleManager.getV81ReleaseEpoch(blockchainId)).toString(),
);
await Promise.all(
delegatorAddresses.map(async (delegatorAddress) => {
const hasEverDelegated = await this.blockchainModuleManager.hasEverDelegated(
Expand All @@ -129,12 +132,12 @@ class ClaimRewardsService {
);
// TODO: How will this impact mainnet where this function landed at same time as proofing
if (!hasEverDelegated) {
if (lastClaimedEpochAddressesMap[`${currentEpoch - 1}`]) {
lastClaimedEpochAddressesMap[`${currentEpoch - 1}`].push(
if (lastClaimedEpochAddressesMap[`${v81ReleaseEpoch - 1}`]) {
lastClaimedEpochAddressesMap[`${v81ReleaseEpoch - 1}`].push(
...delegatorAddresses,
);
} else {
lastClaimedEpochAddressesMap[`${currentEpoch - 1}`] =
lastClaimedEpochAddressesMap[`${v81ReleaseEpoch - 1}`] =
delegatorAddresses;
}
}
Expand Down
Loading