From 58e4654cbe8ad23cc15cd86493933628f6f73744 Mon Sep 17 00:00:00 2001 From: Leonid Beder Date: Thu, 3 Jun 2021 22:26:32 +0100 Subject: [PATCH 1/2] Remove LP address --- settings.json | 1 - 1 file changed, 1 deletion(-) 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": { From 483ecacb5a6d4e32029c8bbddb86ba5165d7c112 Mon Sep 17 00:00:00 2001 From: Leonid Beder Date: Thu, 3 Jun 2021 22:26:50 +0100 Subject: [PATCH 2/2] Optimize storePoolRewards --- tasks/store-pool-rewards.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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);