diff --git a/settings.json b/settings.json index 6bc333a..3933943 100644 --- a/settings.json +++ b/settings.json @@ -17,7 +17,6 @@ "owner": "0x9Ab934010E6f2D633FeEB5b6f1DdCeEdeD601BCF" }, "LiquidityProtection": { - "address": "0x42743f4d9f139bfd04680df50bce2d7dd8816f90", "owner": "0x7E3692A6D8c34a762079Fa9057AeD87be7e67cb8" }, "TokenGovernance": { diff --git a/tasks/store-pool-rewards.js b/tasks/store-pool-rewards.js index 903ed72..e8ad283 100644 --- a/tasks/store-pool-rewards.js +++ b/tasks/store-pool-rewards.js @@ -1,4 +1,5 @@ const { trace, info, error, arg } = require('../utils/logger'); +const BN = require('bn.js'); const DB = require('../utils/db'); const BATCH_SIZE = 15; @@ -9,7 +10,21 @@ const storePoolRewardsTask = async (env, { poolToken }) => { let totalGas = 0; - const providers = Object.keys(data.pendingRewards); + let providers = []; + for (const provider of Object.keys(data.pendingRewards)) { + const rewards = await web3Provider.call( + contracts.StakingRewards.methods.pendingPoolRewards(provider, poolToken) + ); + + if (new BN(rewards).eq(new BN(0))) { + trace('Skipping provider without any pending rewards', arg('provider', provider)); + + continue; + } + + providers.push(provider); + } + for (let i = 0; i < providers.length; i += BATCH_SIZE) { const providersBatch = providers.slice(i, i + BATCH_SIZE);