diff --git a/app/actions/pledges.js b/app/actions/pledges.js index 6ec0366..14ad8a3 100644 --- a/app/actions/pledges.js +++ b/app/actions/pledges.js @@ -55,7 +55,7 @@ export const updateStalePledges = async () => { const stalePledges = await getStalePledges() const updatedPledges = await getPledges(stalePledges) const batch = stalePledges.map(p => { - const updated = updatedPledges[p.pledgeId] + const updated = updatedPledges[p.pledgeId - 1] return p.prepareUpdate(p => { const { amount, nDelegates, pledgeState, blockNumber } = updated p.amount = amount diff --git a/app/utils/pledges.js b/app/utils/pledges.js index 279935e..2bd1873 100644 --- a/app/utils/pledges.js +++ b/app/utils/pledges.js @@ -24,7 +24,7 @@ export const getAllPledges = async (start = 1) => { export const getPledges = async (pledges = []) => { const updated = [] pledges.forEach(p => { - updated[p.pledgeId] = getPledge(p.pledgeId - 1).call() + updated[p.pledgeId - 1] = getPledge(p.pledgeId).call() }) return Promise.all(updated.map(formatPledge)) }